diff --git a/docs/docs.go b/docs/docs.go
index 1e94494a..5a09964e 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -1,28 +1,31 @@
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag at
-// 2019-02-02 17:46:50.428407 +0800 CST m=+0.087414608
+// 2020-03-22 15:19:36.759704 +0800 CST m=+0.052176208
package docs
import (
"bytes"
+ "encoding/json"
+ "strings"
"github.com/alecthomas/template"
"github.com/swaggo/swag"
)
var doc = `{
+ "schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
- "description": "An example of gin",
- "title": "Golang Gin API",
+ "description": "{{.Description}}",
+ "title": "{{.Title}}",
"termsOfService": "https://github.com/EDDYCJY/go-gin-example",
"contact": {},
"license": {
"name": "MIT",
"url": "https://github.com/EDDYCJY/go-gin-example/blob/master/LICENSE"
},
- "version": "1.0"
+ "version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
@@ -39,7 +42,7 @@ var doc = `{
"name": "tag_id",
"in": "body",
"schema": {
- "type": "object"
+ "type": "integer"
}
},
{
@@ -47,7 +50,7 @@ var doc = `{
"name": "state",
"in": "body",
"schema": {
- "type": "object"
+ "type": "integer"
}
},
{
@@ -55,7 +58,7 @@ var doc = `{
"name": "created_by",
"in": "body",
"schema": {
- "type": "object"
+ "type": "integer"
}
}
],
@@ -63,14 +66,12 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "type": "object",
"$ref": "#/definitions/app.Response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
- "type": "object",
"$ref": "#/definitions/app.Response"
}
}
@@ -88,7 +89,7 @@ var doc = `{
"in": "body",
"required": true,
"schema": {
- "type": "object"
+ "type": "integer"
}
},
{
@@ -97,7 +98,7 @@ var doc = `{
"in": "body",
"required": true,
"schema": {
- "type": "object"
+ "type": "string"
}
},
{
@@ -106,7 +107,7 @@ var doc = `{
"in": "body",
"required": true,
"schema": {
- "type": "object"
+ "type": "string"
}
},
{
@@ -115,7 +116,7 @@ var doc = `{
"in": "body",
"required": true,
"schema": {
- "type": "object"
+ "type": "string"
}
},
{
@@ -124,7 +125,7 @@ var doc = `{
"in": "body",
"required": true,
"schema": {
- "type": "object"
+ "type": "string"
}
},
{
@@ -133,7 +134,7 @@ var doc = `{
"in": "body",
"required": true,
"schema": {
- "type": "object"
+ "type": "integer"
}
}
],
@@ -141,14 +142,12 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "type": "object",
"$ref": "#/definitions/app.Response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
- "type": "object",
"$ref": "#/definitions/app.Response"
}
}
@@ -174,14 +173,12 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "type": "object",
"$ref": "#/definitions/app.Response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
- "type": "object",
"$ref": "#/definitions/app.Response"
}
}
@@ -205,7 +202,7 @@ var doc = `{
"name": "tag_id",
"in": "body",
"schema": {
- "type": "object"
+ "type": "string"
}
},
{
@@ -213,7 +210,7 @@ var doc = `{
"name": "title",
"in": "body",
"schema": {
- "type": "object"
+ "type": "string"
}
},
{
@@ -221,7 +218,7 @@ var doc = `{
"name": "desc",
"in": "body",
"schema": {
- "type": "object"
+ "type": "string"
}
},
{
@@ -229,7 +226,7 @@ var doc = `{
"name": "content",
"in": "body",
"schema": {
- "type": "object"
+ "type": "string"
}
},
{
@@ -238,7 +235,7 @@ var doc = `{
"in": "body",
"required": true,
"schema": {
- "type": "object"
+ "type": "string"
}
},
{
@@ -246,7 +243,7 @@ var doc = `{
"name": "state",
"in": "body",
"schema": {
- "type": "object"
+ "type": "integer"
}
}
],
@@ -254,14 +251,12 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "type": "object",
"$ref": "#/definitions/app.Response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
- "type": "object",
"$ref": "#/definitions/app.Response"
}
}
@@ -285,14 +280,12 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "type": "object",
"$ref": "#/definitions/app.Response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
- "type": "object",
"$ref": "#/definitions/app.Response"
}
}
@@ -323,14 +316,12 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "type": "object",
"$ref": "#/definitions/app.Response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
- "type": "object",
"$ref": "#/definitions/app.Response"
}
}
@@ -348,7 +339,7 @@ var doc = `{
"in": "body",
"required": true,
"schema": {
- "type": "object"
+ "type": "string"
}
},
{
@@ -356,7 +347,7 @@ var doc = `{
"name": "state",
"in": "body",
"schema": {
- "type": "object"
+ "type": "integer"
}
},
{
@@ -364,7 +355,7 @@ var doc = `{
"name": "created_by",
"in": "body",
"schema": {
- "type": "object"
+ "type": "integer"
}
}
],
@@ -372,14 +363,12 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "type": "object",
"$ref": "#/definitions/app.Response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
- "type": "object",
"$ref": "#/definitions/app.Response"
}
}
@@ -398,7 +387,7 @@ var doc = `{
"name": "name",
"in": "body",
"schema": {
- "type": "object"
+ "type": "string"
}
},
{
@@ -406,7 +395,7 @@ var doc = `{
"name": "state",
"in": "body",
"schema": {
- "type": "object"
+ "type": "integer"
}
}
],
@@ -414,14 +403,12 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "type": "object",
"$ref": "#/definitions/app.Response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
- "type": "object",
"$ref": "#/definitions/app.Response"
}
}
@@ -433,30 +420,26 @@ var doc = `{
"produces": [
"application/json"
],
- "summary": "Import article tag",
+ "summary": "Import Image",
"parameters": [
{
- "description": "Excel File",
- "name": "file",
- "in": "body",
- "required": true,
- "schema": {
- "type": "object"
- }
+ "type": "file",
+ "description": "Image File",
+ "name": "image",
+ "in": "formData",
+ "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "type": "object",
"$ref": "#/definitions/app.Response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
- "type": "object",
"$ref": "#/definitions/app.Response"
}
}
@@ -478,12 +461,12 @@ var doc = `{
"required": true
},
{
- "description": "ID",
+ "description": "Name",
"name": "name",
"in": "body",
"required": true,
"schema": {
- "type": "object"
+ "type": "string"
}
},
{
@@ -491,7 +474,7 @@ var doc = `{
"name": "state",
"in": "body",
"schema": {
- "type": "object"
+ "type": "integer"
}
},
{
@@ -500,7 +483,7 @@ var doc = `{
"in": "body",
"required": true,
"schema": {
- "type": "object"
+ "type": "string"
}
}
],
@@ -508,14 +491,12 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "type": "object",
"$ref": "#/definitions/app.Response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
- "type": "object",
"$ref": "#/definitions/app.Response"
}
}
@@ -539,14 +520,50 @@ var doc = `{
"200": {
"description": "OK",
"schema": {
- "type": "object",
"$ref": "#/definitions/app.Response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
- "type": "object",
+ "$ref": "#/definitions/app.Response"
+ }
+ }
+ }
+ }
+ },
+ "/auth": {
+ "get": {
+ "produces": [
+ "application/json"
+ ],
+ "summary": "Get Auth",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "userName",
+ "name": "username",
+ "in": "query",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "password",
+ "name": "password",
+ "in": "query",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/app.Response"
+ }
+ },
+ "500": {
+ "description": "Internal Server Error",
+ "schema": {
"$ref": "#/definitions/app.Response"
}
}
@@ -576,23 +593,39 @@ type swaggerInfo struct {
Version string
Host string
BasePath string
+ Schemes []string
Title string
Description string
}
// SwaggerInfo holds exported Swagger Info so clients can modify it
-var SwaggerInfo swaggerInfo
+var SwaggerInfo = swaggerInfo{
+ Version: "1.0",
+ Host: "",
+ BasePath: "",
+ Schemes: []string{},
+ Title: "Golang Gin API",
+ Description: "An example of gin",
+}
type s struct{}
func (s *s) ReadDoc() string {
- t, err := template.New("swagger_info").Parse(doc)
+ sInfo := SwaggerInfo
+ sInfo.Description = strings.Replace(sInfo.Description, "\n", "\\n", -1)
+
+ t, err := template.New("swagger_info").Funcs(template.FuncMap{
+ "marshal": func(v interface{}) string {
+ a, _ := json.Marshal(v)
+ return string(a)
+ },
+ }).Parse(doc)
if err != nil {
return doc
}
var tpl bytes.Buffer
- if err := t.Execute(&tpl, SwaggerInfo); err != nil {
+ if err := t.Execute(&tpl, sInfo); err != nil {
return doc
}
diff --git a/docs/swagger.json b/docs/swagger.json
new file mode 100644
index 00000000..39df2015
--- /dev/null
+++ b/docs/swagger.json
@@ -0,0 +1,572 @@
+{
+ "swagger": "2.0",
+ "info": {
+ "description": "An example of gin",
+ "title": "Golang Gin API",
+ "termsOfService": "https://github.com/EDDYCJY/go-gin-example",
+ "contact": {},
+ "license": {
+ "name": "MIT",
+ "url": "https://github.com/EDDYCJY/go-gin-example/blob/master/LICENSE"
+ },
+ "version": "1.0"
+ },
+ "paths": {
+ "/api/v1/articles": {
+ "get": {
+ "produces": [
+ "application/json"
+ ],
+ "summary": "Get multiple articles",
+ "parameters": [
+ {
+ "description": "TagID",
+ "name": "tag_id",
+ "in": "body",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "description": "State",
+ "name": "state",
+ "in": "body",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "description": "CreatedBy",
+ "name": "created_by",
+ "in": "body",
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/app.Response"
+ }
+ },
+ "500": {
+ "description": "Internal Server Error",
+ "schema": {
+ "$ref": "#/definitions/app.Response"
+ }
+ }
+ }
+ },
+ "post": {
+ "produces": [
+ "application/json"
+ ],
+ "summary": "Add article",
+ "parameters": [
+ {
+ "description": "TagID",
+ "name": "tag_id",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "description": "Title",
+ "name": "title",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "description": "Desc",
+ "name": "desc",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "description": "Content",
+ "name": "content",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "description": "CreatedBy",
+ "name": "created_by",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "description": "State",
+ "name": "state",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/app.Response"
+ }
+ },
+ "500": {
+ "description": "Internal Server Error",
+ "schema": {
+ "$ref": "#/definitions/app.Response"
+ }
+ }
+ }
+ }
+ },
+ "/api/v1/articles/{id}": {
+ "get": {
+ "produces": [
+ "application/json"
+ ],
+ "summary": "Get a single article",
+ "parameters": [
+ {
+ "type": "integer",
+ "description": "ID",
+ "name": "id",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/app.Response"
+ }
+ },
+ "500": {
+ "description": "Internal Server Error",
+ "schema": {
+ "$ref": "#/definitions/app.Response"
+ }
+ }
+ }
+ },
+ "put": {
+ "produces": [
+ "application/json"
+ ],
+ "summary": "Update article",
+ "parameters": [
+ {
+ "type": "integer",
+ "description": "ID",
+ "name": "id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "TagID",
+ "name": "tag_id",
+ "in": "body",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "description": "Title",
+ "name": "title",
+ "in": "body",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "description": "Desc",
+ "name": "desc",
+ "in": "body",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "description": "Content",
+ "name": "content",
+ "in": "body",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "description": "ModifiedBy",
+ "name": "modified_by",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "description": "State",
+ "name": "state",
+ "in": "body",
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/app.Response"
+ }
+ },
+ "500": {
+ "description": "Internal Server Error",
+ "schema": {
+ "$ref": "#/definitions/app.Response"
+ }
+ }
+ }
+ },
+ "delete": {
+ "produces": [
+ "application/json"
+ ],
+ "summary": "Delete article",
+ "parameters": [
+ {
+ "type": "integer",
+ "description": "ID",
+ "name": "id",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/app.Response"
+ }
+ },
+ "500": {
+ "description": "Internal Server Error",
+ "schema": {
+ "$ref": "#/definitions/app.Response"
+ }
+ }
+ }
+ }
+ },
+ "/api/v1/tags": {
+ "get": {
+ "produces": [
+ "application/json"
+ ],
+ "summary": "Get multiple article tags",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "Name",
+ "name": "name",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "State",
+ "name": "state",
+ "in": "query"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/app.Response"
+ }
+ },
+ "500": {
+ "description": "Internal Server Error",
+ "schema": {
+ "$ref": "#/definitions/app.Response"
+ }
+ }
+ }
+ },
+ "post": {
+ "produces": [
+ "application/json"
+ ],
+ "summary": "Add article tag",
+ "parameters": [
+ {
+ "description": "Name",
+ "name": "name",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "description": "State",
+ "name": "state",
+ "in": "body",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "description": "CreatedBy",
+ "name": "created_by",
+ "in": "body",
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/app.Response"
+ }
+ },
+ "500": {
+ "description": "Internal Server Error",
+ "schema": {
+ "$ref": "#/definitions/app.Response"
+ }
+ }
+ }
+ }
+ },
+ "/api/v1/tags/export": {
+ "post": {
+ "produces": [
+ "application/json"
+ ],
+ "summary": "Export article tag",
+ "parameters": [
+ {
+ "description": "Name",
+ "name": "name",
+ "in": "body",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "description": "State",
+ "name": "state",
+ "in": "body",
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/app.Response"
+ }
+ },
+ "500": {
+ "description": "Internal Server Error",
+ "schema": {
+ "$ref": "#/definitions/app.Response"
+ }
+ }
+ }
+ }
+ },
+ "/api/v1/tags/import": {
+ "post": {
+ "produces": [
+ "application/json"
+ ],
+ "summary": "Import Image",
+ "parameters": [
+ {
+ "type": "file",
+ "description": "Image File",
+ "name": "image",
+ "in": "formData",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/app.Response"
+ }
+ },
+ "500": {
+ "description": "Internal Server Error",
+ "schema": {
+ "$ref": "#/definitions/app.Response"
+ }
+ }
+ }
+ }
+ },
+ "/api/v1/tags/{id}": {
+ "put": {
+ "produces": [
+ "application/json"
+ ],
+ "summary": "Update article tag",
+ "parameters": [
+ {
+ "type": "integer",
+ "description": "ID",
+ "name": "id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "description": "Name",
+ "name": "name",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "description": "State",
+ "name": "state",
+ "in": "body",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "description": "ModifiedBy",
+ "name": "modified_by",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/app.Response"
+ }
+ },
+ "500": {
+ "description": "Internal Server Error",
+ "schema": {
+ "$ref": "#/definitions/app.Response"
+ }
+ }
+ }
+ },
+ "delete": {
+ "produces": [
+ "application/json"
+ ],
+ "summary": "Delete article tag",
+ "parameters": [
+ {
+ "type": "integer",
+ "description": "ID",
+ "name": "id",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/app.Response"
+ }
+ },
+ "500": {
+ "description": "Internal Server Error",
+ "schema": {
+ "$ref": "#/definitions/app.Response"
+ }
+ }
+ }
+ }
+ },
+ "/auth": {
+ "get": {
+ "produces": [
+ "application/json"
+ ],
+ "summary": "Get Auth",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "userName",
+ "name": "username",
+ "in": "query",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "password",
+ "name": "password",
+ "in": "query",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/app.Response"
+ }
+ },
+ "500": {
+ "description": "Internal Server Error",
+ "schema": {
+ "$ref": "#/definitions/app.Response"
+ }
+ }
+ }
+ }
+ }
+ },
+ "definitions": {
+ "app.Response": {
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "integer"
+ },
+ "data": {
+ "type": "object"
+ },
+ "msg": {
+ "type": "string"
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
new file mode 100644
index 00000000..ea9b5f83
--- /dev/null
+++ b/docs/swagger.yaml
@@ -0,0 +1,369 @@
+definitions:
+ app.Response:
+ properties:
+ code:
+ type: integer
+ data:
+ type: object
+ msg:
+ type: string
+ type: object
+info:
+ contact: {}
+ description: An example of gin
+ license:
+ name: MIT
+ url: https://github.com/EDDYCJY/go-gin-example/blob/master/LICENSE
+ termsOfService: https://github.com/EDDYCJY/go-gin-example
+ title: Golang Gin API
+ version: "1.0"
+paths:
+ /api/v1/articles:
+ get:
+ parameters:
+ - description: TagID
+ in: body
+ name: tag_id
+ schema:
+ type: integer
+ - description: State
+ in: body
+ name: state
+ schema:
+ type: integer
+ - description: CreatedBy
+ in: body
+ name: created_by
+ schema:
+ type: integer
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ $ref: '#/definitions/app.Response'
+ "500":
+ description: Internal Server Error
+ schema:
+ $ref: '#/definitions/app.Response'
+ summary: Get multiple articles
+ post:
+ parameters:
+ - description: TagID
+ in: body
+ name: tag_id
+ required: true
+ schema:
+ type: integer
+ - description: Title
+ in: body
+ name: title
+ required: true
+ schema:
+ type: string
+ - description: Desc
+ in: body
+ name: desc
+ required: true
+ schema:
+ type: string
+ - description: Content
+ in: body
+ name: content
+ required: true
+ schema:
+ type: string
+ - description: CreatedBy
+ in: body
+ name: created_by
+ required: true
+ schema:
+ type: string
+ - description: State
+ in: body
+ name: state
+ required: true
+ schema:
+ type: integer
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ $ref: '#/definitions/app.Response'
+ "500":
+ description: Internal Server Error
+ schema:
+ $ref: '#/definitions/app.Response'
+ summary: Add article
+ /api/v1/articles/{id}:
+ delete:
+ parameters:
+ - description: ID
+ in: path
+ name: id
+ required: true
+ type: integer
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ $ref: '#/definitions/app.Response'
+ "500":
+ description: Internal Server Error
+ schema:
+ $ref: '#/definitions/app.Response'
+ summary: Delete article
+ get:
+ parameters:
+ - description: ID
+ in: path
+ name: id
+ required: true
+ type: integer
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ $ref: '#/definitions/app.Response'
+ "500":
+ description: Internal Server Error
+ schema:
+ $ref: '#/definitions/app.Response'
+ summary: Get a single article
+ put:
+ parameters:
+ - description: ID
+ in: path
+ name: id
+ required: true
+ type: integer
+ - description: TagID
+ in: body
+ name: tag_id
+ schema:
+ type: string
+ - description: Title
+ in: body
+ name: title
+ schema:
+ type: string
+ - description: Desc
+ in: body
+ name: desc
+ schema:
+ type: string
+ - description: Content
+ in: body
+ name: content
+ schema:
+ type: string
+ - description: ModifiedBy
+ in: body
+ name: modified_by
+ required: true
+ schema:
+ type: string
+ - description: State
+ in: body
+ name: state
+ schema:
+ type: integer
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ $ref: '#/definitions/app.Response'
+ "500":
+ description: Internal Server Error
+ schema:
+ $ref: '#/definitions/app.Response'
+ summary: Update article
+ /api/v1/tags:
+ get:
+ parameters:
+ - description: Name
+ in: query
+ name: name
+ type: string
+ - description: State
+ in: query
+ name: state
+ type: integer
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ $ref: '#/definitions/app.Response'
+ "500":
+ description: Internal Server Error
+ schema:
+ $ref: '#/definitions/app.Response'
+ summary: Get multiple article tags
+ post:
+ parameters:
+ - description: Name
+ in: body
+ name: name
+ required: true
+ schema:
+ type: string
+ - description: State
+ in: body
+ name: state
+ schema:
+ type: integer
+ - description: CreatedBy
+ in: body
+ name: created_by
+ schema:
+ type: integer
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ $ref: '#/definitions/app.Response'
+ "500":
+ description: Internal Server Error
+ schema:
+ $ref: '#/definitions/app.Response'
+ summary: Add article tag
+ /api/v1/tags/{id}:
+ delete:
+ parameters:
+ - description: ID
+ in: path
+ name: id
+ required: true
+ type: integer
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ $ref: '#/definitions/app.Response'
+ "500":
+ description: Internal Server Error
+ schema:
+ $ref: '#/definitions/app.Response'
+ summary: Delete article tag
+ put:
+ parameters:
+ - description: ID
+ in: path
+ name: id
+ required: true
+ type: integer
+ - description: Name
+ in: body
+ name: name
+ required: true
+ schema:
+ type: string
+ - description: State
+ in: body
+ name: state
+ schema:
+ type: integer
+ - description: ModifiedBy
+ in: body
+ name: modified_by
+ required: true
+ schema:
+ type: string
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ $ref: '#/definitions/app.Response'
+ "500":
+ description: Internal Server Error
+ schema:
+ $ref: '#/definitions/app.Response'
+ summary: Update article tag
+ /api/v1/tags/export:
+ post:
+ parameters:
+ - description: Name
+ in: body
+ name: name
+ schema:
+ type: string
+ - description: State
+ in: body
+ name: state
+ schema:
+ type: integer
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ $ref: '#/definitions/app.Response'
+ "500":
+ description: Internal Server Error
+ schema:
+ $ref: '#/definitions/app.Response'
+ summary: Export article tag
+ /api/v1/tags/import:
+ post:
+ parameters:
+ - description: Image File
+ in: formData
+ name: image
+ required: true
+ type: file
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ $ref: '#/definitions/app.Response'
+ "500":
+ description: Internal Server Error
+ schema:
+ $ref: '#/definitions/app.Response'
+ summary: Import Image
+ /auth:
+ get:
+ parameters:
+ - description: userName
+ in: query
+ name: username
+ required: true
+ type: string
+ - description: password
+ in: query
+ name: password
+ required: true
+ type: string
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ $ref: '#/definitions/app.Response'
+ "500":
+ description: Internal Server Error
+ schema:
+ $ref: '#/definitions/app.Response'
+ summary: Get Auth
+swagger: "2.0"
diff --git a/go.mod b/go.mod
index ddf82ec8..a6a24dd6 100644
--- a/go.mod
+++ b/go.mod
@@ -11,7 +11,7 @@ require (
github.com/denisenkom/go-mssqldb v0.0.0-20190920000552-128d9f4ae1cd // indirect
github.com/dgrijalva/jwt-go v3.1.0+incompatible
github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5 // indirect
- github.com/gin-gonic/gin v1.3.0
+ github.com/gin-gonic/gin v1.4.0
github.com/go-ini/ini v1.32.1-0.20180214101753-32e4be5f41bb
github.com/go-sql-driver/mysql v1.4.1-0.20190510102335-877a9775f068 // indirect
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0
@@ -24,13 +24,12 @@ require (
github.com/mattn/go-sqlite3 v1.11.0 // indirect
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337 // indirect
- github.com/swaggo/gin-swagger v1.0.1-0.20190110070702-0c6fcfd3c7f3
- github.com/swaggo/swag v1.4.0
+ github.com/swaggo/gin-swagger v1.2.0
+ github.com/swaggo/swag v1.5.1
github.com/tealeg/xlsx v1.0.4-0.20180419195153-f36fa3be8893
github.com/unknwon/com v1.0.1
golang.org/x/image v0.0.0-20180628062038-cc896f830ced // indirect
golang.org/x/sys v0.0.0-20190921204832-2dccfee4fd3e // indirect
google.golang.org/appengine v1.6.3 // indirect
- gopkg.in/go-playground/assert.v1 v1.2.1 // indirect
gopkg.in/ini.v1 v1.47.0 // indirect
)
diff --git a/go.sum b/go.sum
index 2b39878b..ec1b49dd 100644
--- a/go.sum
+++ b/go.sum
@@ -20,19 +20,27 @@ github.com/dgrijalva/jwt-go v3.1.0+incompatible h1:FFziAwDQQ2dz1XClWMkwvukur3evt
github.com/dgrijalva/jwt-go v3.1.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5 h1:Yzb9+7DPaBjB8zlTR87/ElzFsnQfuHnVUVqpZZIcV5Y=
github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5/go.mod h1:a2zkGnVExMxdzMo3M0Hi/3sEU+cWnZpSni0O6/Yb/P0=
+github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
+github.com/gin-contrib/gzip v0.0.1 h1:ezvKOL6jH+jlzdHNE4h9h8q8uMpDQjyl0NN0Jd7jozc=
+github.com/gin-contrib/gzip v0.0.1/go.mod h1:fGBJBCdt6qCZuCAOwWuFhBB4OOq9EFqlo5dEaFhhu5w=
github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7 h1:AzN37oI0cOS+cougNAV9szl6CVoj2RYwzS3DpUQNtlY=
github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s=
+github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s=
+github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
+github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
github.com/gin-gonic/gin v1.3.0 h1:kCmZyPklC0gVdL728E6Aj20uYBJV93nj/TkwBTKhFbs=
github.com/gin-gonic/gin v1.3.0/go.mod h1:7cKuhb5qV2ggCFctp2fJQ+ErvciLZrIeoOSOm6mUr7Y=
+github.com/gin-gonic/gin v1.4.0 h1:3tMoCCfM7ppqsR0ptz/wi1impNpT7/9wQtMZ8lr1mCQ=
+github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/3rZdM=
github.com/go-ini/ini v1.32.1-0.20180214101753-32e4be5f41bb h1:v+YnQ81wH+hTjaP5nFSpqASFbe9UETYm1vG65qp7Zc0=
github.com/go-ini/ini v1.32.1-0.20180214101753-32e4be5f41bb/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
github.com/go-openapi/jsonpointer v0.17.0 h1:nH6xp8XdXHx8dqveo0ZuJBluCO2qGrPbDNZ0dwoRHP0=
github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M=
github.com/go-openapi/jsonreference v0.17.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I=
-github.com/go-openapi/jsonreference v0.18.0 h1:oP2OUNdG1l2r5kYhrfVMXO54gWmzcfAwP/GFuHpNTkE=
-github.com/go-openapi/jsonreference v0.18.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I=
-github.com/go-openapi/spec v0.18.0 h1:aIjeyG5mo5/FrvDkpKKEGZPmF9MPHahS72mzfVqeQXQ=
-github.com/go-openapi/spec v0.18.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI=
+github.com/go-openapi/jsonreference v0.19.0 h1:BqWKpV1dFd+AuiKlgtddwVIFQsuMpxfBDBHGfM2yNpk=
+github.com/go-openapi/jsonreference v0.19.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I=
+github.com/go-openapi/spec v0.19.0 h1:A4SZ6IWh3lnjH0rG0Z5lkxazMGBECtrZcbyYQi+64k4=
+github.com/go-openapi/spec v0.19.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI=
github.com/go-openapi/swag v0.17.0 h1:iqrgMg7Q7SvtbWLlltPrkMs0UBJI6oTSs79JFRUi880=
github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg=
github.com/go-sql-driver/mysql v1.4.1-0.20190510102335-877a9775f068 h1:q2kwd9Bcgl2QpSi/Wjcx9jzwyICt3EWTP5to43QhwaA=
@@ -58,23 +66,37 @@ github.com/jinzhu/inflection v0.0.0-20170102125226-1c35d901db3d h1:jRQLvyVGL+iVt
github.com/jinzhu/inflection v0.0.0-20170102125226-1c35d901db3d/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
github.com/jinzhu/now v1.0.1 h1:HjfetcXq097iXP0uoPCdnM4Efp5/9MsM0/M+XOTeR3M=
github.com/jinzhu/now v1.0.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
+github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
+github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
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/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
+github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
+github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
+github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
+github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
+github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/lib/pq v1.2.0 h1:LXpIM/LZ5xGFhOpXAQUIMM1HdyqzVYM13zNdjCEEcA0=
github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329 h1:2gxZ0XQIU/5z3Z3bUBu+FXuk2pFbkN6tcwi/pjyaDic=
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs=
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
+github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
+github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE=
+github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-sqlite3 v1.11.0 h1:LDdKkqtYlom37fkvqs8rMPFKAMe8+SgjbwZ6ex1/A/Q=
github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
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/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
+github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/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/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
+github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw=
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
@@ -92,16 +114,21 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
-github.com/swaggo/gin-swagger v1.0.1-0.20190110070702-0c6fcfd3c7f3 h1:N3S+gW4ppZ6wniSRaizEMfLfraE/QXNbyOGj5+BwLQ0=
-github.com/swaggo/gin-swagger v1.0.1-0.20190110070702-0c6fcfd3c7f3/go.mod h1:FQlm07YuT1glfN3hQiO11UQ2m39vOCZ/aa3WWr5E+XU=
-github.com/swaggo/swag v1.4.0 h1:exX5ES4CdJWCCKmVPE+FAIN66cnHeMHU3i2SCMibBZc=
-github.com/swaggo/swag v1.4.0/go.mod h1:hog2WgeMOrQ/LvQ+o1YGTeT+vWVrbi0SiIslBtxKTyM=
+github.com/swaggo/gin-swagger v1.2.0 h1:YskZXEiv51fjOMTsXrOetAjrMDfFaXD79PEoQBOe2W0=
+github.com/swaggo/gin-swagger v1.2.0/go.mod h1:qlH2+W7zXGZkczuL+r2nEBR2JTT+/lX05Nn6vPhc7OI=
+github.com/swaggo/swag v1.5.1 h1:2Agm8I4K5qb00620mHq0VJ05/KT4FtmALPIcQR9lEZM=
+github.com/swaggo/swag v1.5.1/go.mod h1:1Bl9F/ZBpVWh22nY0zmYyASPO1lI/zIwRDrpZU+tv8Y=
github.com/tealeg/xlsx v1.0.4-0.20180419195153-f36fa3be8893 h1:x+HNL/+eUTIzieDdCKbl6QjneUXKuiiTBvC9s5USpT0=
github.com/tealeg/xlsx v1.0.4-0.20180419195153-f36fa3be8893/go.mod h1:uxu5UY2ovkuRPWKQ8Q7JG0JbSivrISjdPzZQKeo74mA=
-github.com/ugorji/go/codec v0.0.0-20181209151446-772ced7fd4c2 h1:EICbibRW4JNKMcY+LsWmuwob+CRS1BmdRdjphAm9mH4=
-github.com/ugorji/go/codec v0.0.0-20181209151446-772ced7fd4c2/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
+github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
+github.com/ugorji/go v1.1.5-pre h1:jyJKFOSEbdOc2HODrf2qcCkYOdq7zzXqA9bhW5oV4fM=
+github.com/ugorji/go v1.1.5-pre/go.mod h1:FwP/aQVg39TXzItUBMwnWp9T9gPQnXw4Poh4/oBQZ/0=
+github.com/ugorji/go/codec v0.0.0-20181022190402-e5e69e061d4f/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
+github.com/ugorji/go/codec v1.1.5-pre h1:5YV9PsFAN+ndcCtTM7s60no7nY7eTG3LPtxhSwuxzCs=
+github.com/ugorji/go/codec v1.1.5-pre/go.mod h1:tULtS6Gy1AE1yCENaw4Vb//HLH5njI2tfCQDUqRd8fI=
github.com/unknwon/com v1.0.1 h1:3d1LTxD+Lnf3soQiD4Cp/0BRB+Rsa/+RTvz8GMMzIXs=
github.com/unknwon/com v1.0.1/go.mod h1:tOOxU81rwgoCLoOVVPHb6T/wt8HZygqH5id+GNnlCXM=
+github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5 h1:58fnuSXlxZmFdJyvtTFVmVhcMLU6v5fEb/ok4wyqtNU=
@@ -109,31 +136,40 @@ golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/image v0.0.0-20180628062038-cc896f830ced h1:2QsAEqOy4Mp+V4HL2Wr1iBNpZWaL72EvTO4oj5bmr5w=
golang.org/x/image v0.0.0-20180628062038-cc896f830ced/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs=
golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
-golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg=
-golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65 h1:+rhAzEzT3f4JtomfC371qB+0Ola2caSKcY69NUBZrRQ=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
+golang.org/x/net v0.0.0-20190611141213-3f473d35a33a h1:+KkCgOMgnKSgenxTBoiwkMqTiouMIy/3o8RLdmSbGoY=
+golang.org/x/net v0.0.0-20190611141213-3f473d35a33a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sys v0.0.0-20181228144115-9a3f9b0469bb/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190610200419-93c9922d18ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190921204832-2dccfee4fd3e h1:9ZBATxGrhPGloVV3LDg+OqDyEtcYRtQ9eIVlIjan6+M=
golang.org/x/sys v0.0.0-20190921204832-2dccfee4fd3e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
-golang.org/x/tools v0.0.0-20190110015856-aa033095749b h1:G5tsw1T5VA7PD7VmXyGtX/hQp3ABPSCPRKVfsdUcVxs=
-golang.org/x/tools v0.0.0-20190110015856-aa033095749b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
+golang.org/x/tools v0.0.0-20190606050223-4d9ae51c2468/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b h1:mSUCVIwDx4hfXJfWsOPfdzEHxzb2Xjl6BQ8YgPnazQA=
golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
+golang.org/x/tools v0.0.0-20190611222205-d73e1c7e250b h1:/mJ+GKieZA6hFDQGdWZrjj4AXPl5ylY+5HusG80roy0=
+golang.org/x/tools v0.0.0-20190611222205-d73e1c7e250b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
google.golang.org/appengine v1.6.3 h1:hvZejVcIxAKHR8Pq2gXaDggf6CWT1QEqO+JEBeOKCG8=
google.golang.org/appengine v1.6.3/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
+gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM=
gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE=
gopkg.in/go-playground/validator.v8 v8.18.2 h1:lFB4DoMU6B626w8ny76MV7VX6W2VHct2GVOI3xgiMrQ=
diff --git a/vendor/github.com/gin-contrib/sse/.travis.yml b/vendor/github.com/gin-contrib/sse/.travis.yml
index a556ac09..d0e8fcf9 100644
--- a/vendor/github.com/gin-contrib/sse/.travis.yml
+++ b/vendor/github.com/gin-contrib/sse/.travis.yml
@@ -1,15 +1,26 @@
language: go
sudo: false
go:
- - 1.6.4
- - 1.7.4
- - tip
+ - 1.8.x
+ - 1.9.x
+ - 1.10.x
+ - 1.11.x
+ - 1.12.x
+ - master
git:
- depth: 3
+ depth: 10
+
+matrix:
+ fast_finish: true
+ include:
+ - go: 1.11.x
+ env: GO111MODULE=on
+ - go: 1.12.x
+ env: GO111MODULE=on
script:
- go test -v -covermode=count -coverprofile=coverage.out
after_success:
- - bash <(curl -s https://codecov.io/bash)
\ No newline at end of file
+ - bash <(curl -s https://codecov.io/bash)
diff --git a/vendor/github.com/gin-contrib/sse/go.mod b/vendor/github.com/gin-contrib/sse/go.mod
new file mode 100644
index 00000000..b9c03f47
--- /dev/null
+++ b/vendor/github.com/gin-contrib/sse/go.mod
@@ -0,0 +1,5 @@
+module github.com/gin-contrib/sse
+
+go 1.12
+
+require github.com/stretchr/testify v1.3.0
diff --git a/vendor/github.com/gin-contrib/sse/go.sum b/vendor/github.com/gin-contrib/sse/go.sum
new file mode 100644
index 00000000..4347755a
--- /dev/null
+++ b/vendor/github.com/gin-contrib/sse/go.sum
@@ -0,0 +1,7 @@
+github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
+github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
+github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
diff --git a/vendor/github.com/gin-gonic/gin/.gitignore b/vendor/github.com/gin-gonic/gin/.gitignore
index 14dc8f20..bdd50c95 100644
--- a/vendor/github.com/gin-gonic/gin/.gitignore
+++ b/vendor/github.com/gin-gonic/gin/.gitignore
@@ -3,3 +3,5 @@ vendor/*
coverage.out
count.out
test
+profile.out
+tmp.out
diff --git a/vendor/github.com/gin-gonic/gin/.travis.yml b/vendor/github.com/gin-gonic/gin/.travis.yml
index e9101568..f6ec8a82 100644
--- a/vendor/github.com/gin-gonic/gin/.travis.yml
+++ b/vendor/github.com/gin-gonic/gin/.travis.yml
@@ -1,25 +1,34 @@
language: go
-sudo: false
-go:
- - 1.6.x
- - 1.7.x
- - 1.8.x
- - 1.9.x
- - 1.10.x
- - master
+
+matrix:
+ fast_finish: true
+ include:
+ - go: 1.8.x
+ - go: 1.9.x
+ - go: 1.10.x
+ - go: 1.11.x
+ env: GO111MODULE=on
+ - go: 1.12.x
+ env: GO111MODULE=on
+ - go: master
+ env: GO111MODULE=on
git:
depth: 10
+before_install:
+ - if [[ "${GO111MODULE}" = "on" ]]; then mkdir "${HOME}/go"; export GOPATH="${HOME}/go"; fi
+
install:
- - make install
+ - if [[ "${GO111MODULE}" = "on" ]]; then go mod download; else make install; fi
+ - if [[ "${GO111MODULE}" = "on" ]]; then export PATH="${GOPATH}/bin:${GOROOT}/bin:${PATH}"; fi
+ - if [[ "${GO111MODULE}" = "on" ]]; then make tools; fi
go_import_path: github.com/gin-gonic/gin
script:
- make vet
- make fmt-check
- - make embedmd
- make misspell-check
- make test
diff --git a/vendor/github.com/gin-gonic/gin/CHANGELOG.md b/vendor/github.com/gin-gonic/gin/CHANGELOG.md
index e6a108ca..8ea2495d 100644
--- a/vendor/github.com/gin-gonic/gin/CHANGELOG.md
+++ b/vendor/github.com/gin-gonic/gin/CHANGELOG.md
@@ -1,4 +1,60 @@
-# CHANGELOG
+
+### Gin 1.4.0
+
+- [NEW] Support for [Go Modules](https://github.com/golang/go/wiki/Modules) [#1569](https://github.com/gin-gonic/gin/pull/1569)
+- [NEW] Refactor of form mapping multipart requesta [#1829](https://github.com/gin-gonic/gin/pull/1829)
+- [FIX] Truncate Latency precision in long running request [#1830](https://github.com/gin-gonic/gin/pull/1830)
+- [FIX] IsTerm flag should not be affected by DisableConsoleColor method. [#1802](https://github.com/gin-gonic/gin/pull/1802)
+- [NEW] Supporting file binding [#1264](https://github.com/gin-gonic/gin/pull/1264)
+- [NEW] Add support for mapping arrays [#1797](https://github.com/gin-gonic/gin/pull/1797)
+- [FIX] Readme updates [#1793](https://github.com/gin-gonic/gin/pull/1793) [#1788](https://github.com/gin-gonic/gin/pull/1788) [1789](https://github.com/gin-gonic/gin/pull/1789)
+- [FIX] StaticFS: Fixed Logging two log lines on 404. [#1805](https://github.com/gin-gonic/gin/pull/1805), [#1804](https://github.com/gin-gonic/gin/pull/1804)
+- [NEW] Make context.Keys available as LogFormatterParams [#1779](https://github.com/gin-gonic/gin/pull/1779)
+- [NEW] Use internal/json for Marshal/Unmarshal [#1791](https://github.com/gin-gonic/gin/pull/1791)
+- [NEW] Support mapping time.Duration [#1794](https://github.com/gin-gonic/gin/pull/1794)
+- [NEW] Refactor form mappings [#1749](https://github.com/gin-gonic/gin/pull/1749)
+- [NEW] Added flag to context.Stream indicates if client disconnected in middle of stream [#1252](https://github.com/gin-gonic/gin/pull/1252)
+- [FIX] Moved [examples](https://github.com/gin-gonic/examples) to stand alone Repo [#1775](https://github.com/gin-gonic/gin/pull/1775)
+- [NEW] Extend context.File to allow for the content-dispositon attachments via a new method context.Attachment [#1260](https://github.com/gin-gonic/gin/pull/1260)
+- [FIX] Support HTTP content negotiation wildcards [#1112](https://github.com/gin-gonic/gin/pull/1112)
+- [NEW] Add prefix from X-Forwarded-Prefix in redirectTrailingSlash [#1238](https://github.com/gin-gonic/gin/pull/1238)
+- [FIX] context.Copy() race condition [#1020](https://github.com/gin-gonic/gin/pull/1020)
+- [NEW] Add context.HandlerNames() [#1729](https://github.com/gin-gonic/gin/pull/1729)
+- [FIX] Change color methods to public in the defaultLogger. [#1771](https://github.com/gin-gonic/gin/pull/1771)
+- [FIX] Update writeHeaders method to use http.Header.Set [#1722](https://github.com/gin-gonic/gin/pull/1722)
+- [NEW] Add response size to LogFormatterParams [#1752](https://github.com/gin-gonic/gin/pull/1752)
+- [NEW] Allow ignoring field on form mapping [#1733](https://github.com/gin-gonic/gin/pull/1733)
+- [NEW] Add a function to force color in console output. [#1724](https://github.com/gin-gonic/gin/pull/1724)
+- [FIX] Context.Next() - recheck len of handlers on every iteration. [#1745](https://github.com/gin-gonic/gin/pull/1745)
+- [FIX] Fix all errcheck warnings [#1739](https://github.com/gin-gonic/gin/pull/1739) [#1653](https://github.com/gin-gonic/gin/pull/1653)
+- [NEW] context: inherits context cancellation and deadline from http.Request context for Go>=1.7 [#1690](https://github.com/gin-gonic/gin/pull/1690)
+- [NEW] Binding for URL Params [#1694](https://github.com/gin-gonic/gin/pull/1694)
+- [NEW] Add LoggerWithFormatter method [#1677](https://github.com/gin-gonic/gin/pull/1677)
+- [FIX] CI testing updates [#1671](https://github.com/gin-gonic/gin/pull/1671) [#1670](https://github.com/gin-gonic/gin/pull/1670) [#1682](https://github.com/gin-gonic/gin/pull/1682) [#1669](https://github.com/gin-gonic/gin/pull/1669)
+- [FIX] StaticFS(): Send 404 when path does not exist [#1663](https://github.com/gin-gonic/gin/pull/1663)
+- [FIX] Handle nil body for JSON binding [#1638](https://github.com/gin-gonic/gin/pull/1638)
+- [FIX] Support bind uri param [#1612](https://github.com/gin-gonic/gin/pull/1612)
+- [FIX] recovery: fix issue with syscall import on google app engine [#1640](https://github.com/gin-gonic/gin/pull/1640)
+- [FIX] Make sure the debug log contains line breaks [#1650](https://github.com/gin-gonic/gin/pull/1650)
+- [FIX] Panic stack trace being printed during recovery of broken pipe [#1089](https://github.com/gin-gonic/gin/pull/1089) [#1259](https://github.com/gin-gonic/gin/pull/1259)
+- [NEW] RunFd method to run http.Server through a file descriptor [#1609](https://github.com/gin-gonic/gin/pull/1609)
+- [NEW] Yaml binding support [#1618](https://github.com/gin-gonic/gin/pull/1618)
+- [FIX] Pass MaxMultipartMemory when FormFile is called [#1600](https://github.com/gin-gonic/gin/pull/1600)
+- [FIX] LoadHTML* tests [#1559](https://github.com/gin-gonic/gin/pull/1559)
+- [FIX] Removed use of sync.pool from HandleContext [#1565](https://github.com/gin-gonic/gin/pull/1565)
+- [FIX] Format output log to os.Stderr [#1571](https://github.com/gin-gonic/gin/pull/1571)
+- [FIX] Make logger use a yellow background and a darkgray text for legibility [#1570](https://github.com/gin-gonic/gin/pull/1570)
+- [FIX] Remove sensitive request information from panic log. [#1370](https://github.com/gin-gonic/gin/pull/1370)
+- [FIX] log.Println() does not print timestamp [#829](https://github.com/gin-gonic/gin/pull/829) [#1560](https://github.com/gin-gonic/gin/pull/1560)
+- [NEW] Add PureJSON renderer [#694](https://github.com/gin-gonic/gin/pull/694)
+- [FIX] Add missing copyright and update if/else [#1497](https://github.com/gin-gonic/gin/pull/1497)
+- [FIX] Update msgpack usage [#1498](https://github.com/gin-gonic/gin/pull/1498)
+- [FIX] Use protobuf on render [#1496](https://github.com/gin-gonic/gin/pull/1496)
+- [FIX] Add support for Protobuf format response [#1479](https://github.com/gin-gonic/gin/pull/1479)
+- [NEW] Set default time format in form binding [#1487](https://github.com/gin-gonic/gin/pull/1487)
+- [FIX] Add BindXML and ShouldBindXML [#1485](https://github.com/gin-gonic/gin/pull/1485)
+- [NEW] Upgrade dependency libraries [#1491](https://github.com/gin-gonic/gin/pull/1491)
+
### Gin 1.3.0
diff --git a/vendor/github.com/gin-gonic/gin/Makefile b/vendor/github.com/gin-gonic/gin/Makefile
index 51b9969f..51a6b916 100644
--- a/vendor/github.com/gin-gonic/gin/Makefile
+++ b/vendor/github.com/gin-gonic/gin/Makefile
@@ -1,7 +1,9 @@
+GO ?= go
GOFMT ?= gofmt "-s"
-PACKAGES ?= $(shell go list ./... | grep -v /vendor/)
-VETPACKAGES ?= $(shell go list ./... | grep -v /vendor/ | grep -v /examples/)
+PACKAGES ?= $(shell $(GO) list ./... | grep -v /vendor/)
+VETPACKAGES ?= $(shell $(GO) list ./... | grep -v /vendor/ | grep -v /examples/)
GOFILES := $(shell find . -name "*.go" -type f -not -path "./vendor/*")
+TESTFOLDER := $(shell $(GO) list ./... | grep -E 'gin$$|binding$$|render$$' | grep -v examples)
all: install
@@ -10,7 +12,25 @@ install: deps
.PHONY: test
test:
- sh coverage.sh
+ echo "mode: count" > coverage.out
+ for d in $(TESTFOLDER); do \
+ $(GO) test -v -covermode=count -coverprofile=profile.out $$d > tmp.out; \
+ cat tmp.out; \
+ if grep -q "^--- FAIL" tmp.out; then \
+ rm tmp.out; \
+ exit 1; \
+ elif grep -q "build failed" tmp.out; then \
+ rm tmp.out; \
+ exit 1; \
+ elif grep -q "setup failed" tmp.out; then \
+ rm tmp.out; \
+ exit 1; \
+ fi; \
+ if [ -f profile.out ]; then \
+ cat profile.out | grep -v "mode:" >> coverage.out; \
+ rm profile.out; \
+ fi; \
+ done
.PHONY: fmt
fmt:
@@ -18,7 +38,6 @@ fmt:
.PHONY: fmt-check
fmt-check:
- # get all go files and run go fmt on them
@diff=$$($(GOFMT) -d $(GOFILES)); \
if [ -n "$$diff" ]; then \
echo "Please run 'make fmt' and commit the result:"; \
@@ -27,36 +46,35 @@ fmt-check:
fi;
vet:
- go vet $(VETPACKAGES)
+ $(GO) vet $(VETPACKAGES)
deps:
@hash govendor > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
- go get -u github.com/kardianos/govendor; \
+ $(GO) get -u github.com/kardianos/govendor; \
fi
- @hash embedmd > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
- go get -u github.com/campoy/embedmd; \
- fi
-
-embedmd:
- embedmd -d *.md
.PHONY: lint
lint:
@hash golint > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
- go get -u github.com/golang/lint/golint; \
+ $(GO) get -u golang.org/x/lint/golint; \
fi
for PKG in $(PACKAGES); do golint -set_exit_status $$PKG || exit 1; done;
.PHONY: misspell-check
misspell-check:
@hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
- go get -u github.com/client9/misspell/cmd/misspell; \
+ $(GO) get -u github.com/client9/misspell/cmd/misspell; \
fi
misspell -error $(GOFILES)
.PHONY: misspell
misspell:
@hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
- go get -u github.com/client9/misspell/cmd/misspell; \
+ $(GO) get -u github.com/client9/misspell/cmd/misspell; \
fi
misspell -w $(GOFILES)
+
+.PHONY: tools
+tools:
+ go install golang.org/x/lint/golint; \
+ go install github.com/client9/misspell/cmd/misspell;
diff --git a/vendor/github.com/gin-gonic/gin/README.md b/vendor/github.com/gin-gonic/gin/README.md
index 28598baf..3e817a78 100644
--- a/vendor/github.com/gin-gonic/gin/README.md
+++ b/vendor/github.com/gin-gonic/gin/README.md
@@ -9,10 +9,10 @@
[](https://gitter.im/gin-gonic/gin?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[](https://sourcegraph.com/github.com/gin-gonic/gin?badge)
[](https://www.codetriage.com/gin-gonic/gin)
+[](https://github.com/gin-gonic/gin/releases)
Gin is a web framework written in Go (Golang). It features a martini-like API with much better performance, up to 40 times faster thanks to [httprouter](https://github.com/julienschmidt/httprouter). If you need performance and good productivity, you will love Gin.
-
## Contents
@@ -34,13 +34,15 @@ Gin is a web framework written in Go (Golang). It features a martini-like API wi
- [Blank Gin without middleware by default](#blank-gin-without-middleware-by-default)
- [Using middleware](#using-middleware)
- [How to write log file](#how-to-write-log-file)
+ - [Custom Log Format](#custom-log-format)
- [Model binding and validation](#model-binding-and-validation)
- [Custom Validators](#custom-validators)
- [Only Bind Query String](#only-bind-query-string)
- [Bind Query String or Post Data](#bind-query-string-or-post-data)
+ - [Bind Uri](#bind-uri)
- [Bind HTML checkboxes](#bind-html-checkboxes)
- [Multipart/Urlencoded binding](#multiparturlencoded-binding)
- - [XML, JSON and YAML rendering](#xml-json-and-yaml-rendering)
+ - [XML, JSON, YAML and ProtoBuf rendering](#xml-json-yaml-and-protobuf-rendering)
- [JSONP rendering](#jsonp)
- [Serving static files](#serving-static-files)
- [Serving data from reader](#serving-data-from-reader)
@@ -58,14 +60,16 @@ Gin is a web framework written in Go (Golang). It features a martini-like API wi
- [Bind form-data request with custom struct](#bind-form-data-request-with-custom-struct)
- [Try to bind body into different structs](#try-to-bind-body-into-different-structs)
- [http2 server push](#http2-server-push)
+ - [Define format for the log of routes](#define-format-for-the-log-of-routes)
+ - [Set and get a cookie](#set-and-get-a-cookie)
- [Testing](#testing)
-- [Users](#users--)
+- [Users](#users)
## Installation
To install Gin package, you need to install Go and set your Go workspace first.
-1. Download and install it:
+1. The first need [Go](https://golang.org/) installed (**version 1.8+ is required**), then you can use the below Go command to install Gin.
```sh
$ go get -u github.com/gin-gonic/gin
@@ -100,13 +104,13 @@ $ mkdir -p $GOPATH/src/github.com/myusername/project && cd "$_"
```sh
$ govendor init
-$ govendor fetch github.com/gin-gonic/gin@v1.2
+$ govendor fetch github.com/gin-gonic/gin@v1.3
```
4. Copy a starting template inside your project
```sh
-$ curl https://raw.githubusercontent.com/gin-gonic/gin/master/examples/basic/main.go > main.go
+$ curl https://raw.githubusercontent.com/gin-gonic/examples/master/basic/main.go > main.go
```
5. Run your project
@@ -198,7 +202,7 @@ BenchmarkVulcan_GithubAll | 5000 | 394253 | 19894
## Build with [jsoniter](https://github.com/json-iterator/go)
-Gin use `encoding/json` as default json package but you can change to [jsoniter](https://github.com/json-iterator/go) by build from other tags.
+Gin uses `encoding/json` as default json package but you can change to [jsoniter](https://github.com/json-iterator/go) by build from other tags.
```sh
$ go build -tags=jsoniter .
@@ -206,13 +210,12 @@ $ go build -tags=jsoniter .
## API Examples
+You can find a number of ready-to-run examples at [Gin examples repository](https://github.com/gin-gonic/examples).
+
### Using GET, POST, PUT, PATCH, DELETE and OPTIONS
```go
func main() {
- // Disable Console Color
- // gin.DisableConsoleColor()
-
// Creates a gin router with default middleware:
// logger and recovery (crash-free) middleware
router := gin.Default()
@@ -357,7 +360,11 @@ ids: map[b:hello a:1234], names: map[second:tianou first:thinkerou]
#### Single file
-References issue [#774](https://github.com/gin-gonic/gin/issues/774) and detail [example code](examples/upload-file/single).
+References issue [#774](https://github.com/gin-gonic/gin/issues/774) and detail [example code](https://github.com/gin-gonic/examples/tree/master/upload-file/single).
+
+`file.Filename` **SHOULD NOT** be trusted. See [`Content-Disposition` on MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition#Directives) and [#1693](https://github.com/gin-gonic/gin/issues/1693)
+
+> The filename is always optional and must not be used blindly by the application: path information should be stripped, and conversion to the server file system rules should be done.
```go
func main() {
@@ -388,7 +395,7 @@ curl -X POST http://localhost:8080/upload \
#### Multiple files
-See the detail [example code](examples/upload-file/multiple).
+See the detail [example code](https://github.com/gin-gonic/examples/tree/master/upload-file/multiple).
```go
func main() {
@@ -524,9 +531,88 @@ func main() {
}
```
+### Custom Log Format
+```go
+func main() {
+ router := gin.New()
+
+ // LoggerWithFormatter middleware will write the logs to gin.DefaultWriter
+ // By default gin.DefaultWriter = os.Stdout
+ router.Use(gin.LoggerWithFormatter(func(param gin.LogFormatterParams) string {
+
+ // your custom format
+ return fmt.Sprintf("%s - [%s] \"%s %s %s %d %s \"%s\" %s\"\n",
+ param.ClientIP,
+ param.TimeStamp.Format(time.RFC1123),
+ param.Method,
+ param.Path,
+ param.Request.Proto,
+ param.StatusCode,
+ param.Latency,
+ param.Request.UserAgent(),
+ param.ErrorMessage,
+ )
+ }))
+ router.Use(gin.Recovery())
+
+ router.GET("/ping", func(c *gin.Context) {
+ c.String(200, "pong")
+ })
+
+ router.Run(":8080")
+}
+```
+
+**Sample Output**
+```
+::1 - [Fri, 07 Dec 2018 17:04:38 JST] "GET /ping HTTP/1.1 200 122.767µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.80 Safari/537.36" "
+```
+
+### Controlling Log output coloring
+
+By default, logs output on console should be colorized depending on the detected TTY.
+
+Never colorize logs:
+
+```go
+func main() {
+ // Disable log's color
+ gin.DisableConsoleColor()
+
+ // Creates a gin router with default middleware:
+ // logger and recovery (crash-free) middleware
+ router := gin.Default()
+
+ router.GET("/ping", func(c *gin.Context) {
+ c.String(200, "pong")
+ })
+
+ router.Run(":8080")
+}
+```
+
+Always colorize logs:
+
+```go
+func main() {
+ // Force log's color
+ gin.ForceConsoleColor()
+
+ // Creates a gin router with default middleware:
+ // logger and recovery (crash-free) middleware
+ router := gin.Default()
+
+ router.GET("/ping", func(c *gin.Context) {
+ c.String(200, "pong")
+ })
+
+ router.Run(":8080")
+}
+```
+
### Model binding and validation
-To bind a request body into a type, use model binding. We currently support binding of JSON, XML and standard form values (foo=bar&boo=baz).
+To bind a request body into a type, use model binding. We currently support binding of JSON, XML, YAML and standard form values (foo=bar&boo=baz).
Gin uses [**go-playground/validator.v8**](https://github.com/go-playground/validator) for validation. Check the full docs on tags usage [here](http://godoc.org/gopkg.in/go-playground/validator.v8#hdr-Baked_In_Validators_and_Tags).
@@ -534,10 +620,10 @@ Note that you need to set the corresponding binding tag on all fields you want t
Also, Gin provides two sets of methods for binding:
- **Type** - Must bind
- - **Methods** - `Bind`, `BindJSON`, `BindQuery`
+ - **Methods** - `Bind`, `BindJSON`, `BindXML`, `BindQuery`, `BindYAML`
- **Behavior** - These methods use `MustBindWith` under the hood. If there is a binding error, the request is aborted with `c.AbortWithError(400, err).SetType(ErrorTypeBind)`. This sets the response status code to 400 and the `Content-Type` header is set to `text/plain; charset=utf-8`. Note that if you try to set the response code after this, it will result in a warning `[GIN-debug] [WARNING] Headers were already written. Wanted to override status code 400 with 422`. If you wish to have greater control over the behavior, consider using the `ShouldBind` equivalent method.
- **Type** - Should bind
- - **Methods** - `ShouldBind`, `ShouldBindJSON`, `ShouldBindQuery`
+ - **Methods** - `ShouldBind`, `ShouldBindJSON`, `ShouldBindXML`, `ShouldBindQuery`, `ShouldBindYAML`
- **Behavior** - These methods use `ShouldBindWith` under the hood. If there is a binding error, the error is returned and it is the developer's responsibility to handle the request and error appropriately.
When using the Bind-method, Gin tries to infer the binder depending on the Content-Type header. If you are sure what you are binding, you can use `MustBindWith` or `ShouldBindWith`.
@@ -547,8 +633,8 @@ You can also specify that specific fields are required. If a field is decorated
```go
// Binding from JSON
type Login struct {
- User string `form:"user" json:"user" binding:"required"`
- Password string `form:"password" json:"password" binding:"required"`
+ User string `form:"user" json:"user" xml:"user" binding:"required"`
+ Password string `form:"password" json:"password" xml:"password" binding:"required"`
}
func main() {
@@ -557,30 +643,55 @@ func main() {
// Example for binding JSON ({"user": "manu", "password": "123"})
router.POST("/loginJSON", func(c *gin.Context) {
var json Login
- if err := c.ShouldBindJSON(&json); err == nil {
- if json.User == "manu" && json.Password == "123" {
- c.JSON(http.StatusOK, gin.H{"status": "you are logged in"})
- } else {
- c.JSON(http.StatusUnauthorized, gin.H{"status": "unauthorized"})
- }
- } else {
+ if err := c.ShouldBindJSON(&json); err != nil {
+ c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
+ return
+ }
+
+ if json.User != "manu" || json.Password != "123" {
+ c.JSON(http.StatusUnauthorized, gin.H{"status": "unauthorized"})
+ return
+ }
+
+ c.JSON(http.StatusOK, gin.H{"status": "you are logged in"})
+ })
+
+ // Example for binding XML (
+ //
+ //
+ // user
+ // 123
+ // )
+ router.POST("/loginXML", func(c *gin.Context) {
+ var xml Login
+ if err := c.ShouldBindXML(&xml); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
+ return
}
+
+ if xml.User != "manu" || xml.Password != "123" {
+ c.JSON(http.StatusUnauthorized, gin.H{"status": "unauthorized"})
+ return
+ }
+
+ c.JSON(http.StatusOK, gin.H{"status": "you are logged in"})
})
// Example for binding a HTML form (user=manu&password=123)
router.POST("/loginForm", func(c *gin.Context) {
var form Login
// This will infer what binder to use depending on the content-type header.
- if err := c.ShouldBind(&form); err == nil {
- if form.User == "manu" && form.Password == "123" {
- c.JSON(http.StatusOK, gin.H{"status": "you are logged in"})
- } else {
- c.JSON(http.StatusUnauthorized, gin.H{"status": "unauthorized"})
- }
- } else {
+ if err := c.ShouldBind(&form); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
+ return
}
+
+ if form.User != "manu" || form.Password != "123" {
+ c.JSON(http.StatusUnauthorized, gin.H{"status": "unauthorized"})
+ return
+ }
+
+ c.JSON(http.StatusOK, gin.H{"status": "you are logged in"})
})
// Listen and serve on 0.0.0.0:8080
@@ -616,9 +727,8 @@ When running the above example using the above the `curl` command, it returns er
### Custom Validators
-It is also possible to register custom validators. See the [example code](examples/custom-validation/server.go).
+It is also possible to register custom validators. See the [example code](https://github.com/gin-gonic/examples/tree/master/custom-validation/server.go).
-[embedmd]:# (examples/custom-validation/server.go go)
```go
package main
@@ -632,6 +742,7 @@ import (
"gopkg.in/go-playground/validator.v8"
)
+// Booking contains binded and validated data.
type Booking struct {
CheckIn time.Time `form:"check_in" binding:"required,bookabledate" time_format:"2006-01-02"`
CheckOut time.Time `form:"check_out" binding:"required,gtfield=CheckIn" time_format:"2006-01-02"`
@@ -679,8 +790,8 @@ $ curl "localhost:8085/bookable?check_in=2018-03-08&check_out=2018-03-09"
{"error":"Key: 'Booking.CheckIn' Error:Field validation for 'CheckIn' failed on the 'bookabledate' tag"}
```
-[Struct level validations](https://github.com/go-playground/validator/releases/tag/v8.7) can also be registed this way.
-See the [struct-lvl-validation example](examples/struct-lvl-validations) to learn more.
+[Struct level validations](https://github.com/go-playground/validator/releases/tag/v8.7) can also be registered this way.
+See the [struct-lvl-validation example](https://github.com/gin-gonic/examples/tree/master/struct-lvl-validations) to learn more.
### Only Bind Query String
@@ -725,9 +836,12 @@ See the [detail information](https://github.com/gin-gonic/gin/issues/742#issueco
```go
package main
-import "log"
-import "github.com/gin-gonic/gin"
-import "time"
+import (
+ "log"
+ "time"
+
+ "github.com/gin-gonic/gin"
+)
type Person struct {
Name string `form:"name"`
@@ -761,6 +875,40 @@ Test it with:
$ curl -X GET "localhost:8085/testing?name=appleboy&address=xyz&birthday=1992-03-15"
```
+### Bind Uri
+
+See the [detail information](https://github.com/gin-gonic/gin/issues/846).
+
+```go
+package main
+
+import "github.com/gin-gonic/gin"
+
+type Person struct {
+ ID string `uri:"id" binding:"required,uuid"`
+ Name string `uri:"name" binding:"required"`
+}
+
+func main() {
+ route := gin.Default()
+ route.GET("/:name/:id", func(c *gin.Context) {
+ var person Person
+ if err := c.ShouldBindUri(&person); err != nil {
+ c.JSON(400, gin.H{"msg": err})
+ return
+ }
+ c.JSON(200, gin.H{"name": person.Name, "uuid": person.ID})
+ })
+ route.Run(":8088")
+}
+```
+
+Test it with:
+```sh
+$ curl -v localhost:8088/thinkerou/987fbc97-4bed-5078-9f07-9141ba07c9f3
+$ curl -v localhost:8088/thinkerou/not-uuid
+```
+
### Bind HTML checkboxes
See the [detail information](https://github.com/gin-gonic/gin/issues/129#issuecomment-124260092)
@@ -792,12 +940,12 @@ form.html
```
@@ -846,7 +994,7 @@ Test it with:
$ curl -v --form user=user --form password=password http://localhost:8080/login
```
-### XML, JSON and YAML rendering
+### XML, JSON, YAML and ProtoBuf rendering
```go
func main() {
@@ -880,6 +1028,19 @@ func main() {
c.YAML(http.StatusOK, gin.H{"message": "hey", "status": http.StatusOK})
})
+ r.GET("/someProtoBuf", func(c *gin.Context) {
+ reps := []int64{int64(1), int64(2)}
+ label := "test"
+ // The specific definition of protobuf is written in the testdata/protoexample file.
+ data := &protoexample.Test{
+ Label: &label,
+ Reps: reps,
+ }
+ // Note that data becomes binary data in the response
+ // Will output protoexample.Test protobuf serialized data
+ c.ProtoBuf(http.StatusOK, data)
+ })
+
// Listen and serve on 0.0.0.0:8080
r.Run(":8080")
}
@@ -953,6 +1114,34 @@ func main() {
}
```
+#### PureJSON
+
+Normally, JSON replaces special HTML characters with their unicode entities, e.g. `<` becomes `\u003c`. If you want to encode such characters literally, you can use PureJSON instead.
+This feature is unavailable in Go 1.6 and lower.
+
+```go
+func main() {
+ r := gin.Default()
+
+ // Serves unicode entities
+ r.GET("/json", func(c *gin.Context) {
+ c.JSON(200, gin.H{
+ "html": "Hello, world!",
+ })
+ })
+
+ // Serves literal characters
+ r.GET("/purejson", func(c *gin.Context) {
+ c.PureJSON(200, gin.H{
+ "html": "Hello, world!",
+ })
+ })
+
+ // listen and serve on 0.0.0.0:8080
+ r.Run(":8080")
+}
+```
+
### Serving static files
```go
@@ -1087,12 +1276,12 @@ You may use custom delims
```go
r := gin.Default()
r.Delims("{[{", "}]}")
- r.LoadHTMLGlob("/path/to/templates"))
+ r.LoadHTMLGlob("/path/to/templates")
```
#### Custom Template Funcs
-See the detail [example code](examples/template).
+See the detail [example code](https://github.com/gin-gonic/examples/tree/master/template).
main.go
@@ -1312,7 +1501,6 @@ func main() {
example for 1-line LetsEncrypt HTTPS servers.
-[embedmd]:# (examples/auto-tls/example1/main.go go)
```go
package main
@@ -1337,7 +1525,6 @@ func main() {
example for custom autocert manager.
-[embedmd]:# (examples/auto-tls/example2/main.go go)
```go
package main
@@ -1371,7 +1558,6 @@ func main() {
See the [question](https://github.com/gin-gonic/gin/issues/346) and try the following example:
-[embedmd]:# (examples/multiple-service/main.go go)
```go
package main
@@ -1469,9 +1655,8 @@ An alternative to endless:
* [graceful](https://github.com/tylerb/graceful): Graceful is a Go package enabling graceful shutdown of an http.Handler server.
* [grace](https://github.com/facebookgo/grace): Graceful restart & zero downtime deploy for Go servers.
-If you are using Go 1.8, you may not need to use this library! Consider using http.Server's built-in [Shutdown()](https://golang.org/pkg/net/http/#Server.Shutdown) method for graceful shutdowns. See the full [graceful-shutdown](./examples/graceful-shutdown) example with gin.
+If you are using Go 1.8, you may not need to use this library! Consider using http.Server's built-in [Shutdown()](https://golang.org/pkg/net/http/#Server.Shutdown) method for graceful shutdowns. See the full [graceful-shutdown](https://github.com/gin-gonic/examples/tree/master/graceful-shutdown) example with gin.
-[embedmd]:# (examples/graceful-shutdown/graceful-shutdown/server.go go)
```go
// +build go1.8
@@ -1483,6 +1668,7 @@ import (
"net/http"
"os"
"os/signal"
+ "syscall"
"time"
"github.com/gin-gonic/gin"
@@ -1510,7 +1696,10 @@ func main() {
// Wait for interrupt signal to gracefully shutdown the server with
// a timeout of 5 seconds.
quit := make(chan os.Signal)
- signal.Notify(quit, os.Interrupt)
+ // kill (no param) default send syscall.SIGTERM
+ // kill -2 is syscall.SIGINT
+ // kill -9 is syscall.SIGKILL but can"t be catch, so don't need add it
+ signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)
<-quit
log.Println("Shutdown Server ...")
@@ -1519,6 +1708,11 @@ func main() {
if err := srv.Shutdown(ctx); err != nil {
log.Fatal("Server Shutdown:", err)
}
+ // catching ctx.Done(). timeout of 5 seconds.
+ select {
+ case <-ctx.Done():
+ log.Println("timeout of 5 seconds.")
+ }
log.Println("Server exiting")
}
```
@@ -1565,7 +1759,7 @@ func loadTemplate() (*template.Template, error) {
}
```
-See a complete example in the `examples/assets-in-binary` directory.
+See a complete example in the `https://github.com/gin-gonic/examples/tree/master/assets-in-binary` directory.
### Bind form-data request with custom struct
@@ -1641,24 +1835,6 @@ $ curl "http://localhost:8080/getd?field_x=hello&field_d=world"
{"d":"world","x":{"FieldX":"hello"}}
```
-**NOTE**: NOT support the follow style struct:
-
-```go
-type StructX struct {
- X struct {} `form:"name_x"` // HERE have form
-}
-
-type StructY struct {
- Y StructX `form:"name_y"` // HERE hava form
-}
-
-type StructZ struct {
- Z *StructZ `form:"name_z"` // HERE hava form
-}
-```
-
-In a word, only support nested custom struct which have no `form` now.
-
### Try to bind body into different structs
The normal methods for binding request body consumes `c.Request.Body` and they
@@ -1721,7 +1897,6 @@ performance (See [#1341](https://github.com/gin-gonic/gin/pull/1341)).
http.Pusher is supported only **go1.8+**. See the [golang blog](https://blog.golang.org/h2push) for detail information.
-[embedmd]:# (examples/http-pusher/main.go go)
```go
package main
@@ -1766,6 +1941,78 @@ func main() {
}
```
+### Define format for the log of routes
+
+The default log of routes is:
+```
+[GIN-debug] POST /foo --> main.main.func1 (3 handlers)
+[GIN-debug] GET /bar --> main.main.func2 (3 handlers)
+[GIN-debug] GET /status --> main.main.func3 (3 handlers)
+```
+
+If you want to log this information in given format (e.g. JSON, key values or something else), then you can define this format with `gin.DebugPrintRouteFunc`.
+In the example below, we log all routes with standard log package but you can use another log tools that suits of your needs.
+```go
+import (
+ "log"
+ "net/http"
+
+ "github.com/gin-gonic/gin"
+)
+
+func main() {
+ r := gin.Default()
+ gin.DebugPrintRouteFunc = func(httpMethod, absolutePath, handlerName string, nuHandlers int) {
+ log.Printf("endpoint %v %v %v %v\n", httpMethod, absolutePath, handlerName, nuHandlers)
+ }
+
+ r.POST("/foo", func(c *gin.Context) {
+ c.JSON(http.StatusOK, "foo")
+ })
+
+ r.GET("/bar", func(c *gin.Context) {
+ c.JSON(http.StatusOK, "bar")
+ })
+
+ r.GET("/status", func(c *gin.Context) {
+ c.JSON(http.StatusOK, "ok")
+ })
+
+ // Listen and Server in http://0.0.0.0:8080
+ r.Run()
+}
+```
+
+### Set and get a cookie
+
+```go
+import (
+ "fmt"
+
+ "github.com/gin-gonic/gin"
+)
+
+func main() {
+
+ router := gin.Default()
+
+ router.GET("/cookie", func(c *gin.Context) {
+
+ cookie, err := c.Cookie("gin_cookie")
+
+ if err != nil {
+ cookie = "NotSet"
+ c.SetCookie("gin_cookie", "test", 3600, "/", "localhost", false, true)
+ }
+
+ fmt.Printf("Cookie value: %s \n", cookie)
+ })
+
+ router.Run()
+}
+```
+
+
## Testing
The `net/http/httptest` package is preferable way for HTTP testing.
@@ -1816,5 +2063,8 @@ func TestPingRoute(t *testing.T) {
Awesome project lists using [Gin](https://github.com/gin-gonic/gin) web framework.
-* [drone](https://github.com/drone/drone): Drone is a Continuous Delivery platform built on Docker, written in Go
* [gorush](https://github.com/appleboy/gorush): A push notification server written in Go.
+* [fnproject](https://github.com/fnproject/fn): The container native, cloud agnostic serverless platform.
+* [photoprism](https://github.com/photoprism/photoprism): Personal photo management powered by Go and Google TensorFlow.
+* [krakend](https://github.com/devopsfaith/krakend): Ultra performant API Gateway with middlewares.
+* [picfit](https://github.com/thoas/picfit): An image resizing server written in Go.
diff --git a/vendor/github.com/gin-gonic/gin/binding/binding.go b/vendor/github.com/gin-gonic/gin/binding/binding.go
index 3a2aad9c..520c5109 100644
--- a/vendor/github.com/gin-gonic/gin/binding/binding.go
+++ b/vendor/github.com/gin-gonic/gin/binding/binding.go
@@ -18,6 +18,7 @@ const (
MIMEPROTOBUF = "application/x-protobuf"
MIMEMSGPACK = "application/x-msgpack"
MIMEMSGPACK2 = "application/msgpack"
+ MIMEYAML = "application/x-yaml"
)
// Binding describes the interface which needs to be implemented for binding the
@@ -35,9 +36,16 @@ type BindingBody interface {
BindBody([]byte, interface{}) error
}
+// BindingUri adds BindUri method to Binding. BindUri is similar with Bind,
+// but it read the Params.
+type BindingUri interface {
+ Name() string
+ BindUri(map[string][]string, interface{}) error
+}
+
// StructValidator is the minimal interface which needs to be implemented in
// order for it to be used as the validator engine for ensuring the correctness
-// of the reqest. Gin provides a default implementation for this using
+// of the request. Gin provides a default implementation for this using
// https://github.com/go-playground/validator/tree/v8.18.2.
type StructValidator interface {
// ValidateStruct can receive any kind of type and it should never panic, even if the configuration is not right.
@@ -68,6 +76,8 @@ var (
FormMultipart = formMultipartBinding{}
ProtoBuf = protobufBinding{}
MsgPack = msgpackBinding{}
+ YAML = yamlBinding{}
+ Uri = uriBinding{}
)
// Default returns the appropriate Binding instance based on the HTTP method
@@ -86,7 +96,11 @@ func Default(method, contentType string) Binding {
return ProtoBuf
case MIMEMSGPACK, MIMEMSGPACK2:
return MsgPack
- default: //case MIMEPOSTForm, MIMEMultipartPOSTForm:
+ case MIMEYAML:
+ return YAML
+ case MIMEMultipartPOSTForm:
+ return FormMultipart
+ default: // case MIMEPOSTForm:
return Form
}
}
diff --git a/vendor/github.com/gin-gonic/gin/binding/form.go b/vendor/github.com/gin-gonic/gin/binding/form.go
index 0be59660..0b28aa8a 100644
--- a/vendor/github.com/gin-gonic/gin/binding/form.go
+++ b/vendor/github.com/gin-gonic/gin/binding/form.go
@@ -4,7 +4,11 @@
package binding
-import "net/http"
+import (
+ "mime/multipart"
+ "net/http"
+ "reflect"
+)
const defaultMemory = 32 * 1024 * 1024
@@ -20,7 +24,11 @@ func (formBinding) Bind(req *http.Request, obj interface{}) error {
if err := req.ParseForm(); err != nil {
return err
}
- req.ParseMultipartForm(defaultMemory)
+ if err := req.ParseMultipartForm(defaultMemory); err != nil {
+ if err != http.ErrNotMultipart {
+ return err
+ }
+ }
if err := mapForm(obj, req.Form); err != nil {
return err
}
@@ -49,8 +57,33 @@ func (formMultipartBinding) Bind(req *http.Request, obj interface{}) error {
if err := req.ParseMultipartForm(defaultMemory); err != nil {
return err
}
- if err := mapForm(obj, req.MultipartForm.Value); err != nil {
+ if err := mappingByPtr(obj, (*multipartRequest)(req), "form"); err != nil {
return err
}
+
return validate(obj)
}
+
+type multipartRequest http.Request
+
+var _ setter = (*multipartRequest)(nil)
+
+var (
+ multipartFileHeaderStructType = reflect.TypeOf(multipart.FileHeader{})
+)
+
+// TrySet tries to set a value by the multipart request with the binding a form file
+func (r *multipartRequest) TrySet(value reflect.Value, field reflect.StructField, key string, opt setOptions) (isSetted bool, err error) {
+ if value.Type() == multipartFileHeaderStructType {
+ _, file, err := (*http.Request)(r).FormFile(key)
+ if err != nil {
+ return false, err
+ }
+ if file != nil {
+ value.Set(reflect.ValueOf(*file))
+ return true, nil
+ }
+ }
+
+ return setByForm(value, field, r.MultipartForm.Value, key, opt)
+}
diff --git a/vendor/github.com/gin-gonic/gin/binding/form_mapping.go b/vendor/github.com/gin-gonic/gin/binding/form_mapping.go
index 3f6b9bfa..aaacf6c5 100644
--- a/vendor/github.com/gin-gonic/gin/binding/form_mapping.go
+++ b/vendor/github.com/gin-gonic/gin/binding/form_mapping.go
@@ -6,127 +6,211 @@ package binding
import (
"errors"
+ "fmt"
"reflect"
"strconv"
"strings"
"time"
+
+ "github.com/gin-gonic/gin/internal/json"
)
+var errUnknownType = errors.New("Unknown type")
+
+func mapUri(ptr interface{}, m map[string][]string) error {
+ return mapFormByTag(ptr, m, "uri")
+}
+
func mapForm(ptr interface{}, form map[string][]string) error {
- typ := reflect.TypeOf(ptr).Elem()
- val := reflect.ValueOf(ptr).Elem()
- for i := 0; i < typ.NumField(); i++ {
- typeField := typ.Field(i)
- structField := val.Field(i)
- if !structField.CanSet() {
- continue
- }
+ return mapFormByTag(ptr, form, "form")
+}
- structFieldKind := structField.Kind()
- inputFieldName := typeField.Tag.Get("form")
- inputFieldNameList := strings.Split(inputFieldName, ",")
- inputFieldName = inputFieldNameList[0]
- var defaultValue string
- if len(inputFieldNameList) > 1 {
- defaultList := strings.SplitN(inputFieldNameList[1], "=", 2)
- if defaultList[0] == "default" {
- defaultValue = defaultList[1]
- }
+var emptyField = reflect.StructField{}
+
+func mapFormByTag(ptr interface{}, form map[string][]string, tag string) error {
+ return mappingByPtr(ptr, formSource(form), tag)
+}
+
+// setter tries to set value on a walking by fields of a struct
+type setter interface {
+ TrySet(value reflect.Value, field reflect.StructField, key string, opt setOptions) (isSetted bool, err error)
+}
+
+type formSource map[string][]string
+
+var _ setter = formSource(nil)
+
+// TrySet tries to set a value by request's form source (like map[string][]string)
+func (form formSource) TrySet(value reflect.Value, field reflect.StructField, tagValue string, opt setOptions) (isSetted bool, err error) {
+ return setByForm(value, field, form, tagValue, opt)
+}
+
+func mappingByPtr(ptr interface{}, setter setter, tag string) error {
+ _, err := mapping(reflect.ValueOf(ptr), emptyField, setter, tag)
+ return err
+}
+
+func mapping(value reflect.Value, field reflect.StructField, setter setter, tag string) (bool, error) {
+ var vKind = value.Kind()
+
+ if vKind == reflect.Ptr {
+ var isNew bool
+ vPtr := value
+ if value.IsNil() {
+ isNew = true
+ vPtr = reflect.New(value.Type().Elem())
}
- if inputFieldName == "" {
- inputFieldName = typeField.Name
-
- // if "form" tag is nil, we inspect if the field is a struct or struct pointer.
- // this would not make sense for JSON parsing but it does for a form
- // since data is flatten
- if structFieldKind == reflect.Ptr {
- if !structField.Elem().IsValid() {
- structField.Set(reflect.New(structField.Type().Elem()))
- }
- structField = structField.Elem()
- structFieldKind = structField.Kind()
- }
- if structFieldKind == reflect.Struct {
- err := mapForm(structField.Addr().Interface(), form)
- if err != nil {
- return err
- }
- continue
- }
+ isSetted, err := mapping(vPtr.Elem(), field, setter, tag)
+ if err != nil {
+ return false, err
}
- inputValue, exists := form[inputFieldName]
-
- if !exists {
- if defaultValue == "" {
- continue
- }
- inputValue = make([]string, 1)
- inputValue[0] = defaultValue
+ if isNew && isSetted {
+ value.Set(vPtr)
}
+ return isSetted, nil
+ }
- numElems := len(inputValue)
- if structFieldKind == reflect.Slice && numElems > 0 {
- sliceOf := structField.Type().Elem().Kind()
- slice := reflect.MakeSlice(structField.Type(), numElems, numElems)
- for i := 0; i < numElems; i++ {
- if err := setWithProperType(sliceOf, inputValue[i], slice.Index(i)); err != nil {
- return err
- }
- }
- val.Field(i).Set(slice)
- } else {
- if _, isTime := structField.Interface().(time.Time); isTime {
- if err := setTimeField(inputValue[0], typeField, structField); err != nil {
- return err
- }
+ ok, err := tryToSetValue(value, field, setter, tag)
+ if err != nil {
+ return false, err
+ }
+ if ok {
+ return true, nil
+ }
+
+ if vKind == reflect.Struct {
+ tValue := value.Type()
+
+ var isSetted bool
+ for i := 0; i < value.NumField(); i++ {
+ if !value.Field(i).CanSet() {
continue
}
- if err := setWithProperType(typeField.Type.Kind(), inputValue[0], structField); err != nil {
- return err
+ ok, err := mapping(value.Field(i), tValue.Field(i), setter, tag)
+ if err != nil {
+ return false, err
}
+ isSetted = isSetted || ok
}
+ return isSetted, nil
}
- return nil
+ return false, nil
+}
+
+type setOptions struct {
+ isDefaultExists bool
+ defaultValue string
+}
+
+func tryToSetValue(value reflect.Value, field reflect.StructField, setter setter, tag string) (bool, error) {
+ var tagValue string
+ var setOpt setOptions
+
+ tagValue = field.Tag.Get(tag)
+ tagValue, opts := head(tagValue, ",")
+
+ if tagValue == "-" { // just ignoring this field
+ return false, nil
+ }
+ if tagValue == "" { // default value is FieldName
+ tagValue = field.Name
+ }
+ if tagValue == "" { // when field is "emptyField" variable
+ return false, nil
+ }
+
+ var opt string
+ for len(opts) > 0 {
+ opt, opts = head(opts, ",")
+
+ k, v := head(opt, "=")
+ switch k {
+ case "default":
+ setOpt.isDefaultExists = true
+ setOpt.defaultValue = v
+ }
+ }
+
+ return setter.TrySet(value, field, tagValue, setOpt)
}
-func setWithProperType(valueKind reflect.Kind, val string, structField reflect.Value) error {
- switch valueKind {
+func setByForm(value reflect.Value, field reflect.StructField, form map[string][]string, tagValue string, opt setOptions) (isSetted bool, err error) {
+ vs, ok := form[tagValue]
+ if !ok && !opt.isDefaultExists {
+ return false, nil
+ }
+
+ switch value.Kind() {
+ case reflect.Slice:
+ if !ok {
+ vs = []string{opt.defaultValue}
+ }
+ return true, setSlice(vs, value, field)
+ case reflect.Array:
+ if !ok {
+ vs = []string{opt.defaultValue}
+ }
+ if len(vs) != value.Len() {
+ return false, fmt.Errorf("%q is not valid value for %s", vs, value.Type().String())
+ }
+ return true, setArray(vs, value, field)
+ default:
+ var val string
+ if !ok {
+ val = opt.defaultValue
+ }
+
+ if len(vs) > 0 {
+ val = vs[0]
+ }
+ return true, setWithProperType(val, value, field)
+ }
+}
+
+func setWithProperType(val string, value reflect.Value, field reflect.StructField) error {
+ switch value.Kind() {
case reflect.Int:
- return setIntField(val, 0, structField)
+ return setIntField(val, 0, value)
case reflect.Int8:
- return setIntField(val, 8, structField)
+ return setIntField(val, 8, value)
case reflect.Int16:
- return setIntField(val, 16, structField)
+ return setIntField(val, 16, value)
case reflect.Int32:
- return setIntField(val, 32, structField)
+ return setIntField(val, 32, value)
case reflect.Int64:
- return setIntField(val, 64, structField)
+ switch value.Interface().(type) {
+ case time.Duration:
+ return setTimeDuration(val, value, field)
+ }
+ return setIntField(val, 64, value)
case reflect.Uint:
- return setUintField(val, 0, structField)
+ return setUintField(val, 0, value)
case reflect.Uint8:
- return setUintField(val, 8, structField)
+ return setUintField(val, 8, value)
case reflect.Uint16:
- return setUintField(val, 16, structField)
+ return setUintField(val, 16, value)
case reflect.Uint32:
- return setUintField(val, 32, structField)
+ return setUintField(val, 32, value)
case reflect.Uint64:
- return setUintField(val, 64, structField)
+ return setUintField(val, 64, value)
case reflect.Bool:
- return setBoolField(val, structField)
+ return setBoolField(val, value)
case reflect.Float32:
- return setFloatField(val, 32, structField)
+ return setFloatField(val, 32, value)
case reflect.Float64:
- return setFloatField(val, 64, structField)
+ return setFloatField(val, 64, value)
case reflect.String:
- structField.SetString(val)
- case reflect.Ptr:
- if !structField.Elem().IsValid() {
- structField.Set(reflect.New(structField.Type().Elem()))
+ value.SetString(val)
+ case reflect.Struct:
+ switch value.Interface().(type) {
+ case time.Time:
+ return setTimeField(val, field, value)
}
- structFieldElem := structField.Elem()
- return setWithProperType(structFieldElem.Kind(), val, structFieldElem)
+ return json.Unmarshal([]byte(val), value.Addr().Interface())
+ case reflect.Map:
+ return json.Unmarshal([]byte(val), value.Addr().Interface())
default:
- return errors.New("Unknown type")
+ return errUnknownType
}
return nil
}
@@ -178,7 +262,7 @@ func setFloatField(val string, bitSize int, field reflect.Value) error {
func setTimeField(val string, structField reflect.StructField, value reflect.Value) error {
timeFormat := structField.Tag.Get("time_format")
if timeFormat == "" {
- return errors.New("Blank time format")
+ timeFormat = time.RFC3339
}
if val == "" {
@@ -207,3 +291,40 @@ func setTimeField(val string, structField reflect.StructField, value reflect.Val
value.Set(reflect.ValueOf(t))
return nil
}
+
+func setArray(vals []string, value reflect.Value, field reflect.StructField) error {
+ for i, s := range vals {
+ err := setWithProperType(s, value.Index(i), field)
+ if err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
+func setSlice(vals []string, value reflect.Value, field reflect.StructField) error {
+ slice := reflect.MakeSlice(value.Type(), len(vals), len(vals))
+ err := setArray(vals, slice, field)
+ if err != nil {
+ return err
+ }
+ value.Set(slice)
+ return nil
+}
+
+func setTimeDuration(val string, value reflect.Value, field reflect.StructField) error {
+ d, err := time.ParseDuration(val)
+ if err != nil {
+ return err
+ }
+ value.Set(reflect.ValueOf(d))
+ return nil
+}
+
+func head(str, sep string) (head string, tail string) {
+ idx := strings.Index(str, sep)
+ if idx < 0 {
+ return str, ""
+ }
+ return str[:idx], str[idx+len(sep):]
+}
diff --git a/vendor/github.com/gin-gonic/gin/binding/json.go b/vendor/github.com/gin-gonic/gin/binding/json.go
index fea17bb2..f968161b 100644
--- a/vendor/github.com/gin-gonic/gin/binding/json.go
+++ b/vendor/github.com/gin-gonic/gin/binding/json.go
@@ -6,10 +6,11 @@ package binding
import (
"bytes"
+ "fmt"
"io"
"net/http"
- "github.com/gin-gonic/gin/json"
+ "github.com/gin-gonic/gin/internal/json"
)
// EnableDecoderUseNumber is used to call the UseNumber method on the JSON
@@ -24,6 +25,9 @@ func (jsonBinding) Name() string {
}
func (jsonBinding) Bind(req *http.Request, obj interface{}) error {
+ if req == nil || req.Body == nil {
+ return fmt.Errorf("invalid request")
+ }
return decodeJSON(req.Body, obj)
}
diff --git a/vendor/github.com/gin-gonic/gin/binding/protobuf.go b/vendor/github.com/gin-gonic/gin/binding/protobuf.go
index 540e9c1f..f9ece928 100644
--- a/vendor/github.com/gin-gonic/gin/binding/protobuf.go
+++ b/vendor/github.com/gin-gonic/gin/binding/protobuf.go
@@ -29,7 +29,7 @@ func (protobufBinding) BindBody(body []byte, obj interface{}) error {
if err := proto.Unmarshal(body, obj.(proto.Message)); err != nil {
return err
}
- // Here it's same to return validate(obj), but util now we cann't add
+ // Here it's same to return validate(obj), but util now we can't add
// `binding:""` to the struct which automatically generate by gen-proto
return nil
// return validate(obj)
diff --git a/vendor/github.com/gin-gonic/gin/binding/uri.go b/vendor/github.com/gin-gonic/gin/binding/uri.go
new file mode 100644
index 00000000..f91ec381
--- /dev/null
+++ b/vendor/github.com/gin-gonic/gin/binding/uri.go
@@ -0,0 +1,18 @@
+// Copyright 2018 Gin Core Team. All rights reserved.
+// Use of this source code is governed by a MIT style
+// license that can be found in the LICENSE file.
+
+package binding
+
+type uriBinding struct{}
+
+func (uriBinding) Name() string {
+ return "uri"
+}
+
+func (uriBinding) BindUri(m map[string][]string, obj interface{}) error {
+ if err := mapUri(obj, m); err != nil {
+ return err
+ }
+ return validate(obj)
+}
diff --git a/vendor/github.com/gin-gonic/gin/binding/yaml.go b/vendor/github.com/gin-gonic/gin/binding/yaml.go
new file mode 100644
index 00000000..a2d36d6a
--- /dev/null
+++ b/vendor/github.com/gin-gonic/gin/binding/yaml.go
@@ -0,0 +1,35 @@
+// Copyright 2018 Gin Core Team. All rights reserved.
+// Use of this source code is governed by a MIT style
+// license that can be found in the LICENSE file.
+
+package binding
+
+import (
+ "bytes"
+ "io"
+ "net/http"
+
+ "gopkg.in/yaml.v2"
+)
+
+type yamlBinding struct{}
+
+func (yamlBinding) Name() string {
+ return "yaml"
+}
+
+func (yamlBinding) Bind(req *http.Request, obj interface{}) error {
+ return decodeYAML(req.Body, obj)
+}
+
+func (yamlBinding) BindBody(body []byte, obj interface{}) error {
+ return decodeYAML(bytes.NewReader(body), obj)
+}
+
+func decodeYAML(r io.Reader, obj interface{}) error {
+ decoder := yaml.NewDecoder(r)
+ if err := decoder.Decode(obj); err != nil {
+ return err
+ }
+ return validate(obj)
+}
diff --git a/vendor/github.com/gin-gonic/gin/context.go b/vendor/github.com/gin-gonic/gin/context.go
index 724ded79..af747a1e 100644
--- a/vendor/github.com/gin-gonic/gin/context.go
+++ b/vendor/github.com/gin-gonic/gin/context.go
@@ -6,6 +6,7 @@ package gin
import (
"errors"
+ "fmt"
"io"
"io/ioutil"
"math"
@@ -31,6 +32,7 @@ const (
MIMEPlain = binding.MIMEPlain
MIMEPOSTForm = binding.MIMEPOSTForm
MIMEMultipartPOSTForm = binding.MIMEMultipartPOSTForm
+ MIMEYAML = binding.MIMEYAML
BodyBytesKey = "_gin-gonic/gin/bodybyteskey"
)
@@ -81,6 +83,10 @@ func (c *Context) Copy() *Context {
cp.Writer = &cp.writermem
cp.index = abortIndex
cp.handlers = nil
+ cp.Keys = map[string]interface{}{}
+ for k, v := range c.Keys {
+ cp.Keys[k] = v
+ }
return &cp
}
@@ -90,6 +96,16 @@ func (c *Context) HandlerName() string {
return nameOfFunction(c.handlers.Last())
}
+// HandlerNames returns a list of all registered handlers for this context in descending order,
+// following the semantics of HandlerName()
+func (c *Context) HandlerNames() []string {
+ hn := make([]string, 0, len(c.handlers))
+ for _, val := range c.handlers {
+ hn = append(hn, nameOfFunction(val))
+ }
+ return hn
+}
+
// Handler returns the main handler.
func (c *Context) Handler() HandlerFunc {
return c.handlers.Last()
@@ -104,8 +120,9 @@ func (c *Context) Handler() HandlerFunc {
// See example in GitHub.
func (c *Context) Next() {
c.index++
- for s := int8(len(c.handlers)); c.index < s; c.index++ {
+ for c.index < int8(len(c.handlers)) {
c.handlers[c.index](c)
+ c.index++
}
}
@@ -414,16 +431,14 @@ func (c *Context) PostFormArray(key string) []string {
// a boolean value whether at least one value exists for the given key.
func (c *Context) GetPostFormArray(key string) ([]string, bool) {
req := c.Request
- req.ParseForm()
- req.ParseMultipartForm(c.engine.MaxMultipartMemory)
+ if err := req.ParseMultipartForm(c.engine.MaxMultipartMemory); err != nil {
+ if err != http.ErrNotMultipart {
+ debugPrint("error on parse multipart form array: %v", err)
+ }
+ }
if values := req.PostForm[key]; len(values) > 0 {
return values, true
}
- if req.MultipartForm != nil && req.MultipartForm.File != nil {
- if values := req.MultipartForm.Value[key]; len(values) > 0 {
- return values, true
- }
- }
return []string{}, false
}
@@ -437,15 +452,12 @@ func (c *Context) PostFormMap(key string) map[string]string {
// whether at least one value exists for the given key.
func (c *Context) GetPostFormMap(key string) (map[string]string, bool) {
req := c.Request
- req.ParseForm()
- req.ParseMultipartForm(c.engine.MaxMultipartMemory)
- dicts, exist := c.get(req.PostForm, key)
-
- if !exist && req.MultipartForm != nil && req.MultipartForm.File != nil {
- dicts, exist = c.get(req.MultipartForm.Value, key)
+ if err := req.ParseMultipartForm(c.engine.MaxMultipartMemory); err != nil {
+ if err != http.ErrNotMultipart {
+ debugPrint("error on parse multipart form map: %v", err)
+ }
}
-
- return dicts, exist
+ return c.get(req.PostForm, key)
}
// get is an internal method and returns a map which satisfy conditions.
@@ -465,6 +477,11 @@ func (c *Context) get(m map[string][]string, key string) (map[string]string, boo
// FormFile returns the first file for the provided form key.
func (c *Context) FormFile(name string) (*multipart.FileHeader, error) {
+ if c.Request.MultipartForm == nil {
+ if err := c.Request.ParseMultipartForm(c.engine.MaxMultipartMemory); err != nil {
+ return nil, err
+ }
+ }
_, fh, err := c.Request.FormFile(name)
return fh, err
}
@@ -489,8 +506,8 @@ func (c *Context) SaveUploadedFile(file *multipart.FileHeader, dst string) error
}
defer out.Close()
- io.Copy(out, src)
- return nil
+ _, err = io.Copy(out, src)
+ return err
}
// Bind checks the Content-Type to select a binding engine automatically,
@@ -511,20 +528,40 @@ func (c *Context) BindJSON(obj interface{}) error {
return c.MustBindWith(obj, binding.JSON)
}
+// BindXML is a shortcut for c.MustBindWith(obj, binding.BindXML).
+func (c *Context) BindXML(obj interface{}) error {
+ return c.MustBindWith(obj, binding.XML)
+}
+
// BindQuery is a shortcut for c.MustBindWith(obj, binding.Query).
func (c *Context) BindQuery(obj interface{}) error {
return c.MustBindWith(obj, binding.Query)
}
+// BindYAML is a shortcut for c.MustBindWith(obj, binding.YAML).
+func (c *Context) BindYAML(obj interface{}) error {
+ return c.MustBindWith(obj, binding.YAML)
+}
+
+// BindUri binds the passed struct pointer using binding.Uri.
+// It will abort the request with HTTP 400 if any error occurs.
+func (c *Context) BindUri(obj interface{}) error {
+ if err := c.ShouldBindUri(obj); err != nil {
+ c.AbortWithError(http.StatusBadRequest, err).SetType(ErrorTypeBind) // nolint: errcheck
+ return err
+ }
+ return nil
+}
+
// MustBindWith binds the passed struct pointer using the specified binding engine.
-// It will abort the request with HTTP 400 if any error ocurrs.
+// It will abort the request with HTTP 400 if any error occurs.
// See the binding package.
-func (c *Context) MustBindWith(obj interface{}, b binding.Binding) (err error) {
- if err = c.ShouldBindWith(obj, b); err != nil {
- c.AbortWithError(http.StatusBadRequest, err).SetType(ErrorTypeBind)
+func (c *Context) MustBindWith(obj interface{}, b binding.Binding) error {
+ if err := c.ShouldBindWith(obj, b); err != nil {
+ c.AbortWithError(http.StatusBadRequest, err).SetType(ErrorTypeBind) // nolint: errcheck
+ return err
}
-
- return
+ return nil
}
// ShouldBind checks the Content-Type to select a binding engine automatically,
@@ -545,11 +582,30 @@ func (c *Context) ShouldBindJSON(obj interface{}) error {
return c.ShouldBindWith(obj, binding.JSON)
}
+// ShouldBindXML is a shortcut for c.ShouldBindWith(obj, binding.XML).
+func (c *Context) ShouldBindXML(obj interface{}) error {
+ return c.ShouldBindWith(obj, binding.XML)
+}
+
// ShouldBindQuery is a shortcut for c.ShouldBindWith(obj, binding.Query).
func (c *Context) ShouldBindQuery(obj interface{}) error {
return c.ShouldBindWith(obj, binding.Query)
}
+// ShouldBindYAML is a shortcut for c.ShouldBindWith(obj, binding.YAML).
+func (c *Context) ShouldBindYAML(obj interface{}) error {
+ return c.ShouldBindWith(obj, binding.YAML)
+}
+
+// ShouldBindUri binds the passed struct pointer using the specified binding engine.
+func (c *Context) ShouldBindUri(obj interface{}) error {
+ m := make(map[string][]string)
+ for _, v := range c.Params {
+ m[v.Key] = []string{v.Value}
+ }
+ return binding.Uri.BindUri(m, obj)
+}
+
// ShouldBindWith binds the passed struct pointer using the specified binding engine.
// See the binding package.
func (c *Context) ShouldBindWith(obj interface{}, b binding.Binding) error {
@@ -561,9 +617,7 @@ func (c *Context) ShouldBindWith(obj interface{}, b binding.Binding) error {
//
// NOTE: This method reads the body before binding. So you should use
// ShouldBindWith for better performance if you need to call only once.
-func (c *Context) ShouldBindBodyWith(
- obj interface{}, bb binding.BindingBody,
-) (err error) {
+func (c *Context) ShouldBindBodyWith(obj interface{}, bb binding.BindingBody) (err error) {
var body []byte
if cb, ok := c.Get(BodyBytesKey); ok {
if cbb, ok := cb.([]byte); ok {
@@ -655,9 +709,9 @@ func (c *Context) Status(code int) {
func (c *Context) Header(key, value string) {
if value == "" {
c.Writer.Header().Del(key)
- } else {
- c.Writer.Header().Set(key, value)
+ return
}
+ c.Writer.Header().Set(key, value)
}
// GetHeader returns value from request headers.
@@ -701,6 +755,7 @@ func (c *Context) Cookie(name string) (string, error) {
return val, nil
}
+// Render writes the response headers and calls render.Render to render data.
func (c *Context) Render(code int, r render.Render) {
c.Status(code)
@@ -745,9 +800,9 @@ func (c *Context) JSONP(code int, obj interface{}) {
callback := c.DefaultQuery("callback", "")
if callback == "" {
c.Render(code, render.JSON{Data: obj})
- } else {
- c.Render(code, render.JsonpJSON{Callback: callback, Data: obj})
+ return
}
+ c.Render(code, render.JsonpJSON{Callback: callback, Data: obj})
}
// JSON serializes the given struct as JSON into the response body.
@@ -762,6 +817,12 @@ func (c *Context) AsciiJSON(code int, obj interface{}) {
c.Render(code, render.AsciiJSON{Data: obj})
}
+// PureJSON serializes the given struct as JSON into the response body.
+// PureJSON, unlike JSON, does not replace special html characters with their unicode entities.
+func (c *Context) PureJSON(code int, obj interface{}) {
+ c.Render(code, render.PureJSON{Data: obj})
+}
+
// XML serializes the given struct as XML into the response body.
// It also sets the Content-Type as "application/xml".
func (c *Context) XML(code int, obj interface{}) {
@@ -773,6 +834,11 @@ func (c *Context) YAML(code int, obj interface{}) {
c.Render(code, render.YAML{Data: obj})
}
+// ProtoBuf serializes the given struct as ProtoBuf into the response body.
+func (c *Context) ProtoBuf(code int, obj interface{}) {
+ c.Render(code, render.ProtoBuf{Data: obj})
+}
+
// String writes the given string into the response body.
func (c *Context) String(code int, format string, values ...interface{}) {
c.Render(code, render.String{Format: format, Data: values})
@@ -810,6 +876,13 @@ func (c *Context) File(filepath string) {
http.ServeFile(c.Writer, c.Request, filepath)
}
+// FileAttachment writes the specified file into the body stream in an efficient way
+// On the client side, the file will typically be downloaded with the given filename
+func (c *Context) FileAttachment(filepath, filename string) {
+ c.Writer.Header().Set("content-disposition", fmt.Sprintf("attachment; filename=\"%s\"", filename))
+ http.ServeFile(c.Writer, c.Request, filepath)
+}
+
// SSEvent writes a Server-Sent Event into the body stream.
func (c *Context) SSEvent(name string, message interface{}) {
c.Render(-1, sse.Event{
@@ -818,18 +891,20 @@ func (c *Context) SSEvent(name string, message interface{}) {
})
}
-func (c *Context) Stream(step func(w io.Writer) bool) {
+// Stream sends a streaming response and returns a boolean
+// indicates "Is client disconnected in middle of stream"
+func (c *Context) Stream(step func(w io.Writer) bool) bool {
w := c.Writer
clientGone := w.CloseNotify()
for {
select {
case <-clientGone:
- return
+ return true
default:
keepOpen := step(w)
w.Flush()
if !keepOpen {
- return
+ return false
}
}
}
@@ -839,6 +914,7 @@ func (c *Context) Stream(step func(w io.Writer) bool) {
/******** CONTENT NEGOTIATION *******/
/************************************/
+// Negotiate contains all negotiations data.
type Negotiate struct {
Offered []string
HTMLName string
@@ -848,6 +924,7 @@ type Negotiate struct {
Data interface{}
}
+// Negotiate calls different Render according acceptable Accept format.
func (c *Context) Negotiate(code int, config Negotiate) {
switch c.NegotiateFormat(config.Offered...) {
case binding.MIMEJSON:
@@ -863,10 +940,11 @@ func (c *Context) Negotiate(code int, config Negotiate) {
c.XML(code, data)
default:
- c.AbortWithError(http.StatusNotAcceptable, errors.New("the accepted formats are not offered by the server"))
+ c.AbortWithError(http.StatusNotAcceptable, errors.New("the accepted formats are not offered by the server")) // nolint: errcheck
}
}
+// NegotiateFormat returns an acceptable Accept format.
func (c *Context) NegotiateFormat(offered ...string) string {
assert1(len(offered) > 0, "you must provide at least one offer")
@@ -878,7 +956,18 @@ func (c *Context) NegotiateFormat(offered ...string) string {
}
for _, accepted := range c.Accepted {
for _, offert := range offered {
- if accepted == offert {
+ // According to RFC 2616 and RFC 2396, non-ASCII characters are not allowed in headers,
+ // therefore we can just iterate over the string without casting it into []rune
+ i := 0
+ for ; i < len(accepted); i++ {
+ if accepted[i] == '*' || offert[i] == '*' {
+ return offert
+ }
+ if accepted[i] != offert[i] {
+ break
+ }
+ }
+ if i == len(accepted) {
return offert
}
}
@@ -886,6 +975,7 @@ func (c *Context) NegotiateFormat(offered ...string) string {
return ""
}
+// SetAccepted sets Accept header data.
func (c *Context) SetAccepted(formats ...string) {
c.Accepted = formats
}
diff --git a/vendor/github.com/gin-gonic/gin/coverage.sh b/vendor/github.com/gin-gonic/gin/coverage.sh
deleted file mode 100644
index 4d1ee036..00000000
--- a/vendor/github.com/gin-gonic/gin/coverage.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/usr/bin/env bash
-
-set -e
-
-echo "mode: count" > coverage.out
-
-for d in $(go list ./... | grep -E 'gin$|binding$|render$' | grep -v 'examples'); do
- go test -v -covermode=count -coverprofile=profile.out $d
- if [ -f profile.out ]; then
- cat profile.out | grep -v "mode:" >> coverage.out
- rm profile.out
- fi
-done
diff --git a/vendor/github.com/gin-gonic/gin/debug.go b/vendor/github.com/gin-gonic/gin/debug.go
index f11156b3..6d40a5da 100644
--- a/vendor/github.com/gin-gonic/gin/debug.go
+++ b/vendor/github.com/gin-gonic/gin/debug.go
@@ -6,13 +6,15 @@ package gin
import (
"bytes"
+ "fmt"
"html/template"
- "log"
+ "os"
+ "runtime"
+ "strconv"
+ "strings"
)
-func init() {
- log.SetFlags(0)
-}
+const ginSupportMinGoVer = 8
// IsDebugging returns true if the framework is running in debug mode.
// Use SetMode(gin.ReleaseMode) to disable debug mode.
@@ -20,11 +22,18 @@ func IsDebugging() bool {
return ginMode == debugCode
}
+// DebugPrintRouteFunc indicates debug log output format.
+var DebugPrintRouteFunc func(httpMethod, absolutePath, handlerName string, nuHandlers int)
+
func debugPrintRoute(httpMethod, absolutePath string, handlers HandlersChain) {
if IsDebugging() {
nuHandlers := len(handlers)
handlerName := nameOfFunction(handlers.Last())
- debugPrint("%-6s %-25s --> %s (%d handlers)\n", httpMethod, absolutePath, handlerName, nuHandlers)
+ if DebugPrintRouteFunc == nil {
+ debugPrint("%-6s %-25s --> %s (%d handlers)\n", httpMethod, absolutePath, handlerName, nuHandlers)
+ } else {
+ DebugPrintRouteFunc(httpMethod, absolutePath, handlerName, nuHandlers)
+ }
}
}
@@ -42,14 +51,28 @@ func debugPrintLoadTemplate(tmpl *template.Template) {
func debugPrint(format string, values ...interface{}) {
if IsDebugging() {
- log.Printf("[GIN-debug] "+format, values...)
+ if !strings.HasSuffix(format, "\n") {
+ format += "\n"
+ }
+ fmt.Fprintf(os.Stderr, "[GIN-debug] "+format, values...)
}
}
+func getMinVer(v string) (uint64, error) {
+ first := strings.IndexByte(v, '.')
+ last := strings.LastIndexByte(v, '.')
+ if first == last {
+ return strconv.ParseUint(v[first+1:], 10, 64)
+ }
+ return strconv.ParseUint(v[first+1:last], 10, 64)
+}
+
func debugPrintWARNINGDefault() {
- debugPrint(`[WARNING] Now Gin requires Go 1.6 or later and Go 1.7 will be required soon.
+ if v, e := getMinVer(runtime.Version()); e == nil && v <= ginSupportMinGoVer {
+ debugPrint(`[WARNING] Now Gin requires Go 1.8 or later and Go 1.9 will be required soon.
`)
+ }
debugPrint(`[WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.
`)
diff --git a/vendor/github.com/gin-gonic/gin/doc.go b/vendor/github.com/gin-gonic/gin/doc.go
index 01ac4a90..1bd03864 100644
--- a/vendor/github.com/gin-gonic/gin/doc.go
+++ b/vendor/github.com/gin-gonic/gin/doc.go
@@ -1,6 +1,6 @@
/*
Package gin implements a HTTP web framework called gin.
-See https://gin-gonic.github.io/gin/ for more information about gin.
+See https://gin-gonic.com/ for more information about gin.
*/
package gin // import "github.com/gin-gonic/gin"
diff --git a/vendor/github.com/gin-gonic/gin/errors.go b/vendor/github.com/gin-gonic/gin/errors.go
index dbfccd85..6070ff55 100644
--- a/vendor/github.com/gin-gonic/gin/errors.go
+++ b/vendor/github.com/gin-gonic/gin/errors.go
@@ -9,21 +9,28 @@ import (
"fmt"
"reflect"
- "github.com/gin-gonic/gin/json"
+ "github.com/gin-gonic/gin/internal/json"
)
+// ErrorType is an unsigned 64-bit error code as defined in the gin spec.
type ErrorType uint64
const (
- ErrorTypeBind ErrorType = 1 << 63 // used when c.Bind() fails
- ErrorTypeRender ErrorType = 1 << 62 // used when c.Render() fails
+ // ErrorTypeBind is used when Context.Bind() fails.
+ ErrorTypeBind ErrorType = 1 << 63
+ // ErrorTypeRender is used when Context.Render() fails.
+ ErrorTypeRender ErrorType = 1 << 62
+ // ErrorTypePrivate indicates a private error.
ErrorTypePrivate ErrorType = 1 << 0
- ErrorTypePublic ErrorType = 1 << 1
-
+ // ErrorTypePublic indicates a public error.
+ ErrorTypePublic ErrorType = 1 << 1
+ // ErrorTypeAny indicates any other error.
ErrorTypeAny ErrorType = 1<<64 - 1
- ErrorTypeNu = 2
+ // ErrorTypeNu indicates any other error.
+ ErrorTypeNu = 2
)
+// Error represents a error's specification.
type Error struct {
Err error
Type ErrorType
@@ -34,16 +41,19 @@ type errorMsgs []*Error
var _ error = &Error{}
+// SetType sets the error's type.
func (msg *Error) SetType(flags ErrorType) *Error {
msg.Type = flags
return msg
}
+// SetMeta sets the error's meta data.
func (msg *Error) SetMeta(data interface{}) *Error {
msg.Meta = data
return msg
}
+// JSON creates a properly formatted JSON
func (msg *Error) JSON() interface{} {
json := H{}
if msg.Meta != nil {
@@ -70,11 +80,12 @@ func (msg *Error) MarshalJSON() ([]byte, error) {
return json.Marshal(msg.JSON())
}
-// Error implements the error interface
+// Error implements the error interface.
func (msg Error) Error() string {
return msg.Err.Error()
}
+// IsType judges one error.
func (msg *Error) IsType(flags ErrorType) bool {
return (msg.Type & flags) > 0
}
@@ -138,6 +149,7 @@ func (a errorMsgs) JSON() interface{} {
}
}
+// MarshalJSON implements the json.Marshaller interface.
func (a errorMsgs) MarshalJSON() ([]byte, error) {
return json.Marshal(a.JSON())
}
diff --git a/vendor/github.com/gin-gonic/gin/gin.go b/vendor/github.com/gin-gonic/gin/gin.go
index aa62e014..4dbe9836 100644
--- a/vendor/github.com/gin-gonic/gin/gin.go
+++ b/vendor/github.com/gin-gonic/gin/gin.go
@@ -5,20 +5,18 @@
package gin
import (
+ "fmt"
"html/template"
"net"
"net/http"
"os"
+ "path"
"sync"
"github.com/gin-gonic/gin/render"
)
-const (
- // Version is Framework's version.
- Version = "v1.3.0"
- defaultMultipartMemory = 32 << 20 // 32 MB
-)
+const defaultMultipartMemory = 32 << 20 // 32 MB
var (
default404Body = []byte("404 page not found")
@@ -26,7 +24,10 @@ var (
defaultAppEngine bool
)
+// HandlerFunc defines the handler used by gin middleware as return value.
type HandlerFunc func(*Context)
+
+// HandlersChain defines a HandlerFunc array.
type HandlersChain []HandlerFunc
// Last returns the last handler in the chain. ie. the last handler is the main own.
@@ -37,12 +38,15 @@ func (c HandlersChain) Last() HandlerFunc {
return nil
}
+// RouteInfo represents a request route's specification which contains method and path and its handler.
type RouteInfo struct {
- Method string
- Path string
- Handler string
+ Method string
+ Path string
+ Handler string
+ HandlerFunc HandlerFunc
}
+// RoutesInfo defines a RouteInfo array.
type RoutesInfo []RouteInfo
// Engine is the framework's instance, it contains the muxer, middleware and configuration settings.
@@ -155,6 +159,7 @@ func (engine *Engine) allocateContext() *Context {
return &Context{engine: engine}
}
+// Delims sets template left and right delims and returns a Engine instance.
func (engine *Engine) Delims(left, right string) *Engine {
engine.delims = render.Delims{Left: left, Right: right}
return engine
@@ -220,7 +225,7 @@ func (engine *Engine) NoMethod(handlers ...HandlerFunc) {
engine.rebuild405Handlers()
}
-// Use attachs a global middleware to the router. ie. the middleware attached though Use() will be
+// Use attaches a global middleware to the router. ie. the middleware attached though Use() will be
// included in the handlers chain for every single request. Even 404, 405, static files...
// For example, this is the right place for a logger or error management middleware.
func (engine *Engine) Use(middleware ...HandlerFunc) IRoutes {
@@ -264,10 +269,12 @@ func (engine *Engine) Routes() (routes RoutesInfo) {
func iterate(path, method string, routes RoutesInfo, root *node) RoutesInfo {
path += root.path
if len(root.handlers) > 0 {
+ handlerFunc := root.handlers.Last()
routes = append(routes, RouteInfo{
- Method: method,
- Path: path,
- Handler: nameOfFunction(root.handlers.Last()),
+ Method: method,
+ Path: path,
+ Handler: nameOfFunction(handlerFunc),
+ HandlerFunc: handlerFunc,
})
}
for _, child := range root.children {
@@ -312,6 +319,24 @@ func (engine *Engine) RunUnix(file string) (err error) {
return
}
defer listener.Close()
+ os.Chmod(file, 0777)
+ err = http.Serve(listener, engine)
+ return
+}
+
+// RunFd attaches the router to a http.Server and starts listening and serving HTTP requests
+// through the specified file descriptor.
+// Note: this method will block the calling goroutine indefinitely unless an error happens.
+func (engine *Engine) RunFd(fd int) (err error) {
+ debugPrint("Listening and serving HTTP on fd@%d", fd)
+ defer func() { debugPrintError(err) }()
+
+ f := os.NewFile(uintptr(fd), fmt.Sprintf("fd@%d", fd))
+ listener, err := net.FileListener(f)
+ if err != nil {
+ return
+ }
+ defer listener.Close()
err = http.Serve(listener, engine)
return
}
@@ -332,19 +357,22 @@ func (engine *Engine) ServeHTTP(w http.ResponseWriter, req *http.Request) {
// This can be done by setting c.Request.URL.Path to your new target.
// Disclaimer: You can loop yourself to death with this, use wisely.
func (engine *Engine) HandleContext(c *Context) {
+ oldIndexValue := c.index
c.reset()
engine.handleHTTPRequest(c)
- engine.pool.Put(c)
+
+ c.index = oldIndexValue
}
func (engine *Engine) handleHTTPRequest(c *Context) {
httpMethod := c.Request.Method
- path := c.Request.URL.Path
+ rPath := c.Request.URL.Path
unescape := false
if engine.UseRawPath && len(c.Request.URL.RawPath) > 0 {
- path = c.Request.URL.RawPath
+ rPath = c.Request.URL.RawPath
unescape = engine.UnescapePathValues
}
+ rPath = cleanPath(rPath)
// Find root of the tree for the given HTTP method
t := engine.trees
@@ -354,7 +382,7 @@ func (engine *Engine) handleHTTPRequest(c *Context) {
}
root := t[i].root
// Find route in tree
- handlers, params, tsr := root.getValue(path, c.Params, unescape)
+ handlers, params, tsr := root.getValue(rPath, c.Params, unescape)
if handlers != nil {
c.handlers = handlers
c.Params = params
@@ -362,7 +390,7 @@ func (engine *Engine) handleHTTPRequest(c *Context) {
c.writermem.WriteHeaderNow()
return
}
- if httpMethod != "CONNECT" && path != "/" {
+ if httpMethod != "CONNECT" && rPath != "/" {
if tsr && engine.RedirectTrailingSlash {
redirectTrailingSlash(c)
return
@@ -379,7 +407,7 @@ func (engine *Engine) handleHTTPRequest(c *Context) {
if tree.method == httpMethod {
continue
}
- if handlers, _, _ := tree.root.getValue(path, nil, unescape); handlers != nil {
+ if handlers, _, _ := tree.root.getValue(rPath, nil, unescape); handlers != nil {
c.handlers = engine.allNoMethod
serveError(c, http.StatusMethodNotAllowed, default405Body)
return
@@ -400,7 +428,10 @@ func serveError(c *Context, code int, defaultMessage []byte) {
}
if c.writermem.Status() == code {
c.writermem.Header()["Content-Type"] = mimePlain
- c.Writer.Write(defaultMessage)
+ _, err := c.Writer.Write(defaultMessage)
+ if err != nil {
+ debugPrint("cannot write message to writer during serve error: %v", err)
+ }
return
}
c.writermem.WriteHeaderNow()
@@ -409,32 +440,35 @@ func serveError(c *Context, code int, defaultMessage []byte) {
func redirectTrailingSlash(c *Context) {
req := c.Request
- path := req.URL.Path
+ p := req.URL.Path
+ if prefix := path.Clean(c.Request.Header.Get("X-Forwarded-Prefix")); prefix != "." {
+ p = prefix + "/" + req.URL.Path
+ }
code := http.StatusMovedPermanently // Permanent redirect, request with GET method
if req.Method != "GET" {
code = http.StatusTemporaryRedirect
}
- req.URL.Path = path + "/"
- if length := len(path); length > 1 && path[length-1] == '/' {
- req.URL.Path = path[:length-1]
+ req.URL.Path = p + "/"
+ if length := len(p); length > 1 && p[length-1] == '/' {
+ req.URL.Path = p[:length-1]
}
- debugPrint("redirecting request %d: %s --> %s", code, path, req.URL.String())
+ debugPrint("redirecting request %d: %s --> %s", code, p, req.URL.String())
http.Redirect(c.Writer, req, req.URL.String(), code)
c.writermem.WriteHeaderNow()
}
func redirectFixedPath(c *Context, root *node, trailingSlash bool) bool {
req := c.Request
- path := req.URL.Path
+ rPath := req.URL.Path
- if fixedPath, ok := root.findCaseInsensitivePath(cleanPath(path), trailingSlash); ok {
+ if fixedPath, ok := root.findCaseInsensitivePath(cleanPath(rPath), trailingSlash); ok {
code := http.StatusMovedPermanently // Permanent redirect, request with GET method
if req.Method != "GET" {
code = http.StatusTemporaryRedirect
}
req.URL.Path = string(fixedPath)
- debugPrint("redirecting request %d: %s --> %s", code, path, req.URL.String())
+ debugPrint("redirecting request %d: %s --> %s", code, rPath, req.URL.String())
http.Redirect(c.Writer, req, req.URL.String(), code)
c.writermem.WriteHeaderNow()
return true
diff --git a/vendor/github.com/gin-gonic/gin/go.mod b/vendor/github.com/gin-gonic/gin/go.mod
new file mode 100644
index 00000000..1c5e995c
--- /dev/null
+++ b/vendor/github.com/gin-gonic/gin/go.mod
@@ -0,0 +1,18 @@
+module github.com/gin-gonic/gin
+
+go 1.12
+
+require (
+ github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3
+ github.com/golang/protobuf v1.3.1
+ github.com/json-iterator/go v1.1.6
+ github.com/mattn/go-isatty v0.0.7
+ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
+ github.com/modern-go/reflect2 v1.0.1 // indirect
+ github.com/stretchr/testify v1.3.0
+ github.com/ugorji/go v1.1.4
+ golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c
+ gopkg.in/go-playground/assert.v1 v1.2.1 // indirect
+ gopkg.in/go-playground/validator.v8 v8.18.2
+ gopkg.in/yaml.v2 v2.2.2
+)
diff --git a/vendor/github.com/gin-gonic/gin/go.sum b/vendor/github.com/gin-gonic/gin/go.sum
new file mode 100644
index 00000000..58104682
--- /dev/null
+++ b/vendor/github.com/gin-gonic/gin/go.sum
@@ -0,0 +1,36 @@
+github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
+github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3 h1:t8FVkw33L+wilf2QiWkw0UV77qRpcH/JHPKGpKa2E8g=
+github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s=
+github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg=
+github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/json-iterator/go v1.1.6 h1:MrUvLMLTMxbqFJ9kzlvat/rYZqZnW3u4wkLzWTaFwKs=
+github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
+github.com/mattn/go-isatty v0.0.7 h1:UvyT9uN+3r7yLEYSlJsbQGdsaB/a0DlgWP3pql6iwOc=
+github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
+github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
+github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
+github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
+github.com/modern-go/reflect2 v1.0.1/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/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.4 h1:j4s+tAvLfL3bZyefP2SEWmhBzmuIlH/eqNuPdFPgngw=
+github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c h1:uOCk1iQW6Vc18bnC13MfzScl+wdKBmM9Y9kU7Z83/lw=
+golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8=
+golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM=
+gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE=
+gopkg.in/go-playground/validator.v8 v8.18.2 h1:lFB4DoMU6B626w8ny76MV7VX6W2VHct2GVOI3xgiMrQ=
+gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y=
+gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
+gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
diff --git a/vendor/github.com/gin-gonic/gin/internal/json/json.go b/vendor/github.com/gin-gonic/gin/internal/json/json.go
new file mode 100644
index 00000000..480e8bff
--- /dev/null
+++ b/vendor/github.com/gin-gonic/gin/internal/json/json.go
@@ -0,0 +1,22 @@
+// Copyright 2017 Bo-Yi Wu. All rights reserved.
+// Use of this source code is governed by a MIT style
+// license that can be found in the LICENSE file.
+
+// +build !jsoniter
+
+package json
+
+import "encoding/json"
+
+var (
+ // Marshal is exported by gin/json package.
+ Marshal = json.Marshal
+ // Unmarshal is exported by gin/json package.
+ Unmarshal = json.Unmarshal
+ // MarshalIndent is exported by gin/json package.
+ MarshalIndent = json.MarshalIndent
+ // NewDecoder is exported by gin/json package.
+ NewDecoder = json.NewDecoder
+ // NewEncoder is exported by gin/json package.
+ NewEncoder = json.NewEncoder
+)
diff --git a/vendor/github.com/gin-gonic/gin/internal/json/jsoniter.go b/vendor/github.com/gin-gonic/gin/internal/json/jsoniter.go
new file mode 100644
index 00000000..fabd7b84
--- /dev/null
+++ b/vendor/github.com/gin-gonic/gin/internal/json/jsoniter.go
@@ -0,0 +1,23 @@
+// Copyright 2017 Bo-Yi Wu. All rights reserved.
+// Use of this source code is governed by a MIT style
+// license that can be found in the LICENSE file.
+
+// +build jsoniter
+
+package json
+
+import "github.com/json-iterator/go"
+
+var (
+ json = jsoniter.ConfigCompatibleWithStandardLibrary
+ // Marshal is exported by gin/json package.
+ Marshal = json.Marshal
+ // Unmarshal is exported by gin/json package.
+ Unmarshal = json.Unmarshal
+ // MarshalIndent is exported by gin/json package.
+ MarshalIndent = json.MarshalIndent
+ // NewDecoder is exported by gin/json package.
+ NewDecoder = json.NewDecoder
+ // NewEncoder is exported by gin/json package.
+ NewEncoder = json.NewEncoder
+)
diff --git a/vendor/github.com/gin-gonic/gin/json/json.go b/vendor/github.com/gin-gonic/gin/json/json.go
deleted file mode 100644
index aa76aa30..00000000
--- a/vendor/github.com/gin-gonic/gin/json/json.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2017 Bo-Yi Wu. All rights reserved.
-// Use of this source code is governed by a MIT style
-// license that can be found in the LICENSE file.
-
-// +build !jsoniter
-
-package json
-
-import "encoding/json"
-
-var (
- Marshal = json.Marshal
- MarshalIndent = json.MarshalIndent
- NewDecoder = json.NewDecoder
-)
diff --git a/vendor/github.com/gin-gonic/gin/json/jsoniter.go b/vendor/github.com/gin-gonic/gin/json/jsoniter.go
deleted file mode 100644
index ffe1424a..00000000
--- a/vendor/github.com/gin-gonic/gin/json/jsoniter.go
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2017 Bo-Yi Wu. All rights reserved.
-// Use of this source code is governed by a MIT style
-// license that can be found in the LICENSE file.
-
-// +build jsoniter
-
-package json
-
-import "github.com/json-iterator/go"
-
-var (
- json = jsoniter.ConfigCompatibleWithStandardLibrary
- Marshal = json.Marshal
- MarshalIndent = json.MarshalIndent
- NewDecoder = json.NewDecoder
-)
diff --git a/vendor/github.com/gin-gonic/gin/logger.go b/vendor/github.com/gin-gonic/gin/logger.go
index 1a8df601..5ab4639e 100644
--- a/vendor/github.com/gin-gonic/gin/logger.go
+++ b/vendor/github.com/gin-gonic/gin/logger.go
@@ -14,21 +14,151 @@ import (
"github.com/mattn/go-isatty"
)
+type consoleColorModeValue int
+
+const (
+ autoColor consoleColorModeValue = iota
+ disableColor
+ forceColor
+)
+
var (
- green = string([]byte{27, 91, 57, 55, 59, 52, 50, 109})
- white = string([]byte{27, 91, 57, 48, 59, 52, 55, 109})
- yellow = string([]byte{27, 91, 57, 55, 59, 52, 51, 109})
- red = string([]byte{27, 91, 57, 55, 59, 52, 49, 109})
- blue = string([]byte{27, 91, 57, 55, 59, 52, 52, 109})
- magenta = string([]byte{27, 91, 57, 55, 59, 52, 53, 109})
- cyan = string([]byte{27, 91, 57, 55, 59, 52, 54, 109})
- reset = string([]byte{27, 91, 48, 109})
- disableColor = false
+ green = string([]byte{27, 91, 57, 55, 59, 52, 50, 109})
+ white = string([]byte{27, 91, 57, 48, 59, 52, 55, 109})
+ yellow = string([]byte{27, 91, 57, 48, 59, 52, 51, 109})
+ red = string([]byte{27, 91, 57, 55, 59, 52, 49, 109})
+ blue = string([]byte{27, 91, 57, 55, 59, 52, 52, 109})
+ magenta = string([]byte{27, 91, 57, 55, 59, 52, 53, 109})
+ cyan = string([]byte{27, 91, 57, 55, 59, 52, 54, 109})
+ reset = string([]byte{27, 91, 48, 109})
+ consoleColorMode = autoColor
)
+// LoggerConfig defines the config for Logger middleware.
+type LoggerConfig struct {
+ // Optional. Default value is gin.defaultLogFormatter
+ Formatter LogFormatter
+
+ // Output is a writer where logs are written.
+ // Optional. Default value is gin.DefaultWriter.
+ Output io.Writer
+
+ // SkipPaths is a url path array which logs are not written.
+ // Optional.
+ SkipPaths []string
+}
+
+// LogFormatter gives the signature of the formatter function passed to LoggerWithFormatter
+type LogFormatter func(params LogFormatterParams) string
+
+// LogFormatterParams is the structure any formatter will be handed when time to log comes
+type LogFormatterParams struct {
+ Request *http.Request
+
+ // TimeStamp shows the time after the server returns a response.
+ TimeStamp time.Time
+ // StatusCode is HTTP response code.
+ StatusCode int
+ // Latency is how much time the server cost to process a certain request.
+ Latency time.Duration
+ // ClientIP equals Context's ClientIP method.
+ ClientIP string
+ // Method is the HTTP method given to the request.
+ Method string
+ // Path is a path the client requests.
+ Path string
+ // ErrorMessage is set if error has occurred in processing the request.
+ ErrorMessage string
+ // isTerm shows whether does gin's output descriptor refers to a terminal.
+ isTerm bool
+ // BodySize is the size of the Response Body
+ BodySize int
+ // Keys are the keys set on the request's context.
+ Keys map[string]interface{}
+}
+
+// StatusCodeColor is the ANSI color for appropriately logging http status code to a terminal.
+func (p *LogFormatterParams) StatusCodeColor() string {
+ code := p.StatusCode
+
+ switch {
+ case code >= http.StatusOK && code < http.StatusMultipleChoices:
+ return green
+ case code >= http.StatusMultipleChoices && code < http.StatusBadRequest:
+ return white
+ case code >= http.StatusBadRequest && code < http.StatusInternalServerError:
+ return yellow
+ default:
+ return red
+ }
+}
+
+// MethodColor is the ANSI color for appropriately logging http method to a terminal.
+func (p *LogFormatterParams) MethodColor() string {
+ method := p.Method
+
+ switch method {
+ case "GET":
+ return blue
+ case "POST":
+ return cyan
+ case "PUT":
+ return yellow
+ case "DELETE":
+ return red
+ case "PATCH":
+ return green
+ case "HEAD":
+ return magenta
+ case "OPTIONS":
+ return white
+ default:
+ return reset
+ }
+}
+
+// ResetColor resets all escape attributes.
+func (p *LogFormatterParams) ResetColor() string {
+ return reset
+}
+
+// IsOutputColor indicates whether can colors be outputted to the log.
+func (p *LogFormatterParams) IsOutputColor() bool {
+ return consoleColorMode == forceColor || (consoleColorMode == autoColor && p.isTerm)
+}
+
+// defaultLogFormatter is the default log format function Logger middleware uses.
+var defaultLogFormatter = func(param LogFormatterParams) string {
+ var statusColor, methodColor, resetColor string
+ if param.IsOutputColor() {
+ statusColor = param.StatusCodeColor()
+ methodColor = param.MethodColor()
+ resetColor = param.ResetColor()
+ }
+
+ if param.Latency > time.Minute {
+ // Truncate in a golang < 1.8 safe way
+ param.Latency = param.Latency - param.Latency%time.Second
+ }
+ return fmt.Sprintf("[GIN] %v |%s %3d %s| %13v | %15s |%s %-7s %s %s\n%s",
+ param.TimeStamp.Format("2006/01/02 - 15:04:05"),
+ statusColor, param.StatusCode, resetColor,
+ param.Latency,
+ param.ClientIP,
+ methodColor, param.Method, resetColor,
+ param.Path,
+ param.ErrorMessage,
+ )
+}
+
// DisableConsoleColor disables color output in the console.
func DisableConsoleColor() {
- disableColor = true
+ consoleColorMode = disableColor
+}
+
+// ForceConsoleColor force color output in the console.
+func ForceConsoleColor() {
+ consoleColorMode = forceColor
}
// ErrorLogger returns a handlerfunc for any error type.
@@ -50,17 +180,43 @@ func ErrorLoggerT(typ ErrorType) HandlerFunc {
// Logger instances a Logger middleware that will write the logs to gin.DefaultWriter.
// By default gin.DefaultWriter = os.Stdout.
func Logger() HandlerFunc {
- return LoggerWithWriter(DefaultWriter)
+ return LoggerWithConfig(LoggerConfig{})
}
-// LoggerWithWriter instance a Logger middleware with the specified writter buffer.
+// LoggerWithFormatter instance a Logger middleware with the specified log format function.
+func LoggerWithFormatter(f LogFormatter) HandlerFunc {
+ return LoggerWithConfig(LoggerConfig{
+ Formatter: f,
+ })
+}
+
+// LoggerWithWriter instance a Logger middleware with the specified writer buffer.
// Example: os.Stdout, a file opened in write mode, a socket...
func LoggerWithWriter(out io.Writer, notlogged ...string) HandlerFunc {
+ return LoggerWithConfig(LoggerConfig{
+ Output: out,
+ SkipPaths: notlogged,
+ })
+}
+
+// LoggerWithConfig instance a Logger middleware with config.
+func LoggerWithConfig(conf LoggerConfig) HandlerFunc {
+ formatter := conf.Formatter
+ if formatter == nil {
+ formatter = defaultLogFormatter
+ }
+
+ out := conf.Output
+ if out == nil {
+ out = DefaultWriter
+ }
+
+ notlogged := conf.SkipPaths
+
isTerm := true
- if w, ok := out.(*os.File); !ok ||
- (os.Getenv("TERM") == "dumb" || (!isatty.IsTerminal(w.Fd()) && !isatty.IsCygwinTerminal(w.Fd()))) ||
- disableColor {
+ if w, ok := out.(*os.File); !ok || os.Getenv("TERM") == "dumb" ||
+ (!isatty.IsTerminal(w.Fd()) && !isatty.IsCygwinTerminal(w.Fd())) {
isTerm = false
}
@@ -85,68 +241,30 @@ func LoggerWithWriter(out io.Writer, notlogged ...string) HandlerFunc {
// Log only when path is not being skipped
if _, ok := skip[path]; !ok {
- // Stop timer
- end := time.Now()
- latency := end.Sub(start)
-
- clientIP := c.ClientIP()
- method := c.Request.Method
- statusCode := c.Writer.Status()
- var statusColor, methodColor, resetColor string
- if isTerm {
- statusColor = colorForStatus(statusCode)
- methodColor = colorForMethod(method)
- resetColor = reset
+ param := LogFormatterParams{
+ Request: c.Request,
+ isTerm: isTerm,
+ Keys: c.Keys,
}
- comment := c.Errors.ByType(ErrorTypePrivate).String()
+
+ // Stop timer
+ param.TimeStamp = time.Now()
+ param.Latency = param.TimeStamp.Sub(start)
+
+ param.ClientIP = c.ClientIP()
+ param.Method = c.Request.Method
+ param.StatusCode = c.Writer.Status()
+ param.ErrorMessage = c.Errors.ByType(ErrorTypePrivate).String()
+
+ param.BodySize = c.Writer.Size()
if raw != "" {
path = path + "?" + raw
}
- fmt.Fprintf(out, "[GIN] %v |%s %3d %s| %13v | %15s |%s %-7s %s %s\n%s",
- end.Format("2006/01/02 - 15:04:05"),
- statusColor, statusCode, resetColor,
- latency,
- clientIP,
- methodColor, method, resetColor,
- path,
- comment,
- )
- }
- }
-}
+ param.Path = path
-func colorForStatus(code int) string {
- switch {
- case code >= http.StatusOK && code < http.StatusMultipleChoices:
- return green
- case code >= http.StatusMultipleChoices && code < http.StatusBadRequest:
- return white
- case code >= http.StatusBadRequest && code < http.StatusInternalServerError:
- return yellow
- default:
- return red
- }
-}
-
-func colorForMethod(method string) string {
- switch method {
- case "GET":
- return blue
- case "POST":
- return cyan
- case "PUT":
- return yellow
- case "DELETE":
- return red
- case "PATCH":
- return green
- case "HEAD":
- return magenta
- case "OPTIONS":
- return white
- default:
- return reset
+ fmt.Fprint(out, formatter(param))
+ }
}
}
diff --git a/vendor/github.com/gin-gonic/gin/mode.go b/vendor/github.com/gin-gonic/gin/mode.go
index 9df4e45f..8aa84aa8 100644
--- a/vendor/github.com/gin-gonic/gin/mode.go
+++ b/vendor/github.com/gin-gonic/gin/mode.go
@@ -11,12 +11,16 @@ import (
"github.com/gin-gonic/gin/binding"
)
-const ENV_GIN_MODE = "GIN_MODE"
+// EnvGinMode indicates environment name for gin mode.
+const EnvGinMode = "GIN_MODE"
const (
- DebugMode = "debug"
+ // DebugMode indicates gin mode is debug.
+ DebugMode = "debug"
+ // ReleaseMode indicates gin mode is release.
ReleaseMode = "release"
- TestMode = "test"
+ // TestMode indicates gin mode is test.
+ TestMode = "test"
)
const (
debugCode = iota
@@ -24,7 +28,7 @@ const (
testCode
)
-// DefaultWriter is the default io.Writer used the Gin for debug output and
+// DefaultWriter is the default io.Writer used by Gin for debug output and
// middleware output like Logger() or Recovery().
// Note that both Logger and Recovery provides custom ways to configure their
// output io.Writer.
@@ -32,16 +36,19 @@ const (
// import "github.com/mattn/go-colorable"
// gin.DefaultWriter = colorable.NewColorableStdout()
var DefaultWriter io.Writer = os.Stdout
+
+// DefaultErrorWriter is the default io.Writer used by Gin to debug errors
var DefaultErrorWriter io.Writer = os.Stderr
var ginMode = debugCode
var modeName = DebugMode
func init() {
- mode := os.Getenv(ENV_GIN_MODE)
+ mode := os.Getenv(EnvGinMode)
SetMode(mode)
}
+// SetMode sets gin mode according to input string.
func SetMode(value string) {
switch value {
case DebugMode, "":
@@ -59,14 +66,18 @@ func SetMode(value string) {
modeName = value
}
+// DisableBindValidation closes the default validator.
func DisableBindValidation() {
binding.Validator = nil
}
+// EnableJsonDecoderUseNumber sets true for binding.EnableDecoderUseNumberto to
+// call the UseNumber method on the JSON Decoder instance.
func EnableJsonDecoderUseNumber() {
binding.EnableDecoderUseNumber = true
}
+// Mode returns currently gin mode.
func Mode() string {
return modeName
}
diff --git a/vendor/github.com/gin-gonic/gin/recovery.go b/vendor/github.com/gin-gonic/gin/recovery.go
index 61c5bd53..bc946c03 100644
--- a/vendor/github.com/gin-gonic/gin/recovery.go
+++ b/vendor/github.com/gin-gonic/gin/recovery.go
@@ -10,9 +10,12 @@ import (
"io"
"io/ioutil"
"log"
+ "net"
"net/http"
"net/http/httputil"
+ "os"
"runtime"
+ "strings"
"time"
)
@@ -37,12 +40,44 @@ func RecoveryWithWriter(out io.Writer) HandlerFunc {
return func(c *Context) {
defer func() {
if err := recover(); err != nil {
+ // Check for a broken connection, as it is not really a
+ // condition that warrants a panic stack trace.
+ var brokenPipe bool
+ if ne, ok := err.(*net.OpError); ok {
+ if se, ok := ne.Err.(*os.SyscallError); ok {
+ if strings.Contains(strings.ToLower(se.Error()), "broken pipe") || strings.Contains(strings.ToLower(se.Error()), "connection reset by peer") {
+ brokenPipe = true
+ }
+ }
+ }
if logger != nil {
stack := stack(3)
- httprequest, _ := httputil.DumpRequest(c.Request, false)
- logger.Printf("[Recovery] %s panic recovered:\n%s\n%s\n%s%s", timeFormat(time.Now()), string(httprequest), err, stack, reset)
+ httpRequest, _ := httputil.DumpRequest(c.Request, false)
+ headers := strings.Split(string(httpRequest), "\r\n")
+ for idx, header := range headers {
+ current := strings.Split(header, ":")
+ if current[0] == "Authorization" {
+ headers[idx] = current[0] + ": *"
+ }
+ }
+ if brokenPipe {
+ logger.Printf("%s\n%s%s", err, string(httpRequest), reset)
+ } else if IsDebugging() {
+ logger.Printf("[Recovery] %s panic recovered:\n%s\n%s\n%s%s",
+ timeFormat(time.Now()), strings.Join(headers, "\r\n"), err, stack, reset)
+ } else {
+ logger.Printf("[Recovery] %s panic recovered:\n%s\n%s%s",
+ timeFormat(time.Now()), err, stack, reset)
+ }
+ }
+
+ // If the connection is dead, we can't write a status to it.
+ if brokenPipe {
+ c.Error(err.(error)) // nolint: errcheck
+ c.Abort()
+ } else {
+ c.AbortWithStatus(http.StatusInternalServerError)
}
- c.AbortWithStatus(http.StatusInternalServerError)
}
}()
c.Next()
@@ -100,8 +135,8 @@ func function(pc uintptr) []byte {
// *T.ptrmethod
// Also the package path might contains dot (e.g. code.google.com/...),
// so first eliminate the path prefix
- if lastslash := bytes.LastIndex(name, slash); lastslash >= 0 {
- name = name[lastslash+1:]
+ if lastSlash := bytes.LastIndex(name, slash); lastSlash >= 0 {
+ name = name[lastSlash+1:]
}
if period := bytes.Index(name, dot); period >= 0 {
name = name[period+1:]
diff --git a/vendor/github.com/gin-gonic/gin/render/data.go b/vendor/github.com/gin-gonic/gin/render/data.go
index 33194913..6ba657ba 100644
--- a/vendor/github.com/gin-gonic/gin/render/data.go
+++ b/vendor/github.com/gin-gonic/gin/render/data.go
@@ -6,6 +6,7 @@ package render
import "net/http"
+// Data contains ContentType and bytes data.
type Data struct {
ContentType string
Data []byte
@@ -18,6 +19,7 @@ func (r Data) Render(w http.ResponseWriter) (err error) {
return
}
+// WriteContentType (Data) writes custom ContentType.
func (r Data) WriteContentType(w http.ResponseWriter) {
writeContentType(w, []string{r.ContentType})
}
diff --git a/vendor/github.com/gin-gonic/gin/render/html.go b/vendor/github.com/gin-gonic/gin/render/html.go
index 1e3be65b..6696ece9 100644
--- a/vendor/github.com/gin-gonic/gin/render/html.go
+++ b/vendor/github.com/gin-gonic/gin/render/html.go
@@ -9,20 +9,27 @@ import (
"net/http"
)
+// Delims represents a set of Left and Right delimiters for HTML template rendering.
type Delims struct {
- Left string
+ // Left delimiter, defaults to {{.
+ Left string
+ // Right delimiter, defaults to }}.
Right string
}
+// HTMLRender interface is to be implemented by HTMLProduction and HTMLDebug.
type HTMLRender interface {
+ // Instance returns an HTML instance.
Instance(string, interface{}) Render
}
+// HTMLProduction contains template reference and its delims.
type HTMLProduction struct {
Template *template.Template
Delims Delims
}
+// HTMLDebug contains template delims and pattern and function with file list.
type HTMLDebug struct {
Files []string
Glob string
@@ -30,6 +37,7 @@ type HTMLDebug struct {
FuncMap template.FuncMap
}
+// HTML contains template reference and its name with given interface object.
type HTML struct {
Template *template.Template
Name string
@@ -38,6 +46,7 @@ type HTML struct {
var htmlContentType = []string{"text/html; charset=utf-8"}
+// Instance (HTMLProduction) returns an HTML instance which it realizes Render interface.
func (r HTMLProduction) Instance(name string, data interface{}) Render {
return HTML{
Template: r.Template,
@@ -46,6 +55,7 @@ func (r HTMLProduction) Instance(name string, data interface{}) Render {
}
}
+// Instance (HTMLDebug) returns an HTML instance which it realizes Render interface.
func (r HTMLDebug) Instance(name string, data interface{}) Render {
return HTML{
Template: r.loadTemplate(),
@@ -66,6 +76,7 @@ func (r HTMLDebug) loadTemplate() *template.Template {
panic("the HTML debug render was created without files or glob pattern")
}
+// Render (HTML) executes template and writes its result with custom ContentType for response.
func (r HTML) Render(w http.ResponseWriter) error {
r.WriteContentType(w)
@@ -75,6 +86,7 @@ func (r HTML) Render(w http.ResponseWriter) error {
return r.Template.ExecuteTemplate(w, r.Name, r.Data)
}
+// WriteContentType (HTML) writes HTML ContentType.
func (r HTML) WriteContentType(w http.ResponseWriter) {
writeContentType(w, htmlContentType)
}
diff --git a/vendor/github.com/gin-gonic/gin/render/json.go b/vendor/github.com/gin-gonic/gin/render/json.go
index 6e5089a0..18f27fa9 100644
--- a/vendor/github.com/gin-gonic/gin/render/json.go
+++ b/vendor/github.com/gin-gonic/gin/render/json.go
@@ -10,37 +10,49 @@ import (
"html/template"
"net/http"
- "github.com/gin-gonic/gin/json"
+ "github.com/gin-gonic/gin/internal/json"
)
+// JSON contains the given interface object.
type JSON struct {
Data interface{}
}
+// IndentedJSON contains the given interface object.
type IndentedJSON struct {
Data interface{}
}
+// SecureJSON contains the given interface object and its prefix.
type SecureJSON struct {
Prefix string
Data interface{}
}
+// JsonpJSON contains the given interface object its callback.
type JsonpJSON struct {
Callback string
Data interface{}
}
+// AsciiJSON contains the given interface object.
type AsciiJSON struct {
Data interface{}
}
+// SecureJSONPrefix is a string which represents SecureJSON prefix.
type SecureJSONPrefix string
+// PureJSON contains the given interface object.
+type PureJSON struct {
+ Data interface{}
+}
+
var jsonContentType = []string{"application/json; charset=utf-8"}
var jsonpContentType = []string{"application/javascript; charset=utf-8"}
var jsonAsciiContentType = []string{"application/json"}
+// Render (JSON) writes data with custom ContentType.
func (r JSON) Render(w http.ResponseWriter) (err error) {
if err = WriteJSON(w, r.Data); err != nil {
panic(err)
@@ -48,34 +60,39 @@ func (r JSON) Render(w http.ResponseWriter) (err error) {
return
}
+// WriteContentType (JSON) writes JSON ContentType.
func (r JSON) WriteContentType(w http.ResponseWriter) {
writeContentType(w, jsonContentType)
}
+// WriteJSON marshals the given interface object and writes it with custom ContentType.
func WriteJSON(w http.ResponseWriter, obj interface{}) error {
writeContentType(w, jsonContentType)
jsonBytes, err := json.Marshal(obj)
if err != nil {
return err
}
- w.Write(jsonBytes)
- return nil
+ _, err = w.Write(jsonBytes)
+ return err
}
+// Render (IndentedJSON) marshals the given interface object and writes it with custom ContentType.
func (r IndentedJSON) Render(w http.ResponseWriter) error {
r.WriteContentType(w)
jsonBytes, err := json.MarshalIndent(r.Data, "", " ")
if err != nil {
return err
}
- w.Write(jsonBytes)
- return nil
+ _, err = w.Write(jsonBytes)
+ return err
}
+// WriteContentType (IndentedJSON) writes JSON ContentType.
func (r IndentedJSON) WriteContentType(w http.ResponseWriter) {
writeContentType(w, jsonContentType)
}
+// Render (SecureJSON) marshals the given interface object and writes it with custom ContentType.
func (r SecureJSON) Render(w http.ResponseWriter) error {
r.WriteContentType(w)
jsonBytes, err := json.Marshal(r.Data)
@@ -84,16 +101,21 @@ func (r SecureJSON) Render(w http.ResponseWriter) error {
}
// if the jsonBytes is array values
if bytes.HasPrefix(jsonBytes, []byte("[")) && bytes.HasSuffix(jsonBytes, []byte("]")) {
- w.Write([]byte(r.Prefix))
+ _, err = w.Write([]byte(r.Prefix))
+ if err != nil {
+ return err
+ }
}
- w.Write(jsonBytes)
- return nil
+ _, err = w.Write(jsonBytes)
+ return err
}
+// WriteContentType (SecureJSON) writes JSON ContentType.
func (r SecureJSON) WriteContentType(w http.ResponseWriter) {
writeContentType(w, jsonContentType)
}
+// Render (JsonpJSON) marshals the given interface object and writes it and its callback with custom ContentType.
func (r JsonpJSON) Render(w http.ResponseWriter) (err error) {
r.WriteContentType(w)
ret, err := json.Marshal(r.Data)
@@ -102,23 +124,37 @@ func (r JsonpJSON) Render(w http.ResponseWriter) (err error) {
}
if r.Callback == "" {
- w.Write(ret)
- return nil
+ _, err = w.Write(ret)
+ return err
}
callback := template.JSEscapeString(r.Callback)
- w.Write([]byte(callback))
- w.Write([]byte("("))
- w.Write(ret)
- w.Write([]byte(")"))
+ _, err = w.Write([]byte(callback))
+ if err != nil {
+ return err
+ }
+ _, err = w.Write([]byte("("))
+ if err != nil {
+ return err
+ }
+ _, err = w.Write(ret)
+ if err != nil {
+ return err
+ }
+ _, err = w.Write([]byte(")"))
+ if err != nil {
+ return err
+ }
return nil
}
+// WriteContentType (JsonpJSON) writes Javascript ContentType.
func (r JsonpJSON) WriteContentType(w http.ResponseWriter) {
writeContentType(w, jsonpContentType)
}
+// Render (AsciiJSON) marshals the given interface object and writes it with custom ContentType.
func (r AsciiJSON) Render(w http.ResponseWriter) (err error) {
r.WriteContentType(w)
ret, err := json.Marshal(r.Data)
@@ -128,19 +164,31 @@ func (r AsciiJSON) Render(w http.ResponseWriter) (err error) {
var buffer bytes.Buffer
for _, r := range string(ret) {
- cvt := ""
- if r < 128 {
- cvt = string(r)
- } else {
+ cvt := string(r)
+ if r >= 128 {
cvt = fmt.Sprintf("\\u%04x", int64(r))
}
buffer.WriteString(cvt)
}
- w.Write(buffer.Bytes())
- return nil
+ _, err = w.Write(buffer.Bytes())
+ return err
}
+// WriteContentType (AsciiJSON) writes JSON ContentType.
func (r AsciiJSON) WriteContentType(w http.ResponseWriter) {
writeContentType(w, jsonAsciiContentType)
}
+
+// Render (PureJSON) writes custom ContentType and encodes the given interface object.
+func (r PureJSON) Render(w http.ResponseWriter) error {
+ r.WriteContentType(w)
+ encoder := json.NewEncoder(w)
+ encoder.SetEscapeHTML(false)
+ return encoder.Encode(r.Data)
+}
+
+// WriteContentType (PureJSON) writes custom ContentType.
+func (r PureJSON) WriteContentType(w http.ResponseWriter) {
+ writeContentType(w, jsonContentType)
+}
diff --git a/vendor/github.com/gin-gonic/gin/render/msgpack.go b/vendor/github.com/gin-gonic/gin/render/msgpack.go
index e6c13e58..dc681fcf 100644
--- a/vendor/github.com/gin-gonic/gin/render/msgpack.go
+++ b/vendor/github.com/gin-gonic/gin/render/msgpack.go
@@ -10,22 +10,26 @@ import (
"github.com/ugorji/go/codec"
)
+// MsgPack contains the given interface object.
type MsgPack struct {
Data interface{}
}
var msgpackContentType = []string{"application/msgpack; charset=utf-8"}
+// WriteContentType (MsgPack) writes MsgPack ContentType.
func (r MsgPack) WriteContentType(w http.ResponseWriter) {
writeContentType(w, msgpackContentType)
}
+// Render (MsgPack) encodes the given interface object and writes data with custom ContentType.
func (r MsgPack) Render(w http.ResponseWriter) error {
return WriteMsgPack(w, r.Data)
}
+// WriteMsgPack writes MsgPack ContentType and encodes the given interface object.
func WriteMsgPack(w http.ResponseWriter, obj interface{}) error {
writeContentType(w, msgpackContentType)
- var h codec.Handle = new(codec.MsgpackHandle)
- return codec.NewEncoder(w, h).Encode(obj)
+ var mh codec.MsgpackHandle
+ return codec.NewEncoder(w, &mh).Encode(obj)
}
diff --git a/vendor/github.com/gin-gonic/gin/render/protobuf.go b/vendor/github.com/gin-gonic/gin/render/protobuf.go
new file mode 100644
index 00000000..15aca995
--- /dev/null
+++ b/vendor/github.com/gin-gonic/gin/render/protobuf.go
@@ -0,0 +1,36 @@
+// Copyright 2018 Gin Core Team. All rights reserved.
+// Use of this source code is governed by a MIT style
+// license that can be found in the LICENSE file.
+
+package render
+
+import (
+ "net/http"
+
+ "github.com/golang/protobuf/proto"
+)
+
+// ProtoBuf contains the given interface object.
+type ProtoBuf struct {
+ Data interface{}
+}
+
+var protobufContentType = []string{"application/x-protobuf"}
+
+// Render (ProtoBuf) marshals the given interface object and writes data with custom ContentType.
+func (r ProtoBuf) Render(w http.ResponseWriter) error {
+ r.WriteContentType(w)
+
+ bytes, err := proto.Marshal(r.Data.(proto.Message))
+ if err != nil {
+ return err
+ }
+
+ _, err = w.Write(bytes)
+ return err
+}
+
+// WriteContentType (ProtoBuf) writes ProtoBuf ContentType.
+func (r ProtoBuf) WriteContentType(w http.ResponseWriter) {
+ writeContentType(w, protobufContentType)
+}
diff --git a/vendor/github.com/gin-gonic/gin/render/reader.go b/vendor/github.com/gin-gonic/gin/render/reader.go
index be2132c8..312af741 100644
--- a/vendor/github.com/gin-gonic/gin/render/reader.go
+++ b/vendor/github.com/gin-gonic/gin/render/reader.go
@@ -1,3 +1,7 @@
+// Copyright 2018 Gin Core Team. All rights reserved.
+// Use of this source code is governed by a MIT style
+// license that can be found in the LICENSE file.
+
package render
import (
@@ -6,6 +10,7 @@ import (
"strconv"
)
+// Reader contains the IO reader and its length, and custom ContentType and other headers.
type Reader struct {
ContentType string
ContentLength int64
@@ -22,15 +27,17 @@ func (r Reader) Render(w http.ResponseWriter) (err error) {
return
}
+// WriteContentType (Reader) writes custom ContentType.
func (r Reader) WriteContentType(w http.ResponseWriter) {
writeContentType(w, []string{r.ContentType})
}
+// writeHeaders writes custom Header.
func (r Reader) writeHeaders(w http.ResponseWriter, headers map[string]string) {
header := w.Header()
for k, v := range headers {
- if val := header[k]; len(val) == 0 {
- header[k] = []string{v}
+ if header.Get(k) == "" {
+ header.Set(k, v)
}
}
}
diff --git a/vendor/github.com/gin-gonic/gin/render/redirect.go b/vendor/github.com/gin-gonic/gin/render/redirect.go
index a0634f5a..c006691c 100644
--- a/vendor/github.com/gin-gonic/gin/render/redirect.go
+++ b/vendor/github.com/gin-gonic/gin/render/redirect.go
@@ -9,20 +9,21 @@ import (
"net/http"
)
+// Redirect contains the http request reference and redirects status code and location.
type Redirect struct {
Code int
Request *http.Request
Location string
}
+// Render (Redirect) redirects the http request to new location and writes redirect response.
func (r Redirect) Render(w http.ResponseWriter) error {
- // todo(thinkerou): go1.6 not support StatusPermanentRedirect(308)
- // when we upgrade go version we can use http.StatusPermanentRedirect
- if (r.Code < 300 || r.Code > 308) && r.Code != 201 {
+ if (r.Code < http.StatusMultipleChoices || r.Code > http.StatusPermanentRedirect) && r.Code != http.StatusCreated {
panic(fmt.Sprintf("Cannot redirect with status code %d", r.Code))
}
http.Redirect(w, r.Request, r.Location, r.Code)
return nil
}
+// WriteContentType (Redirect) don't write any ContentType.
func (r Redirect) WriteContentType(http.ResponseWriter) {}
diff --git a/vendor/github.com/gin-gonic/gin/render/render.go b/vendor/github.com/gin-gonic/gin/render/render.go
index 4ff1c7b6..abfc79fc 100644
--- a/vendor/github.com/gin-gonic/gin/render/render.go
+++ b/vendor/github.com/gin-gonic/gin/render/render.go
@@ -6,8 +6,11 @@ package render
import "net/http"
+// Render interface is to be implemented by JSON, XML, HTML, YAML and so on.
type Render interface {
+ // Render writes data with custom ContentType.
Render(http.ResponseWriter) error
+ // WriteContentType writes custom ContentType.
WriteContentType(w http.ResponseWriter)
}
@@ -27,6 +30,7 @@ var (
_ Render = MsgPack{}
_ Render = Reader{}
_ Render = AsciiJSON{}
+ _ Render = ProtoBuf{}
)
func writeContentType(w http.ResponseWriter, value []string) {
diff --git a/vendor/github.com/gin-gonic/gin/render/text.go b/vendor/github.com/gin-gonic/gin/render/text.go
index 74cd26be..4e52d4c5 100644
--- a/vendor/github.com/gin-gonic/gin/render/text.go
+++ b/vendor/github.com/gin-gonic/gin/render/text.go
@@ -10,6 +10,7 @@ import (
"net/http"
)
+// String contains the given interface object slice and its format.
type String struct {
Format string
Data []interface{}
@@ -17,20 +18,23 @@ type String struct {
var plainContentType = []string{"text/plain; charset=utf-8"}
+// Render (String) writes data with custom ContentType.
func (r String) Render(w http.ResponseWriter) error {
- WriteString(w, r.Format, r.Data)
- return nil
+ return WriteString(w, r.Format, r.Data)
}
+// WriteContentType (String) writes Plain ContentType.
func (r String) WriteContentType(w http.ResponseWriter) {
writeContentType(w, plainContentType)
}
-func WriteString(w http.ResponseWriter, format string, data []interface{}) {
+// WriteString writes data according to its format and write custom ContentType.
+func WriteString(w http.ResponseWriter, format string, data []interface{}) (err error) {
writeContentType(w, plainContentType)
if len(data) > 0 {
- fmt.Fprintf(w, format, data...)
- } else {
- io.WriteString(w, format)
+ _, err = fmt.Fprintf(w, format, data...)
+ return
}
+ _, err = io.WriteString(w, format)
+ return
}
diff --git a/vendor/github.com/gin-gonic/gin/render/xml.go b/vendor/github.com/gin-gonic/gin/render/xml.go
index cff1ac3e..cc5390a2 100644
--- a/vendor/github.com/gin-gonic/gin/render/xml.go
+++ b/vendor/github.com/gin-gonic/gin/render/xml.go
@@ -9,17 +9,20 @@ import (
"net/http"
)
+// XML contains the given interface object.
type XML struct {
Data interface{}
}
var xmlContentType = []string{"application/xml; charset=utf-8"}
+// Render (XML) encodes the given interface object and writes data with custom ContentType.
func (r XML) Render(w http.ResponseWriter) error {
r.WriteContentType(w)
return xml.NewEncoder(w).Encode(r.Data)
}
+// WriteContentType (XML) writes XML ContentType for response.
func (r XML) WriteContentType(w http.ResponseWriter) {
writeContentType(w, xmlContentType)
}
diff --git a/vendor/github.com/gin-gonic/gin/render/yaml.go b/vendor/github.com/gin-gonic/gin/render/yaml.go
index 25d0ebd4..0df78360 100644
--- a/vendor/github.com/gin-gonic/gin/render/yaml.go
+++ b/vendor/github.com/gin-gonic/gin/render/yaml.go
@@ -10,12 +10,14 @@ import (
"gopkg.in/yaml.v2"
)
+// YAML contains the given interface object.
type YAML struct {
Data interface{}
}
var yamlContentType = []string{"application/x-yaml; charset=utf-8"}
+// Render (YAML) marshals the given interface object and writes data with custom ContentType.
func (r YAML) Render(w http.ResponseWriter) error {
r.WriteContentType(w)
@@ -24,10 +26,11 @@ func (r YAML) Render(w http.ResponseWriter) error {
return err
}
- w.Write(bytes)
- return nil
+ _, err = w.Write(bytes)
+ return err
}
+// WriteContentType (YAML) writes YAML ContentType for response.
func (r YAML) WriteContentType(w http.ResponseWriter) {
writeContentType(w, yamlContentType)
}
diff --git a/vendor/github.com/gin-gonic/gin/response_writer.go b/vendor/github.com/gin-gonic/gin/response_writer.go
index 923b53f8..26826689 100644
--- a/vendor/github.com/gin-gonic/gin/response_writer.go
+++ b/vendor/github.com/gin-gonic/gin/response_writer.go
@@ -16,7 +16,8 @@ const (
defaultStatus = http.StatusOK
)
-type responseWriterBase interface {
+// ResponseWriter ...
+type ResponseWriter interface {
http.ResponseWriter
http.Hijacker
http.Flusher
@@ -37,6 +38,9 @@ type responseWriterBase interface {
// Forces to write the http header (status code + headers).
WriteHeaderNow()
+
+ // get the http.Pusher for server push
+ Pusher() http.Pusher
}
type responseWriter struct {
@@ -113,3 +117,10 @@ func (w *responseWriter) Flush() {
w.WriteHeaderNow()
w.ResponseWriter.(http.Flusher).Flush()
}
+
+func (w *responseWriter) Pusher() (pusher http.Pusher) {
+ if pusher, ok := w.ResponseWriter.(http.Pusher); ok {
+ return pusher
+ }
+ return nil
+}
diff --git a/vendor/github.com/gin-gonic/gin/response_writer_1.8.go b/vendor/github.com/gin-gonic/gin/response_writer_1.8.go
deleted file mode 100644
index 527c0038..00000000
--- a/vendor/github.com/gin-gonic/gin/response_writer_1.8.go
+++ /dev/null
@@ -1,25 +0,0 @@
-// +build go1.8
-
-// Copyright 2018 Gin Core Team. All rights reserved.
-// Use of this source code is governed by a MIT style
-// license that can be found in the LICENSE file.
-
-package gin
-
-import (
- "net/http"
-)
-
-// ResponseWriter ...
-type ResponseWriter interface {
- responseWriterBase
- // get the http.Pusher for server push
- Pusher() http.Pusher
-}
-
-func (w *responseWriter) Pusher() (pusher http.Pusher) {
- if pusher, ok := w.ResponseWriter.(http.Pusher); ok {
- return pusher
- }
- return nil
-}
diff --git a/vendor/github.com/gin-gonic/gin/routergroup.go b/vendor/github.com/gin-gonic/gin/routergroup.go
index 876a61b8..a1e6c928 100644
--- a/vendor/github.com/gin-gonic/gin/routergroup.go
+++ b/vendor/github.com/gin-gonic/gin/routergroup.go
@@ -11,11 +11,13 @@ import (
"strings"
)
+// IRouter defines all router handle interface includes single and group router.
type IRouter interface {
IRoutes
Group(string, ...HandlerFunc) *RouterGroup
}
+// IRoutes defines all router handle interface.
type IRoutes interface {
Use(...HandlerFunc) IRoutes
@@ -34,8 +36,8 @@ type IRoutes interface {
StaticFS(string, http.FileSystem) IRoutes
}
-// RouterGroup is used internally to configure router, a RouterGroup is associated with a prefix
-// and an array of handlers (middleware).
+// RouterGroup is used internally to configure router, a RouterGroup is associated with
+// a prefix and an array of handlers (middleware).
type RouterGroup struct {
Handlers HandlersChain
basePath string
@@ -45,14 +47,14 @@ type RouterGroup struct {
var _ IRouter = &RouterGroup{}
-// Use adds middleware to the group, see example code in github.
+// Use adds middleware to the group, see example code in GitHub.
func (group *RouterGroup) Use(middleware ...HandlerFunc) IRoutes {
group.Handlers = append(group.Handlers, middleware...)
return group.returnObj()
}
-// Group creates a new router group. You should add all the routes that have common middlwares or the same path prefix.
-// For example, all the routes that use a common middlware for authorization could be grouped.
+// Group creates a new router group. You should add all the routes that have common middlewares or the same path prefix.
+// For example, all the routes that use a common middleware for authorization could be grouped.
func (group *RouterGroup) Group(relativePath string, handlers ...HandlerFunc) *RouterGroup {
return &RouterGroup{
Handlers: group.combineHandlers(handlers),
@@ -61,6 +63,8 @@ func (group *RouterGroup) Group(relativePath string, handlers ...HandlerFunc) *R
}
}
+// BasePath returns the base path of router group.
+// For example, if v := router.Group("/rest/n/v1/api"), v.BasePath() is "/rest/n/v1/api".
func (group *RouterGroup) BasePath() string {
return group.basePath
}
@@ -74,7 +78,7 @@ func (group *RouterGroup) handle(httpMethod, relativePath string, handlers Handl
// Handle registers a new request handle and middleware with the given path and method.
// The last handler should be the real handler, the other ones should be middleware that can and should be shared among different routes.
-// See the example code in github.
+// See the example code in GitHub.
//
// For GET, POST, PUT, PATCH and DELETE requests the respective shortcut
// functions can be used.
@@ -181,11 +185,22 @@ func (group *RouterGroup) StaticFS(relativePath string, fs http.FileSystem) IRou
func (group *RouterGroup) createStaticHandler(relativePath string, fs http.FileSystem) HandlerFunc {
absolutePath := group.calculateAbsolutePath(relativePath)
fileServer := http.StripPrefix(absolutePath, http.FileServer(fs))
- _, nolisting := fs.(*onlyfilesFS)
+
return func(c *Context) {
- if nolisting {
+ if _, nolisting := fs.(*onlyfilesFS); nolisting {
c.Writer.WriteHeader(http.StatusNotFound)
}
+
+ file := c.Param("filepath")
+ // Check if file exists and/or if we have permission to access it
+ if _, err := fs.Open(file); err != nil {
+ c.Writer.WriteHeader(http.StatusNotFound)
+ c.handlers = group.engine.noRoute
+ // Reset index
+ c.index = -1
+ return
+ }
+
fileServer.ServeHTTP(c.Writer, c.Request)
}
}
diff --git a/vendor/github.com/gin-gonic/gin/tree.go b/vendor/github.com/gin-gonic/gin/tree.go
index b6530665..ada62ceb 100644
--- a/vendor/github.com/gin-gonic/gin/tree.go
+++ b/vendor/github.com/gin-gonic/gin/tree.go
@@ -193,9 +193,16 @@ func (n *node) addRoute(path string, handlers HandlersChain) {
}
}
- panic("path segment '" + path +
+ pathSeg := path
+ if n.nType != catchAll {
+ pathSeg = strings.SplitN(path, "/", 2)[0]
+ }
+ prefix := fullPath[:strings.Index(fullPath, pathSeg)] + n.path
+ panic("'" + pathSeg +
+ "' in new path '" + fullPath +
"' conflicts with existing wildcard '" + n.path +
- "' in path '" + fullPath + "'")
+ "' in existing prefix '" + prefix +
+ "'")
}
c := path[0]
diff --git a/vendor/github.com/gin-gonic/gin/utils.go b/vendor/github.com/gin-gonic/gin/utils.go
index bf32c775..f4532d56 100644
--- a/vendor/github.com/gin-gonic/gin/utils.go
+++ b/vendor/github.com/gin-gonic/gin/utils.go
@@ -14,8 +14,10 @@ import (
"strings"
)
+// BindKey indicates a default bind key.
const BindKey = "_gin-gonic/gin/bindkey"
+// Bind is a helper function for given interface object and returns a Gin middleware.
func Bind(val interface{}) HandlerFunc {
value := reflect.ValueOf(val)
if value.Kind() == reflect.Ptr {
@@ -33,16 +35,14 @@ func Bind(val interface{}) HandlerFunc {
}
}
-// WrapF is a helper function for wrapping http.HandlerFunc
-// Returns a Gin middleware
+// WrapF is a helper function for wrapping http.HandlerFunc and returns a Gin middleware.
func WrapF(f http.HandlerFunc) HandlerFunc {
return func(c *Context) {
f(c.Writer, c.Request)
}
}
-// WrapH is a helper function for wrapping http.Handler
-// Returns a Gin middleware
+// WrapH is a helper function for wrapping http.Handler and returns a Gin middleware.
func WrapH(h http.Handler) HandlerFunc {
return func(c *Context) {
h.ServeHTTP(c.Writer, c.Request)
diff --git a/vendor/github.com/gin-gonic/gin/response_writer_1.7.go b/vendor/github.com/gin-gonic/gin/version.go
similarity index 64%
rename from vendor/github.com/gin-gonic/gin/response_writer_1.7.go
rename to vendor/github.com/gin-gonic/gin/version.go
index 801d196b..07e7859f 100644
--- a/vendor/github.com/gin-gonic/gin/response_writer_1.7.go
+++ b/vendor/github.com/gin-gonic/gin/version.go
@@ -1,12 +1,8 @@
-// +build !go1.8
-
// Copyright 2018 Gin Core Team. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
package gin
-// ResponseWriter ...
-type ResponseWriter interface {
- responseWriterBase
-}
+// Version is the current gin framework's version.
+const Version = "v1.4.0"
diff --git a/vendor/github.com/gin-gonic/gin/wercker.yml b/vendor/github.com/gin-gonic/gin/wercker.yml
deleted file mode 100644
index 3ab8084c..00000000
--- a/vendor/github.com/gin-gonic/gin/wercker.yml
+++ /dev/null
@@ -1 +0,0 @@
-box: wercker/default
\ No newline at end of file
diff --git a/vendor/github.com/go-openapi/spec/.golangci.yml b/vendor/github.com/go-openapi/spec/.golangci.yml
index 48c9813f..00277082 100644
--- a/vendor/github.com/go-openapi/spec/.golangci.yml
+++ b/vendor/github.com/go-openapi/spec/.golangci.yml
@@ -4,7 +4,7 @@ linters-settings:
golint:
min-confidence: 0
gocyclo:
- min-complexity: 25
+ min-complexity: 45
maligned:
suggest-new: true
dupl:
diff --git a/vendor/github.com/go-openapi/spec/bindata.go b/vendor/github.com/go-openapi/spec/bindata.go
index 1717ea10..d5ec7b90 100644
--- a/vendor/github.com/go-openapi/spec/bindata.go
+++ b/vendor/github.com/go-openapi/spec/bindata.go
@@ -1,14 +1,14 @@
-// Code generated by go-bindata.
+// Code generated by go-bindata. DO NOT EDIT.
// sources:
-// schemas/jsonschema-draft-04.json
-// schemas/v2/schema.json
-// DO NOT EDIT!
+// schemas/jsonschema-draft-04.json (4.357kB)
+// schemas/v2/schema.json (40.249kB)
package spec
import (
"bytes"
"compress/gzip"
+ "crypto/sha256"
"fmt"
"io"
"io/ioutil"
@@ -39,8 +39,9 @@ func bindataRead(data []byte, name string) ([]byte, error) {
}
type asset struct {
- bytes []byte
- info os.FileInfo
+ bytes []byte
+ info os.FileInfo
+ digest [sha256.Size]byte
}
type bindataFileInfo struct {
@@ -84,8 +85,8 @@ func jsonschemaDraft04JSON() (*asset, error) {
return nil, err
}
- info := bindataFileInfo{name: "jsonschema-draft-04.json", size: 4357, mode: os.FileMode(420), modTime: time.Unix(1523760398, 0)}
- a := &asset{bytes: bytes, info: info}
+ info := bindataFileInfo{name: "jsonschema-draft-04.json", size: 4357, mode: os.FileMode(436), modTime: time.Unix(1540282154, 0)}
+ a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe1, 0x48, 0x9d, 0xb, 0x47, 0x55, 0xf0, 0x27, 0x93, 0x30, 0x25, 0x91, 0xd3, 0xfc, 0xb8, 0xf0, 0x7b, 0x68, 0x93, 0xa8, 0x2a, 0x94, 0xf2, 0x48, 0x95, 0xf8, 0xe4, 0xed, 0xf1, 0x1b, 0x82, 0xe2}}
return a, nil
}
@@ -104,8 +105,8 @@ func v2SchemaJSON() (*asset, error) {
return nil, err
}
- info := bindataFileInfo{name: "v2/schema.json", size: 40249, mode: os.FileMode(420), modTime: time.Unix(1523760397, 0)}
- a := &asset{bytes: bytes, info: info}
+ info := bindataFileInfo{name: "v2/schema.json", size: 40249, mode: os.FileMode(436), modTime: time.Unix(1540282154, 0)}
+ a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xcb, 0x25, 0x27, 0xe8, 0x46, 0xae, 0x22, 0xc4, 0xf4, 0x8b, 0x1, 0x32, 0x4d, 0x1f, 0xf8, 0xdf, 0x75, 0x15, 0xc8, 0x2d, 0xc7, 0xed, 0xe, 0x7e, 0x0, 0x75, 0xc0, 0xf9, 0xd2, 0x1f, 0x75, 0x57}}
return a, nil
}
@@ -113,8 +114,8 @@ func v2SchemaJSON() (*asset, error) {
// It returns an error if the asset could not be found or
// could not be loaded.
func Asset(name string) ([]byte, error) {
- cannonicalName := strings.Replace(name, "\\", "/", -1)
- if f, ok := _bindata[cannonicalName]; ok {
+ canonicalName := strings.Replace(name, "\\", "/", -1)
+ if f, ok := _bindata[canonicalName]; ok {
a, err := f()
if err != nil {
return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
@@ -124,6 +125,12 @@ func Asset(name string) ([]byte, error) {
return nil, fmt.Errorf("Asset %s not found", name)
}
+// AssetString returns the asset contents as a string (instead of a []byte).
+func AssetString(name string) (string, error) {
+ data, err := Asset(name)
+ return string(data), err
+}
+
// MustAsset is like Asset but panics when Asset would return an error.
// It simplifies safe initialization of global variables.
func MustAsset(name string) []byte {
@@ -135,12 +142,18 @@ func MustAsset(name string) []byte {
return a
}
+// MustAssetString is like AssetString but panics when Asset would return an
+// error. It simplifies safe initialization of global variables.
+func MustAssetString(name string) string {
+ return string(MustAsset(name))
+}
+
// AssetInfo loads and returns the asset info for the given name.
// It returns an error if the asset could not be found or
// could not be loaded.
func AssetInfo(name string) (os.FileInfo, error) {
- cannonicalName := strings.Replace(name, "\\", "/", -1)
- if f, ok := _bindata[cannonicalName]; ok {
+ canonicalName := strings.Replace(name, "\\", "/", -1)
+ if f, ok := _bindata[canonicalName]; ok {
a, err := f()
if err != nil {
return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
@@ -150,6 +163,33 @@ func AssetInfo(name string) (os.FileInfo, error) {
return nil, fmt.Errorf("AssetInfo %s not found", name)
}
+// AssetDigest returns the digest of the file with the given name. It returns an
+// error if the asset could not be found or the digest could not be loaded.
+func AssetDigest(name string) ([sha256.Size]byte, error) {
+ canonicalName := strings.Replace(name, "\\", "/", -1)
+ if f, ok := _bindata[canonicalName]; ok {
+ a, err := f()
+ if err != nil {
+ return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s can't read by error: %v", name, err)
+ }
+ return a.digest, nil
+ }
+ return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s not found", name)
+}
+
+// Digests returns a map of all known files and their checksums.
+func Digests() (map[string][sha256.Size]byte, error) {
+ mp := make(map[string][sha256.Size]byte, len(_bindata))
+ for name := range _bindata {
+ a, err := _bindata[name]()
+ if err != nil {
+ return nil, err
+ }
+ mp[name] = a.digest
+ }
+ return mp, nil
+}
+
// AssetNames returns the names of the assets.
func AssetNames() []string {
names := make([]string, 0, len(_bindata))
@@ -162,7 +202,8 @@ func AssetNames() []string {
// _bindata is a table, holding each asset generator, mapped to its name.
var _bindata = map[string]func() (*asset, error){
"jsonschema-draft-04.json": jsonschemaDraft04JSON,
- "v2/schema.json": v2SchemaJSON,
+
+ "v2/schema.json": v2SchemaJSON,
}
// AssetDir returns the file names below a certain
@@ -174,15 +215,15 @@ var _bindata = map[string]func() (*asset, error){
// img/
// a.png
// b.png
-// then AssetDir("data") would return []string{"foo.txt", "img"}
-// AssetDir("data/img") would return []string{"a.png", "b.png"}
-// AssetDir("foo.txt") and AssetDir("notexist") would return an error
+// then AssetDir("data") would return []string{"foo.txt", "img"},
+// AssetDir("data/img") would return []string{"a.png", "b.png"},
+// AssetDir("foo.txt") and AssetDir("notexist") would return an error, and
// AssetDir("") will return []string{"data"}.
func AssetDir(name string) ([]string, error) {
node := _bintree
if len(name) != 0 {
- cannonicalName := strings.Replace(name, "\\", "/", -1)
- pathList := strings.Split(cannonicalName, "/")
+ canonicalName := strings.Replace(name, "\\", "/", -1)
+ pathList := strings.Split(canonicalName, "/")
for _, p := range pathList {
node = node.Children[p]
if node == nil {
@@ -212,7 +253,7 @@ var _bintree = &bintree{nil, map[string]*bintree{
}},
}}
-// RestoreAsset restores an asset under the given directory
+// RestoreAsset restores an asset under the given directory.
func RestoreAsset(dir, name string) error {
data, err := Asset(name)
if err != nil {
@@ -230,14 +271,10 @@ func RestoreAsset(dir, name string) error {
if err != nil {
return err
}
- err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
- if err != nil {
- return err
- }
- return nil
+ return os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
}
-// RestoreAssets restores an asset under the given directory recursively
+// RestoreAssets restores an asset under the given directory recursively.
func RestoreAssets(dir, name string) error {
children, err := AssetDir(name)
// File
@@ -255,6 +292,6 @@ func RestoreAssets(dir, name string) error {
}
func _filePath(dir, name string) string {
- cannonicalName := strings.Replace(name, "\\", "/", -1)
- return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
+ canonicalName := strings.Replace(name, "\\", "/", -1)
+ return filepath.Join(append([]string{dir}, strings.Split(canonicalName, "/")...)...)
}
diff --git a/vendor/github.com/go-openapi/spec/cache.go b/vendor/github.com/go-openapi/spec/cache.go
new file mode 100644
index 00000000..3fada0da
--- /dev/null
+++ b/vendor/github.com/go-openapi/spec/cache.go
@@ -0,0 +1,60 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package spec
+
+import "sync"
+
+// ResolutionCache a cache for resolving urls
+type ResolutionCache interface {
+ Get(string) (interface{}, bool)
+ Set(string, interface{})
+}
+
+type simpleCache struct {
+ lock sync.RWMutex
+ store map[string]interface{}
+}
+
+// Get retrieves a cached URI
+func (s *simpleCache) Get(uri string) (interface{}, bool) {
+ debugLog("getting %q from resolution cache", uri)
+ s.lock.RLock()
+ v, ok := s.store[uri]
+ debugLog("got %q from resolution cache: %t", uri, ok)
+
+ s.lock.RUnlock()
+ return v, ok
+}
+
+// Set caches a URI
+func (s *simpleCache) Set(uri string, data interface{}) {
+ s.lock.Lock()
+ s.store[uri] = data
+ s.lock.Unlock()
+}
+
+var resCache ResolutionCache
+
+func init() {
+ resCache = initResolutionCache()
+}
+
+// initResolutionCache initializes the URI resolution cache
+func initResolutionCache() ResolutionCache {
+ return &simpleCache{store: map[string]interface{}{
+ "http://swagger.io/v2/schema.json": MustLoadSwagger20Schema(),
+ "http://json-schema.org/draft-04/schema": MustLoadJSONSchemaDraft04(),
+ }}
+}
diff --git a/vendor/github.com/go-openapi/spec/debug.go b/vendor/github.com/go-openapi/spec/debug.go
index 7edb95a6..389c528f 100644
--- a/vendor/github.com/go-openapi/spec/debug.go
+++ b/vendor/github.com/go-openapi/spec/debug.go
@@ -24,9 +24,9 @@ import (
var (
// Debug is true when the SWAGGER_DEBUG env var is not empty.
- // It enables a more verbose logging of validators.
+ // It enables a more verbose logging of this package.
Debug = os.Getenv("SWAGGER_DEBUG") != ""
- // validateLogger is a debug logger for this package
+ // specLogger is a debug logger for this package
specLogger *log.Logger
)
diff --git a/vendor/github.com/go-openapi/spec/expander.go b/vendor/github.com/go-openapi/spec/expander.go
index 456a9dd7..1e7fc8c4 100644
--- a/vendor/github.com/go-openapi/spec/expander.go
+++ b/vendor/github.com/go-openapi/spec/expander.go
@@ -17,20 +17,10 @@ package spec
import (
"encoding/json"
"fmt"
- "log"
- "net/url"
- "os"
- "path"
- "path/filepath"
- "reflect"
"strings"
- "sync"
-
- "github.com/go-openapi/jsonpointer"
- "github.com/go-openapi/swag"
)
-// ExpandOptions provides options for expand.
+// ExpandOptions provides options for spec expand
type ExpandOptions struct {
RelativeBase string
SkipSchemas bool
@@ -38,68 +28,6 @@ type ExpandOptions struct {
AbsoluteCircularRef bool
}
-// ResolutionCache a cache for resolving urls
-type ResolutionCache interface {
- Get(string) (interface{}, bool)
- Set(string, interface{})
-}
-
-type simpleCache struct {
- lock sync.RWMutex
- store map[string]interface{}
-}
-
-var resCache ResolutionCache
-
-func init() {
- resCache = initResolutionCache()
-}
-
-// initResolutionCache initializes the URI resolution cache
-func initResolutionCache() ResolutionCache {
- return &simpleCache{store: map[string]interface{}{
- "http://swagger.io/v2/schema.json": MustLoadSwagger20Schema(),
- "http://json-schema.org/draft-04/schema": MustLoadJSONSchemaDraft04(),
- }}
-}
-
-// resolverContext allows to share a context during spec processing.
-// At the moment, it just holds the index of circular references found.
-type resolverContext struct {
- // circulars holds all visited circular references, which allows shortcuts.
- // NOTE: this is not just a performance improvement: it is required to figure out
- // circular references which participate several cycles.
- // This structure is privately instantiated and needs not be locked against
- // concurrent access, unless we chose to implement a parallel spec walking.
- circulars map[string]bool
- basePath string
-}
-
-func newResolverContext(originalBasePath string) *resolverContext {
- return &resolverContext{
- circulars: make(map[string]bool),
- basePath: originalBasePath, // keep the root base path in context
- }
-}
-
-// Get retrieves a cached URI
-func (s *simpleCache) Get(uri string) (interface{}, bool) {
- debugLog("getting %q from resolution cache", uri)
- s.lock.RLock()
- v, ok := s.store[uri]
- debugLog("got %q from resolution cache: %t", uri, ok)
-
- s.lock.RUnlock()
- return v, ok
-}
-
-// Set caches a URI
-func (s *simpleCache) Set(uri string, data interface{}) {
- s.lock.Lock()
- s.store[uri] = data
- s.lock.Unlock()
-}
-
// ResolveRefWithBase resolves a reference against a context root with preservation of base path
func ResolveRefWithBase(root interface{}, ref *Ref, opts *ExpandOptions) (*Schema, error) {
resolver, err := defaultSchemaLoader(root, opts, nil, nil)
@@ -179,7 +107,10 @@ func ResolveResponseWithBase(root interface{}, ref Ref, opts *ExpandOptions) (*R
return result, nil
}
-// ResolveItems resolves header and parameter items reference against a context root and base path
+// ResolveItems resolves parameter items reference against a context root and base path.
+//
+// NOTE: stricly speaking, this construct is not supported by Swagger 2.0.
+// Similarly, $ref are forbidden in response headers.
func ResolveItems(root interface{}, ref Ref, opts *ExpandOptions) (*Items, error) {
resolver, err := defaultSchemaLoader(root, opts, nil, nil)
if err != nil {
@@ -213,341 +144,11 @@ func ResolvePathItem(root interface{}, ref Ref, opts *ExpandOptions) (*PathItem,
return result, nil
}
-type schemaLoader struct {
- root interface{}
- options *ExpandOptions
- cache ResolutionCache
- context *resolverContext
- loadDoc func(string) (json.RawMessage, error)
-}
-
-var idPtr, _ = jsonpointer.New("/id")
-var refPtr, _ = jsonpointer.New("/$ref")
-
-// PathLoader function to use when loading remote refs
-var PathLoader func(string) (json.RawMessage, error)
-
-func init() {
- PathLoader = func(path string) (json.RawMessage, error) {
- data, err := swag.LoadFromFileOrHTTP(path)
- if err != nil {
- return nil, err
- }
- return json.RawMessage(data), nil
- }
-}
-
-func defaultSchemaLoader(
- root interface{},
- expandOptions *ExpandOptions,
- cache ResolutionCache,
- context *resolverContext) (*schemaLoader, error) {
-
- if cache == nil {
- cache = resCache
- }
- if expandOptions == nil {
- expandOptions = &ExpandOptions{}
- }
- absBase, _ := absPath(expandOptions.RelativeBase)
- if context == nil {
- context = newResolverContext(absBase)
- }
- return &schemaLoader{
- root: root,
- options: expandOptions,
- cache: cache,
- context: context,
- loadDoc: func(path string) (json.RawMessage, error) {
- debugLog("fetching document at %q", path)
- return PathLoader(path)
- },
- }, nil
-}
-
-func idFromNode(node interface{}) (*Ref, error) {
- if idValue, _, err := idPtr.Get(node); err == nil {
- if refStr, ok := idValue.(string); ok && refStr != "" {
- idRef, err := NewRef(refStr)
- if err != nil {
- return nil, err
- }
- return &idRef, nil
- }
- }
- return nil, nil
-}
-
-func nextRef(startingNode interface{}, startingRef *Ref, ptr *jsonpointer.Pointer) *Ref {
- if startingRef == nil {
- return nil
- }
-
- if ptr == nil {
- return startingRef
- }
-
- ret := startingRef
- var idRef *Ref
- node := startingNode
-
- for _, tok := range ptr.DecodedTokens() {
- node, _, _ = jsonpointer.GetForToken(node, tok)
- if node == nil {
- break
- }
-
- idRef, _ = idFromNode(node)
- if idRef != nil {
- nw, err := ret.Inherits(*idRef)
- if err != nil {
- break
- }
- ret = nw
- }
-
- refRef, _, _ := refPtr.Get(node)
- if refRef != nil {
- var rf Ref
- switch value := refRef.(type) {
- case string:
- rf, _ = NewRef(value)
- }
- nw, err := ret.Inherits(rf)
- if err != nil {
- break
- }
- nwURL := nw.GetURL()
- if nwURL.Scheme == "file" || (nwURL.Scheme == "" && nwURL.Host == "") {
- nwpt := filepath.ToSlash(nwURL.Path)
- if filepath.IsAbs(nwpt) {
- _, err := os.Stat(nwpt)
- if err != nil {
- nwURL.Path = filepath.Join(".", nwpt)
- }
- }
- }
-
- ret = nw
- }
-
- }
-
- return ret
-}
-
-// normalize absolute path for cache.
-// on Windows, drive letters should be converted to lower as scheme in net/url.URL
-func normalizeAbsPath(path string) string {
- u, err := url.Parse(path)
- if err != nil {
- debugLog("normalize absolute path failed: %s", err)
- return path
- }
- return u.String()
-}
-
-// base or refPath could be a file path or a URL
-// given a base absolute path and a ref path, return the absolute path of refPath
-// 1) if refPath is absolute, return it
-// 2) if refPath is relative, join it with basePath keeping the scheme, hosts, and ports if exists
-// base could be a directory or a full file path
-func normalizePaths(refPath, base string) string {
- refURL, _ := url.Parse(refPath)
- if path.IsAbs(refURL.Path) || filepath.IsAbs(refPath) {
- // refPath is actually absolute
- if refURL.Host != "" {
- return refPath
- }
- parts := strings.Split(refPath, "#")
- result := filepath.FromSlash(parts[0])
- if len(parts) == 2 {
- result += "#" + parts[1]
- }
- return result
- }
-
- // relative refPath
- baseURL, _ := url.Parse(base)
- if !strings.HasPrefix(refPath, "#") {
- // combining paths
- if baseURL.Host != "" {
- baseURL.Path = path.Join(path.Dir(baseURL.Path), refURL.Path)
- } else { // base is a file
- newBase := fmt.Sprintf("%s#%s", filepath.Join(filepath.Dir(base), filepath.FromSlash(refURL.Path)), refURL.Fragment)
- return newBase
- }
-
- }
- // copying fragment from ref to base
- baseURL.Fragment = refURL.Fragment
- return baseURL.String()
-}
-
-// denormalizePaths returns to simplest notation on file $ref,
-// i.e. strips the absolute path and sets a path relative to the base path.
-//
-// This is currently used when we rewrite ref after a circular ref has been detected
-func denormalizeFileRef(ref *Ref, relativeBase, originalRelativeBase string) *Ref {
- debugLog("denormalizeFileRef for: %s", ref.String())
-
- if ref.String() == "" || ref.IsRoot() || ref.HasFragmentOnly {
- return ref
- }
- // strip relativeBase from URI
- relativeBaseURL, _ := url.Parse(relativeBase)
- relativeBaseURL.Fragment = ""
-
- if relativeBaseURL.IsAbs() && strings.HasPrefix(ref.String(), relativeBase) {
- // this should work for absolute URI (e.g. http://...): we have an exact match, just trim prefix
- r, _ := NewRef(strings.TrimPrefix(ref.String(), relativeBase))
- return &r
- }
-
- if relativeBaseURL.IsAbs() {
- // other absolute URL get unchanged (i.e. with a non-empty scheme)
- return ref
- }
-
- // for relative file URIs:
- originalRelativeBaseURL, _ := url.Parse(originalRelativeBase)
- originalRelativeBaseURL.Fragment = ""
- if strings.HasPrefix(ref.String(), originalRelativeBaseURL.String()) {
- // the resulting ref is in the expanded spec: return a local ref
- r, _ := NewRef(strings.TrimPrefix(ref.String(), originalRelativeBaseURL.String()))
- return &r
- }
-
- // check if we may set a relative path, considering the original base path for this spec.
- // Example:
- // spec is located at /mypath/spec.json
- // my normalized ref points to: /mypath/item.json#/target
- // expected result: item.json#/target
- parts := strings.Split(ref.String(), "#")
- relativePath, err := filepath.Rel(path.Dir(originalRelativeBaseURL.String()), parts[0])
- if err != nil {
- // there is no common ancestor (e.g. different drives on windows)
- // leaves the ref unchanged
- return ref
- }
- if len(parts) == 2 {
- relativePath += "#" + parts[1]
- }
- r, _ := NewRef(relativePath)
- return &r
-}
-
-// relativeBase could be an ABSOLUTE file path or an ABSOLUTE URL
-func normalizeFileRef(ref *Ref, relativeBase string) *Ref {
- // This is important for when the reference is pointing to the root schema
- if ref.String() == "" {
- r, _ := NewRef(relativeBase)
- return &r
- }
-
- debugLog("normalizing %s against %s", ref.String(), relativeBase)
-
- s := normalizePaths(ref.String(), relativeBase)
- r, _ := NewRef(s)
- return &r
-}
-
-func (r *schemaLoader) resolveRef(ref *Ref, target interface{}, basePath string) error {
- tgt := reflect.ValueOf(target)
- if tgt.Kind() != reflect.Ptr {
- return fmt.Errorf("resolve ref: target needs to be a pointer")
- }
-
- refURL := ref.GetURL()
- if refURL == nil {
- return nil
- }
-
- var res interface{}
- var data interface{}
- var err error
- // Resolve against the root if it isn't nil, and if ref is pointing at the root, or has a fragment only which means
- // it is pointing somewhere in the root.
- root := r.root
- if (ref.IsRoot() || ref.HasFragmentOnly) && root == nil && basePath != "" {
- if baseRef, erb := NewRef(basePath); erb == nil {
- root, _, _, _ = r.load(baseRef.GetURL())
- }
- }
- if (ref.IsRoot() || ref.HasFragmentOnly) && root != nil {
- data = root
- } else {
- baseRef := normalizeFileRef(ref, basePath)
- debugLog("current ref is: %s", ref.String())
- debugLog("current ref normalized file: %s", baseRef.String())
- data, _, _, err = r.load(baseRef.GetURL())
- if err != nil {
- return err
- }
- }
-
- res = data
- if ref.String() != "" {
- res, _, err = ref.GetPointer().Get(data)
- if err != nil {
- return err
- }
- }
- if err := swag.DynamicJSONToStruct(res, target); err != nil {
- return err
- }
-
- return nil
-}
-
-func (r *schemaLoader) load(refURL *url.URL) (interface{}, url.URL, bool, error) {
- debugLog("loading schema from url: %s", refURL)
- toFetch := *refURL
- toFetch.Fragment = ""
-
- normalized := normalizeAbsPath(toFetch.String())
-
- data, fromCache := r.cache.Get(normalized)
- if !fromCache {
- b, err := r.loadDoc(normalized)
- if err != nil {
- return nil, url.URL{}, false, err
- }
-
- if err := json.Unmarshal(b, &data); err != nil {
- return nil, url.URL{}, false, err
- }
- r.cache.Set(normalized, data)
- }
-
- return data, toFetch, fromCache, nil
-}
-
-// Resolve resolves a reference against basePath and stores the result in target
-// Resolve is not in charge of following references, it only resolves ref by following its URL
-// if the schema that ref is referring to has more refs in it. Resolve doesn't resolve them
-// if basePath is an empty string, ref is resolved against the root schema stored in the schemaLoader struct
-func (r *schemaLoader) Resolve(ref *Ref, target interface{}, basePath string) error {
- return r.resolveRef(ref, target, basePath)
-}
-
-// absPath returns the absolute path of a file
-func absPath(fname string) (string, error) {
- if strings.HasPrefix(fname, "http") {
- return fname, nil
- }
- if filepath.IsAbs(fname) {
- return fname, nil
- }
- wd, err := os.Getwd()
- return filepath.Join(wd, fname), err
-}
-
// ExpandSpec expands the references in a swagger spec
func ExpandSpec(spec *Swagger, options *ExpandOptions) error {
resolver, err := defaultSchemaLoader(spec, options, nil, nil)
// Just in case this ever returns an error.
- if shouldStopOnError(err, resolver.options) {
+ if resolver.shouldStopOnError(err) {
return err
}
@@ -561,7 +162,7 @@ func ExpandSpec(spec *Swagger, options *ExpandOptions) error {
for key, definition := range spec.Definitions {
var def *Schema
var err error
- if def, err = expandSchema(definition, []string{fmt.Sprintf("#/definitions/%s", key)}, resolver, specBasePath); shouldStopOnError(err, resolver.options) {
+ if def, err = expandSchema(definition, []string{fmt.Sprintf("#/definitions/%s", key)}, resolver, specBasePath); resolver.shouldStopOnError(err) {
return err
}
if def != nil {
@@ -570,23 +171,26 @@ func ExpandSpec(spec *Swagger, options *ExpandOptions) error {
}
}
- for key, parameter := range spec.Parameters {
- if err := expandParameter(¶meter, resolver, specBasePath); shouldStopOnError(err, resolver.options) {
+ for key := range spec.Parameters {
+ parameter := spec.Parameters[key]
+ if err := expandParameterOrResponse(¶meter, resolver, specBasePath); resolver.shouldStopOnError(err) {
return err
}
spec.Parameters[key] = parameter
}
- for key, response := range spec.Responses {
- if err := expandResponse(&response, resolver, specBasePath); shouldStopOnError(err, resolver.options) {
+ for key := range spec.Responses {
+ response := spec.Responses[key]
+ if err := expandParameterOrResponse(&response, resolver, specBasePath); resolver.shouldStopOnError(err) {
return err
}
spec.Responses[key] = response
}
if spec.Paths != nil {
- for key, path := range spec.Paths.Paths {
- if err := expandPathItem(&path, resolver, specBasePath); shouldStopOnError(err, resolver.options) {
+ for key := range spec.Paths.Paths {
+ path := spec.Paths.Paths[key]
+ if err := expandPathItem(&path, resolver, specBasePath); resolver.shouldStopOnError(err) {
return err
}
spec.Paths.Paths[key] = path
@@ -596,18 +200,6 @@ func ExpandSpec(spec *Swagger, options *ExpandOptions) error {
return nil
}
-func shouldStopOnError(err error, opts *ExpandOptions) bool {
- if err != nil && !opts.ContinueOnError {
- return true
- }
-
- if err != nil {
- log.Println(err)
- }
-
- return false
-}
-
// baseForRoot loads in the cache the root document and produces a fake "root" base path entry
// for further $ref resolution
func baseForRoot(root interface{}, cache ResolutionCache) string {
@@ -686,52 +278,6 @@ func expandItems(target Schema, parentRefs []string, resolver *schemaLoader, bas
return &target, nil
}
-// basePathFromSchemaID returns a new basePath based on an existing basePath and a schema ID
-func basePathFromSchemaID(oldBasePath, id string) string {
- u, err := url.Parse(oldBasePath)
- if err != nil {
- panic(err)
- }
- uid, err := url.Parse(id)
- if err != nil {
- panic(err)
- }
-
- if path.IsAbs(uid.Path) {
- return id
- }
- u.Path = path.Join(path.Dir(u.Path), uid.Path)
- return u.String()
-}
-
-// isCircular detects cycles in sequences of $ref.
-// It relies on a private context (which needs not be locked).
-func (r *schemaLoader) isCircular(ref *Ref, basePath string, parentRefs ...string) (foundCycle bool) {
- normalizedRef := normalizePaths(ref.String(), basePath)
- if _, ok := r.context.circulars[normalizedRef]; ok {
- // circular $ref has been already detected in another explored cycle
- foundCycle = true
- return
- }
- foundCycle = swag.ContainsStringsCI(parentRefs, normalizedRef)
- if foundCycle {
- r.context.circulars[normalizedRef] = true
- }
- return
-}
-
-func updateBasePath(transitive *schemaLoader, resolver *schemaLoader, basePath string) string {
- if transitive != resolver {
- debugLog("got a new resolver")
- if transitive.options != nil && transitive.options.RelativeBase != "" {
- basePath, _ = absPath(transitive.options.RelativeBase)
- debugLog("new basePath = %s", basePath)
- }
- }
-
- return basePath
-}
-
func expandSchema(target Schema, parentRefs []string, resolver *schemaLoader, basePath string) (*Schema, error) {
if target.Ref.String() == "" && target.Ref.IsRoot() {
// normalizing is important
@@ -741,8 +287,8 @@ func expandSchema(target Schema, parentRefs []string, resolver *schemaLoader, ba
}
- /* change the base path of resolution when an ID is encountered
- otherwise the basePath should inherit the parent's */
+ // change the base path of resolution when an ID is encountered
+ // otherwise the basePath should inherit the parent's
// important: ID can be relative path
if target.ID != "" {
debugLog("schema has ID: %s", target.ID)
@@ -756,12 +302,11 @@ func expandSchema(target Schema, parentRefs []string, resolver *schemaLoader, ba
basePath = normalizePaths(refPath, basePath)
}
- /* Explain here what this function does */
var t *Schema
- /* if Ref is found, everything else doesn't matter */
- /* Ref also changes the resolution scope of children expandSchema */
+ // if Ref is found, everything else doesn't matter
+ // Ref also changes the resolution scope of children expandSchema
if target.Ref.String() != "" {
- /* Here the resolution scope is changed because a $ref was encountered */
+ // here the resolution scope is changed because a $ref was encountered
normalizedRef := normalizeFileRef(&target.Ref, basePath)
normalizedBasePath := normalizedRef.RemoteURI()
@@ -779,31 +324,27 @@ func expandSchema(target Schema, parentRefs []string, resolver *schemaLoader, ba
return &target, nil
}
- debugLog("basePath: %s", basePath)
- if Debug {
- b, _ := json.Marshal(target)
- debugLog("calling Resolve with target: %s", string(b))
- }
- if err := resolver.Resolve(&target.Ref, &t, basePath); shouldStopOnError(err, resolver.options) {
+ debugLog("basePath: %s: calling Resolve with target: %#v", basePath, target)
+ if err := resolver.Resolve(&target.Ref, &t, basePath); resolver.shouldStopOnError(err) {
return nil, err
}
if t != nil {
parentRefs = append(parentRefs, normalizedRef.String())
var err error
- transitiveResolver, err := transitiveResolver(basePath, target.Ref, resolver)
- if shouldStopOnError(err, resolver.options) {
+ transitiveResolver, err := resolver.transitiveResolver(basePath, target.Ref)
+ if transitiveResolver.shouldStopOnError(err) {
return nil, err
}
- basePath = updateBasePath(transitiveResolver, resolver, normalizedBasePath)
+ basePath = resolver.updateBasePath(transitiveResolver, normalizedBasePath)
return expandSchema(*t, parentRefs, transitiveResolver, basePath)
}
}
t, err := expandItems(target, parentRefs, resolver, basePath)
- if shouldStopOnError(err, resolver.options) {
+ if resolver.shouldStopOnError(err) {
return &target, err
}
if t != nil {
@@ -812,21 +353,21 @@ func expandSchema(target Schema, parentRefs []string, resolver *schemaLoader, ba
for i := range target.AllOf {
t, err := expandSchema(target.AllOf[i], parentRefs, resolver, basePath)
- if shouldStopOnError(err, resolver.options) {
+ if resolver.shouldStopOnError(err) {
return &target, err
}
target.AllOf[i] = *t
}
for i := range target.AnyOf {
t, err := expandSchema(target.AnyOf[i], parentRefs, resolver, basePath)
- if shouldStopOnError(err, resolver.options) {
+ if resolver.shouldStopOnError(err) {
return &target, err
}
target.AnyOf[i] = *t
}
for i := range target.OneOf {
t, err := expandSchema(target.OneOf[i], parentRefs, resolver, basePath)
- if shouldStopOnError(err, resolver.options) {
+ if resolver.shouldStopOnError(err) {
return &target, err
}
if t != nil {
@@ -835,7 +376,7 @@ func expandSchema(target Schema, parentRefs []string, resolver *schemaLoader, ba
}
if target.Not != nil {
t, err := expandSchema(*target.Not, parentRefs, resolver, basePath)
- if shouldStopOnError(err, resolver.options) {
+ if resolver.shouldStopOnError(err) {
return &target, err
}
if t != nil {
@@ -844,7 +385,7 @@ func expandSchema(target Schema, parentRefs []string, resolver *schemaLoader, ba
}
for k := range target.Properties {
t, err := expandSchema(target.Properties[k], parentRefs, resolver, basePath)
- if shouldStopOnError(err, resolver.options) {
+ if resolver.shouldStopOnError(err) {
return &target, err
}
if t != nil {
@@ -853,7 +394,7 @@ func expandSchema(target Schema, parentRefs []string, resolver *schemaLoader, ba
}
if target.AdditionalProperties != nil && target.AdditionalProperties.Schema != nil {
t, err := expandSchema(*target.AdditionalProperties.Schema, parentRefs, resolver, basePath)
- if shouldStopOnError(err, resolver.options) {
+ if resolver.shouldStopOnError(err) {
return &target, err
}
if t != nil {
@@ -862,7 +403,7 @@ func expandSchema(target Schema, parentRefs []string, resolver *schemaLoader, ba
}
for k := range target.PatternProperties {
t, err := expandSchema(target.PatternProperties[k], parentRefs, resolver, basePath)
- if shouldStopOnError(err, resolver.options) {
+ if resolver.shouldStopOnError(err) {
return &target, err
}
if t != nil {
@@ -872,7 +413,7 @@ func expandSchema(target Schema, parentRefs []string, resolver *schemaLoader, ba
for k := range target.Dependencies {
if target.Dependencies[k].Schema != nil {
t, err := expandSchema(*target.Dependencies[k].Schema, parentRefs, resolver, basePath)
- if shouldStopOnError(err, resolver.options) {
+ if resolver.shouldStopOnError(err) {
return &target, err
}
if t != nil {
@@ -882,7 +423,7 @@ func expandSchema(target Schema, parentRefs []string, resolver *schemaLoader, ba
}
if target.AdditionalItems != nil && target.AdditionalItems.Schema != nil {
t, err := expandSchema(*target.AdditionalItems.Schema, parentRefs, resolver, basePath)
- if shouldStopOnError(err, resolver.options) {
+ if resolver.shouldStopOnError(err) {
return &target, err
}
if t != nil {
@@ -891,7 +432,7 @@ func expandSchema(target Schema, parentRefs []string, resolver *schemaLoader, ba
}
for k := range target.Definitions {
t, err := expandSchema(target.Definitions[k], parentRefs, resolver, basePath)
- if shouldStopOnError(err, resolver.options) {
+ if resolver.shouldStopOnError(err) {
return &target, err
}
if t != nil {
@@ -901,75 +442,42 @@ func expandSchema(target Schema, parentRefs []string, resolver *schemaLoader, ba
return &target, nil
}
-func derefPathItem(pathItem *PathItem, parentRefs []string, resolver *schemaLoader, basePath string) error {
- curRef := pathItem.Ref.String()
- if curRef != "" {
- normalizedRef := normalizeFileRef(&pathItem.Ref, basePath)
- normalizedBasePath := normalizedRef.RemoteURI()
-
- if resolver.isCircular(normalizedRef, basePath, parentRefs...) {
- return nil
- }
-
- if err := resolver.Resolve(&pathItem.Ref, pathItem, basePath); shouldStopOnError(err, resolver.options) {
- return err
- }
-
- if pathItem.Ref.String() != "" && pathItem.Ref.String() != curRef && basePath != normalizedBasePath {
- parentRefs = append(parentRefs, normalizedRef.String())
- return derefPathItem(pathItem, parentRefs, resolver, normalizedBasePath)
- }
- }
-
- return nil
-}
-
func expandPathItem(pathItem *PathItem, resolver *schemaLoader, basePath string) error {
if pathItem == nil {
return nil
}
parentRefs := []string{}
- if err := derefPathItem(pathItem, parentRefs, resolver, basePath); shouldStopOnError(err, resolver.options) {
+ if err := resolver.deref(pathItem, parentRefs, basePath); resolver.shouldStopOnError(err) {
return err
}
if pathItem.Ref.String() != "" {
var err error
- resolver, err = transitiveResolver(basePath, pathItem.Ref, resolver)
- if shouldStopOnError(err, resolver.options) {
+ resolver, err = resolver.transitiveResolver(basePath, pathItem.Ref)
+ if resolver.shouldStopOnError(err) {
return err
}
}
pathItem.Ref = Ref{}
- // Currently unused:
- //parentRefs = parentRefs[0:]
-
for idx := range pathItem.Parameters {
- if err := expandParameter(&(pathItem.Parameters[idx]), resolver, basePath); shouldStopOnError(err, resolver.options) {
+ if err := expandParameterOrResponse(&(pathItem.Parameters[idx]), resolver, basePath); resolver.shouldStopOnError(err) {
return err
}
}
- if err := expandOperation(pathItem.Get, resolver, basePath); shouldStopOnError(err, resolver.options) {
- return err
+ ops := []*Operation{
+ pathItem.Get,
+ pathItem.Head,
+ pathItem.Options,
+ pathItem.Put,
+ pathItem.Post,
+ pathItem.Patch,
+ pathItem.Delete,
}
- if err := expandOperation(pathItem.Head, resolver, basePath); shouldStopOnError(err, resolver.options) {
- return err
- }
- if err := expandOperation(pathItem.Options, resolver, basePath); shouldStopOnError(err, resolver.options) {
- return err
- }
- if err := expandOperation(pathItem.Put, resolver, basePath); shouldStopOnError(err, resolver.options) {
- return err
- }
- if err := expandOperation(pathItem.Post, resolver, basePath); shouldStopOnError(err, resolver.options) {
- return err
- }
- if err := expandOperation(pathItem.Patch, resolver, basePath); shouldStopOnError(err, resolver.options) {
- return err
- }
- if err := expandOperation(pathItem.Delete, resolver, basePath); shouldStopOnError(err, resolver.options) {
- return err
+ for _, op := range ops {
+ if err := expandOperation(op, resolver, basePath); resolver.shouldStopOnError(err) {
+ return err
+ }
}
return nil
}
@@ -979,8 +487,9 @@ func expandOperation(op *Operation, resolver *schemaLoader, basePath string) err
return nil
}
- for i, param := range op.Parameters {
- if err := expandParameter(¶m, resolver, basePath); shouldStopOnError(err, resolver.options) {
+ for i := range op.Parameters {
+ param := op.Parameters[i]
+ if err := expandParameterOrResponse(¶m, resolver, basePath); resolver.shouldStopOnError(err) {
return err
}
op.Parameters[i] = param
@@ -988,11 +497,12 @@ func expandOperation(op *Operation, resolver *schemaLoader, basePath string) err
if op.Responses != nil {
responses := op.Responses
- if err := expandResponse(responses.Default, resolver, basePath); shouldStopOnError(err, resolver.options) {
+ if err := expandParameterOrResponse(responses.Default, resolver, basePath); resolver.shouldStopOnError(err) {
return err
}
- for code, response := range responses.StatusCodeResponses {
- if err := expandResponse(&response, resolver, basePath); shouldStopOnError(err, resolver.options) {
+ for code := range responses.StatusCodeResponses {
+ response := responses.StatusCodeResponses[code]
+ if err := expandParameterOrResponse(&response, resolver, basePath); resolver.shouldStopOnError(err) {
return err
}
responses.StatusCodeResponses[code] = response
@@ -1001,34 +511,6 @@ func expandOperation(op *Operation, resolver *schemaLoader, basePath string) err
return nil
}
-func transitiveResolver(basePath string, ref Ref, resolver *schemaLoader) (*schemaLoader, error) {
- if ref.IsRoot() || ref.HasFragmentOnly {
- return resolver, nil
- }
-
- baseRef, _ := NewRef(basePath)
- currentRef := normalizeFileRef(&ref, basePath)
- // Set a new root to resolve against
- if !strings.HasPrefix(currentRef.String(), baseRef.String()) {
- rootURL := currentRef.GetURL()
- rootURL.Fragment = ""
- root, _ := resolver.cache.Get(rootURL.String())
- var err error
-
- // shallow copy of resolver options to set a new RelativeBase when
- // traversing multiple documents
- newOptions := resolver.options
- newOptions.RelativeBase = rootURL.String()
- debugLog("setting new root: %s", newOptions.RelativeBase)
- resolver, err = defaultSchemaLoader(root, newOptions, resolver.cache, resolver.context)
- if err != nil {
- return nil, err
- }
- }
-
- return resolver, nil
-}
-
// ExpandResponseWithRoot expands a response based on a root document, not a fetchable document
func ExpandResponseWithRoot(response *Response, root interface{}, cache ResolutionCache) error {
opts := &ExpandOptions{
@@ -1043,7 +525,7 @@ func ExpandResponseWithRoot(response *Response, root interface{}, cache Resoluti
return err
}
- return expandResponse(response, resolver, opts.RelativeBase)
+ return expandParameterOrResponse(response, resolver, opts.RelativeBase)
}
// ExpandResponse expands a response based on a basepath
@@ -1062,70 +544,7 @@ func ExpandResponse(response *Response, basePath string) error {
return err
}
- return expandResponse(response, resolver, opts.RelativeBase)
-}
-
-func derefResponse(response *Response, parentRefs []string, resolver *schemaLoader, basePath string) error {
- curRef := response.Ref.String()
- if curRef != "" {
- /* Here the resolution scope is changed because a $ref was encountered */
- normalizedRef := normalizeFileRef(&response.Ref, basePath)
- normalizedBasePath := normalizedRef.RemoteURI()
-
- if resolver.isCircular(normalizedRef, basePath, parentRefs...) {
- return nil
- }
-
- if err := resolver.Resolve(&response.Ref, response, basePath); shouldStopOnError(err, resolver.options) {
- return err
- }
-
- if response.Ref.String() != "" && response.Ref.String() != curRef && basePath != normalizedBasePath {
- parentRefs = append(parentRefs, normalizedRef.String())
- return derefResponse(response, parentRefs, resolver, normalizedBasePath)
- }
- }
-
- return nil
-}
-
-func expandResponse(response *Response, resolver *schemaLoader, basePath string) error {
- if response == nil {
- return nil
- }
- parentRefs := []string{}
- if err := derefResponse(response, parentRefs, resolver, basePath); shouldStopOnError(err, resolver.options) {
- return err
- }
- if response.Ref.String() != "" {
- transitiveResolver, err := transitiveResolver(basePath, response.Ref, resolver)
- if shouldStopOnError(err, transitiveResolver.options) {
- return err
- }
- basePath = updateBasePath(transitiveResolver, resolver, basePath)
- resolver = transitiveResolver
- }
- if response.Schema != nil && response.Schema.Ref.String() != "" {
- // schema expanded to a $ref in another root
- var ern error
- response.Schema.Ref, ern = NewRef(normalizePaths(response.Schema.Ref.String(), response.Ref.RemoteURI()))
- if ern != nil {
- return ern
- }
- }
- response.Ref = Ref{}
-
- parentRefs = parentRefs[0:]
- if !resolver.options.SkipSchemas && response.Schema != nil {
- // parentRefs = append(parentRefs, response.Schema.Ref.String())
- s, err := expandSchema(*response.Schema, parentRefs, resolver, basePath)
- if shouldStopOnError(err, resolver.options) {
- return err
- }
- *response.Schema = *s
- }
-
- return nil
+ return expandParameterOrResponse(response, resolver, opts.RelativeBase)
}
// ExpandParameterWithRoot expands a parameter based on a root document, not a fetchable document
@@ -1142,10 +561,10 @@ func ExpandParameterWithRoot(parameter *Parameter, root interface{}, cache Resol
return err
}
- return expandParameter(parameter, resolver, opts.RelativeBase)
+ return expandParameterOrResponse(parameter, resolver, opts.RelativeBase)
}
-// ExpandParameter expands a parameter based on a basepath
+// ExpandParameter expands a parameter based on a basepath.
// This is the exported version of expandParameter
// all refs inside parameter will be resolved relative to basePath
func ExpandParameter(parameter *Parameter, basePath string) error {
@@ -1161,67 +580,71 @@ func ExpandParameter(parameter *Parameter, basePath string) error {
return err
}
- return expandParameter(parameter, resolver, opts.RelativeBase)
+ return expandParameterOrResponse(parameter, resolver, opts.RelativeBase)
}
-func derefParameter(parameter *Parameter, parentRefs []string, resolver *schemaLoader, basePath string) error {
- curRef := parameter.Ref.String()
- if curRef != "" {
- normalizedRef := normalizeFileRef(¶meter.Ref, basePath)
- normalizedBasePath := normalizedRef.RemoteURI()
-
- if resolver.isCircular(normalizedRef, basePath, parentRefs...) {
- return nil
- }
-
- if err := resolver.Resolve(¶meter.Ref, parameter, basePath); shouldStopOnError(err, resolver.options) {
- return err
+func getRefAndSchema(input interface{}) (*Ref, *Schema, error) {
+ var ref *Ref
+ var sch *Schema
+ switch refable := input.(type) {
+ case *Parameter:
+ if refable == nil {
+ return nil, nil, nil
}
-
- if parameter.Ref.String() != "" && parameter.Ref.String() != curRef && basePath != normalizedBasePath {
- parentRefs = append(parentRefs, normalizedRef.String())
- return derefParameter(parameter, parentRefs, resolver, normalizedBasePath)
+ ref = &refable.Ref
+ sch = refable.Schema
+ case *Response:
+ if refable == nil {
+ return nil, nil, nil
}
+ ref = &refable.Ref
+ sch = refable.Schema
+ default:
+ return nil, nil, fmt.Errorf("expand: unsupported type %T. Input should be of type *Parameter or *Response", input)
}
-
- return nil
+ return ref, sch, nil
}
-func expandParameter(parameter *Parameter, resolver *schemaLoader, basePath string) error {
- if parameter == nil {
+func expandParameterOrResponse(input interface{}, resolver *schemaLoader, basePath string) error {
+ ref, _, err := getRefAndSchema(input)
+ if err != nil {
+ return err
+ }
+ if ref == nil {
return nil
}
-
parentRefs := []string{}
- if err := derefParameter(parameter, parentRefs, resolver, basePath); shouldStopOnError(err, resolver.options) {
+ if err := resolver.deref(input, parentRefs, basePath); resolver.shouldStopOnError(err) {
return err
}
- if parameter.Ref.String() != "" {
- transitiveResolver, err := transitiveResolver(basePath, parameter.Ref, resolver)
- if shouldStopOnError(err, transitiveResolver.options) {
+ ref, sch, _ := getRefAndSchema(input)
+ if ref.String() != "" {
+ transitiveResolver, err := resolver.transitiveResolver(basePath, *ref)
+ if transitiveResolver.shouldStopOnError(err) {
return err
}
- basePath = updateBasePath(transitiveResolver, resolver, basePath)
+ basePath = resolver.updateBasePath(transitiveResolver, basePath)
resolver = transitiveResolver
}
- if parameter.Schema != nil && parameter.Schema.Ref.String() != "" {
+ if sch != nil && sch.Ref.String() != "" {
// schema expanded to a $ref in another root
var ern error
- parameter.Schema.Ref, ern = NewRef(normalizePaths(parameter.Schema.Ref.String(), parameter.Ref.RemoteURI()))
+ sch.Ref, ern = NewRef(normalizePaths(sch.Ref.String(), ref.RemoteURI()))
if ern != nil {
return ern
}
}
- parameter.Ref = Ref{}
+ if ref != nil {
+ *ref = Ref{}
+ }
- parentRefs = parentRefs[0:]
- if !resolver.options.SkipSchemas && parameter.Schema != nil {
- s, err := expandSchema(*parameter.Schema, parentRefs, resolver, basePath)
- if shouldStopOnError(err, resolver.options) {
+ if !resolver.options.SkipSchemas && sch != nil {
+ s, err := expandSchema(*sch, parentRefs, resolver, basePath)
+ if resolver.shouldStopOnError(err) {
return err
}
- *parameter.Schema = *s
+ *sch = *s
}
return nil
}
diff --git a/vendor/github.com/go-openapi/spec/header.go b/vendor/github.com/go-openapi/spec/header.go
index 82f77f77..39efe452 100644
--- a/vendor/github.com/go-openapi/spec/header.go
+++ b/vendor/github.com/go-openapi/spec/header.go
@@ -22,6 +22,10 @@ import (
"github.com/go-openapi/swag"
)
+const (
+ jsonArray = "array"
+)
+
// HeaderProps describes a response header
type HeaderProps struct {
Description string `json:"description,omitempty"`
@@ -57,7 +61,7 @@ func (h *Header) Typed(tpe, format string) *Header {
// CollectionOf a fluent builder method for an array item
func (h *Header) CollectionOf(items *Items, format string) *Header {
- h.Type = "array"
+ h.Type = jsonArray
h.Items = items
h.CollectionFormat = format
return h
diff --git a/vendor/github.com/go-openapi/spec/info.go b/vendor/github.com/go-openapi/spec/info.go
index cfb37ec1..c458b49b 100644
--- a/vendor/github.com/go-openapi/spec/info.go
+++ b/vendor/github.com/go-openapi/spec/info.go
@@ -161,8 +161,5 @@ func (i *Info) UnmarshalJSON(data []byte) error {
if err := json.Unmarshal(data, &i.InfoProps); err != nil {
return err
}
- if err := json.Unmarshal(data, &i.VendorExtensible); err != nil {
- return err
- }
- return nil
+ return json.Unmarshal(data, &i.VendorExtensible)
}
diff --git a/vendor/github.com/go-openapi/spec/items.go b/vendor/github.com/go-openapi/spec/items.go
index cf429897..78389317 100644
--- a/vendor/github.com/go-openapi/spec/items.go
+++ b/vendor/github.com/go-openapi/spec/items.go
@@ -22,6 +22,10 @@ import (
"github.com/go-openapi/swag"
)
+const (
+ jsonRef = "$ref"
+)
+
// SimpleSchema describe swagger simple schemas for parameters and headers
type SimpleSchema struct {
Type string `json:"type,omitempty"`
@@ -89,7 +93,7 @@ func (i *Items) Typed(tpe, format string) *Items {
// CollectionOf a fluent builder method for an array item
func (i *Items) CollectionOf(items *Items, format string) *Items {
- i.Type = "array"
+ i.Type = jsonArray
i.Items = items
i.CollectionFormat = format
return i
@@ -217,7 +221,7 @@ func (i Items) MarshalJSON() ([]byte, error) {
// JSONLookup look up a value by the json property name
func (i Items) JSONLookup(token string) (interface{}, error) {
- if token == "$ref" {
+ if token == jsonRef {
return &i.Ref, nil
}
diff --git a/vendor/github.com/go-openapi/spec/normalizer.go b/vendor/github.com/go-openapi/spec/normalizer.go
new file mode 100644
index 00000000..b8957e7c
--- /dev/null
+++ b/vendor/github.com/go-openapi/spec/normalizer.go
@@ -0,0 +1,152 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package spec
+
+import (
+ "fmt"
+ "net/url"
+ "os"
+ "path"
+ "path/filepath"
+ "strings"
+)
+
+// normalize absolute path for cache.
+// on Windows, drive letters should be converted to lower as scheme in net/url.URL
+func normalizeAbsPath(path string) string {
+ u, err := url.Parse(path)
+ if err != nil {
+ debugLog("normalize absolute path failed: %s", err)
+ return path
+ }
+ return u.String()
+}
+
+// base or refPath could be a file path or a URL
+// given a base absolute path and a ref path, return the absolute path of refPath
+// 1) if refPath is absolute, return it
+// 2) if refPath is relative, join it with basePath keeping the scheme, hosts, and ports if exists
+// base could be a directory or a full file path
+func normalizePaths(refPath, base string) string {
+ refURL, _ := url.Parse(refPath)
+ if path.IsAbs(refURL.Path) || filepath.IsAbs(refPath) {
+ // refPath is actually absolute
+ if refURL.Host != "" {
+ return refPath
+ }
+ parts := strings.Split(refPath, "#")
+ result := filepath.FromSlash(parts[0])
+ if len(parts) == 2 {
+ result += "#" + parts[1]
+ }
+ return result
+ }
+
+ // relative refPath
+ baseURL, _ := url.Parse(base)
+ if !strings.HasPrefix(refPath, "#") {
+ // combining paths
+ if baseURL.Host != "" {
+ baseURL.Path = path.Join(path.Dir(baseURL.Path), refURL.Path)
+ } else { // base is a file
+ newBase := fmt.Sprintf("%s#%s", filepath.Join(filepath.Dir(base), filepath.FromSlash(refURL.Path)), refURL.Fragment)
+ return newBase
+ }
+
+ }
+ // copying fragment from ref to base
+ baseURL.Fragment = refURL.Fragment
+ return baseURL.String()
+}
+
+// denormalizePaths returns to simplest notation on file $ref,
+// i.e. strips the absolute path and sets a path relative to the base path.
+//
+// This is currently used when we rewrite ref after a circular ref has been detected
+func denormalizeFileRef(ref *Ref, relativeBase, originalRelativeBase string) *Ref {
+ debugLog("denormalizeFileRef for: %s", ref.String())
+
+ if ref.String() == "" || ref.IsRoot() || ref.HasFragmentOnly {
+ return ref
+ }
+ // strip relativeBase from URI
+ relativeBaseURL, _ := url.Parse(relativeBase)
+ relativeBaseURL.Fragment = ""
+
+ if relativeBaseURL.IsAbs() && strings.HasPrefix(ref.String(), relativeBase) {
+ // this should work for absolute URI (e.g. http://...): we have an exact match, just trim prefix
+ r, _ := NewRef(strings.TrimPrefix(ref.String(), relativeBase))
+ return &r
+ }
+
+ if relativeBaseURL.IsAbs() {
+ // other absolute URL get unchanged (i.e. with a non-empty scheme)
+ return ref
+ }
+
+ // for relative file URIs:
+ originalRelativeBaseURL, _ := url.Parse(originalRelativeBase)
+ originalRelativeBaseURL.Fragment = ""
+ if strings.HasPrefix(ref.String(), originalRelativeBaseURL.String()) {
+ // the resulting ref is in the expanded spec: return a local ref
+ r, _ := NewRef(strings.TrimPrefix(ref.String(), originalRelativeBaseURL.String()))
+ return &r
+ }
+
+ // check if we may set a relative path, considering the original base path for this spec.
+ // Example:
+ // spec is located at /mypath/spec.json
+ // my normalized ref points to: /mypath/item.json#/target
+ // expected result: item.json#/target
+ parts := strings.Split(ref.String(), "#")
+ relativePath, err := filepath.Rel(path.Dir(originalRelativeBaseURL.String()), parts[0])
+ if err != nil {
+ // there is no common ancestor (e.g. different drives on windows)
+ // leaves the ref unchanged
+ return ref
+ }
+ if len(parts) == 2 {
+ relativePath += "#" + parts[1]
+ }
+ r, _ := NewRef(relativePath)
+ return &r
+}
+
+// relativeBase could be an ABSOLUTE file path or an ABSOLUTE URL
+func normalizeFileRef(ref *Ref, relativeBase string) *Ref {
+ // This is important for when the reference is pointing to the root schema
+ if ref.String() == "" {
+ r, _ := NewRef(relativeBase)
+ return &r
+ }
+
+ debugLog("normalizing %s against %s", ref.String(), relativeBase)
+
+ s := normalizePaths(ref.String(), relativeBase)
+ r, _ := NewRef(s)
+ return &r
+}
+
+// absPath returns the absolute path of a file
+func absPath(fname string) (string, error) {
+ if strings.HasPrefix(fname, "http") {
+ return fname, nil
+ }
+ if filepath.IsAbs(fname) {
+ return fname, nil
+ }
+ wd, err := os.Getwd()
+ return filepath.Join(wd, fname), err
+}
diff --git a/vendor/github.com/go-openapi/spec/operation.go b/vendor/github.com/go-openapi/spec/operation.go
index 344e3177..b1ebd599 100644
--- a/vendor/github.com/go-openapi/spec/operation.go
+++ b/vendor/github.com/go-openapi/spec/operation.go
@@ -18,6 +18,7 @@ import (
"bytes"
"encoding/gob"
"encoding/json"
+ "sort"
"github.com/go-openapi/jsonpointer"
"github.com/go-openapi/swag"
@@ -30,17 +31,21 @@ func init() {
}
// OperationProps describes an operation
+//
+// NOTES:
+// - schemes, when present must be from [http, https, ws, wss]: see validate
+// - Security is handled as a special case: see MarshalJSON function
type OperationProps struct {
Description string `json:"description,omitempty"`
Consumes []string `json:"consumes,omitempty"`
Produces []string `json:"produces,omitempty"`
- Schemes []string `json:"schemes,omitempty"` // the scheme, when present must be from [http, https, ws, wss]
+ Schemes []string `json:"schemes,omitempty"`
Tags []string `json:"tags,omitempty"`
Summary string `json:"summary,omitempty"`
ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"`
ID string `json:"operationId,omitempty"`
Deprecated bool `json:"deprecated,omitempty"`
- Security []map[string][]string `json:"security,omitempty"` //Special case, see MarshalJSON function
+ Security []map[string][]string `json:"security,omitempty"`
Parameters []Parameter `json:"parameters,omitempty"`
Responses *Responses `json:"responses,omitempty"`
}
@@ -84,11 +89,17 @@ func (o *Operation) SuccessResponse() (*Response, int, bool) {
return nil, 0, false
}
- for k, v := range o.Responses.StatusCodeResponses {
- if k/100 == 2 {
- return &v, k, true
+ responseCodes := make([]int, 0, len(o.Responses.StatusCodeResponses))
+ for k := range o.Responses.StatusCodeResponses {
+ if k >= 200 && k < 300 {
+ responseCodes = append(responseCodes, k)
}
}
+ if len(responseCodes) > 0 {
+ sort.Ints(responseCodes)
+ v := o.Responses.StatusCodeResponses[responseCodes[0]]
+ return &v, responseCodes[0], true
+ }
return o.Responses.Default, 0, false
}
@@ -107,10 +118,7 @@ func (o *Operation) UnmarshalJSON(data []byte) error {
if err := json.Unmarshal(data, &o.OperationProps); err != nil {
return err
}
- if err := json.Unmarshal(data, &o.VendorExtensible); err != nil {
- return err
- }
- return nil
+ return json.Unmarshal(data, &o.VendorExtensible)
}
// MarshalJSON converts this items object to JSON
@@ -224,7 +232,7 @@ func (o *Operation) AddParam(param *Parameter) *Operation {
// RemoveParam removes a parameter from the operation
func (o *Operation) RemoveParam(name, in string) *Operation {
for i, p := range o.Parameters {
- if p.Name == name && p.In == name {
+ if p.Name == name && p.In == in {
o.Parameters = append(o.Parameters[:i], o.Parameters[i+1:]...)
return o
}
diff --git a/vendor/github.com/go-openapi/spec/parameter.go b/vendor/github.com/go-openapi/spec/parameter.go
index cb1a88d2..cecdff54 100644
--- a/vendor/github.com/go-openapi/spec/parameter.go
+++ b/vendor/github.com/go-openapi/spec/parameter.go
@@ -39,7 +39,8 @@ func PathParam(name string) *Parameter {
// BodyParam creates a body parameter
func BodyParam(name string, schema *Schema) *Parameter {
- return &Parameter{ParamProps: ParamProps{Name: name, In: "body", Schema: schema}, SimpleSchema: SimpleSchema{Type: "object"}}
+ return &Parameter{ParamProps: ParamProps{Name: name, In: "body", Schema: schema},
+ SimpleSchema: SimpleSchema{Type: "object"}}
}
// FormDataParam creates a body parameter
@@ -49,12 +50,15 @@ func FormDataParam(name string) *Parameter {
// FileParam creates a body parameter
func FileParam(name string) *Parameter {
- return &Parameter{ParamProps: ParamProps{Name: name, In: "formData"}, SimpleSchema: SimpleSchema{Type: "file"}}
+ return &Parameter{ParamProps: ParamProps{Name: name, In: "formData"},
+ SimpleSchema: SimpleSchema{Type: "file"}}
}
// SimpleArrayParam creates a param for a simple array (string, int, date etc)
func SimpleArrayParam(name, tpe, fmt string) *Parameter {
- return &Parameter{ParamProps: ParamProps{Name: name}, SimpleSchema: SimpleSchema{Type: "array", CollectionFormat: "csv", Items: &Items{SimpleSchema: SimpleSchema{Type: "string", Format: fmt}}}}
+ return &Parameter{ParamProps: ParamProps{Name: name},
+ SimpleSchema: SimpleSchema{Type: jsonArray, CollectionFormat: "csv",
+ Items: &Items{SimpleSchema: SimpleSchema{Type: "string", Format: fmt}}}}
}
// ParamRef creates a parameter that's a json reference
@@ -65,25 +69,43 @@ func ParamRef(uri string) *Parameter {
}
// ParamProps describes the specific attributes of an operation parameter
+//
+// NOTE:
+// - Schema is defined when "in" == "body": see validate
+// - AllowEmptyValue is allowed where "in" == "query" || "formData"
type ParamProps struct {
Description string `json:"description,omitempty"`
Name string `json:"name,omitempty"`
In string `json:"in,omitempty"`
Required bool `json:"required,omitempty"`
- Schema *Schema `json:"schema,omitempty"` // when in == "body"
- AllowEmptyValue bool `json:"allowEmptyValue,omitempty"` // when in == "query" || "formData"
+ Schema *Schema `json:"schema,omitempty"`
+ AllowEmptyValue bool `json:"allowEmptyValue,omitempty"`
}
// Parameter a unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn).
//
// There are five possible parameter types.
-// * Path - Used together with [Path Templating](#pathTemplating), where the parameter value is actually part of the operation's URL. This does not include the host or base path of the API. For example, in `/items/{itemId}`, the path parameter is `itemId`.
+// * Path - Used together with [Path Templating](#pathTemplating), where the parameter value is actually part
+// of the operation's URL. This does not include the host or base path of the API. For example, in `/items/{itemId}`,
+// the path parameter is `itemId`.
// * Query - Parameters that are appended to the URL. For example, in `/items?id=###`, the query parameter is `id`.
// * Header - Custom headers that are expected as part of the request.
-// * Body - The payload that's appended to the HTTP request. Since there can only be one payload, there can only be *one* body parameter. The name of the body parameter has no effect on the parameter itself and is used for documentation purposes only. Since Form parameters are also in the payload, body and form parameters cannot exist together for the same operation.
-// * Form - Used to describe the payload of an HTTP request when either `application/x-www-form-urlencoded` or `multipart/form-data` are used as the content type of the request (in Swagger's definition, the [`consumes`](#operationConsumes) property of an operation). This is the only parameter type that can be used to send files, thus supporting the `file` type. Since form parameters are sent in the payload, they cannot be declared together with a body parameter for the same operation. Form parameters have a different format based on the content-type used (for further details, consult http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4):
-// * `application/x-www-form-urlencoded` - Similar to the format of Query parameters but as a payload. For example, `foo=1&bar=swagger` - both `foo` and `bar` are form parameters. This is normally used for simple parameters that are being transferred.
-// * `multipart/form-data` - each parameter takes a section in the payload with an internal header. For example, for the header `Content-Disposition: form-data; name="submit-name"` the name of the parameter is `submit-name`. This type of form parameters is more commonly used for file transfers.
+// * Body - The payload that's appended to the HTTP request. Since there can only be one payload, there can only be
+// _one_ body parameter. The name of the body parameter has no effect on the parameter itself and is used for
+// documentation purposes only. Since Form parameters are also in the payload, body and form parameters cannot exist
+// together for the same operation.
+// * Form - Used to describe the payload of an HTTP request when either `application/x-www-form-urlencoded` or
+// `multipart/form-data` are used as the content type of the request (in Swagger's definition,
+// the [`consumes`](#operationConsumes) property of an operation). This is the only parameter type that can be used
+// to send files, thus supporting the `file` type. Since form parameters are sent in the payload, they cannot be
+// declared together with a body parameter for the same operation. Form parameters have a different format based on
+// the content-type used (for further details, consult http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4).
+// * `application/x-www-form-urlencoded` - Similar to the format of Query parameters but as a payload.
+// For example, `foo=1&bar=swagger` - both `foo` and `bar` are form parameters. This is normally used for simple
+// parameters that are being transferred.
+// * `multipart/form-data` - each parameter takes a section in the payload with an internal header.
+// For example, for the header `Content-Disposition: form-data; name="submit-name"` the name of the parameter is
+// `submit-name`. This type of form parameters is more commonly used for file transfers.
//
// For more information: http://goo.gl/8us55a#parameterObject
type Parameter struct {
@@ -99,7 +121,7 @@ func (p Parameter) JSONLookup(token string) (interface{}, error) {
if ex, ok := p.Extensions[token]; ok {
return &ex, nil
}
- if token == "$ref" {
+ if token == jsonRef {
return &p.Ref, nil
}
@@ -148,7 +170,7 @@ func (p *Parameter) Typed(tpe, format string) *Parameter {
// CollectionOf a fluent builder method for an array parameter
func (p *Parameter) CollectionOf(items *Items, format string) *Parameter {
- p.Type = "array"
+ p.Type = jsonArray
p.Items = items
p.CollectionFormat = format
return p
@@ -270,10 +292,7 @@ func (p *Parameter) UnmarshalJSON(data []byte) error {
if err := json.Unmarshal(data, &p.VendorExtensible); err != nil {
return err
}
- if err := json.Unmarshal(data, &p.ParamProps); err != nil {
- return err
- }
- return nil
+ return json.Unmarshal(data, &p.ParamProps)
}
// MarshalJSON converts this items object to JSON
diff --git a/vendor/github.com/go-openapi/spec/path_item.go b/vendor/github.com/go-openapi/spec/path_item.go
index a8ae63ec..68fc8e90 100644
--- a/vendor/github.com/go-openapi/spec/path_item.go
+++ b/vendor/github.com/go-openapi/spec/path_item.go
@@ -50,7 +50,7 @@ func (p PathItem) JSONLookup(token string) (interface{}, error) {
if ex, ok := p.Extensions[token]; ok {
return &ex, nil
}
- if token == "$ref" {
+ if token == jsonRef {
return &p.Ref, nil
}
r, _, err := jsonpointer.GetForToken(p.PathItemProps, token)
@@ -65,10 +65,7 @@ func (p *PathItem) UnmarshalJSON(data []byte) error {
if err := json.Unmarshal(data, &p.VendorExtensible); err != nil {
return err
}
- if err := json.Unmarshal(data, &p.PathItemProps); err != nil {
- return err
- }
- return nil
+ return json.Unmarshal(data, &p.PathItemProps)
}
// MarshalJSON converts this items object to JSON
diff --git a/vendor/github.com/go-openapi/spec/response.go b/vendor/github.com/go-openapi/spec/response.go
index 586db0d7..27729c1d 100644
--- a/vendor/github.com/go-openapi/spec/response.go
+++ b/vendor/github.com/go-openapi/spec/response.go
@@ -58,10 +58,7 @@ func (r *Response) UnmarshalJSON(data []byte) error {
if err := json.Unmarshal(data, &r.Refable); err != nil {
return err
}
- if err := json.Unmarshal(data, &r.VendorExtensible); err != nil {
- return err
- }
- return nil
+ return json.Unmarshal(data, &r.VendorExtensible)
}
// MarshalJSON converts this items object to JSON
diff --git a/vendor/github.com/go-openapi/spec/schema.go b/vendor/github.com/go-openapi/spec/schema.go
index b9481e29..ce30d26e 100644
--- a/vendor/github.com/go-openapi/spec/schema.go
+++ b/vendor/github.com/go-openapi/spec/schema.go
@@ -89,7 +89,8 @@ func DateTimeProperty() *Schema {
// MapProperty creates a map property
func MapProperty(property *Schema) *Schema {
- return &Schema{SchemaProps: SchemaProps{Type: []string{"object"}, AdditionalProperties: &SchemaOrBool{Allows: true, Schema: property}}}
+ return &Schema{SchemaProps: SchemaProps{Type: []string{"object"},
+ AdditionalProperties: &SchemaOrBool{Allows: true, Schema: property}}}
}
// RefProperty creates a ref property
@@ -155,54 +156,6 @@ func (r *SchemaURL) fromMap(v map[string]interface{}) error {
return nil
}
-// type ExtraSchemaProps map[string]interface{}
-
-// // JSONSchema represents a structure that is a json schema draft 04
-// type JSONSchema struct {
-// SchemaProps
-// ExtraSchemaProps
-// }
-
-// // MarshalJSON marshal this to JSON
-// func (s JSONSchema) MarshalJSON() ([]byte, error) {
-// b1, err := json.Marshal(s.SchemaProps)
-// if err != nil {
-// return nil, err
-// }
-// b2, err := s.Ref.MarshalJSON()
-// if err != nil {
-// return nil, err
-// }
-// b3, err := s.Schema.MarshalJSON()
-// if err != nil {
-// return nil, err
-// }
-// b4, err := json.Marshal(s.ExtraSchemaProps)
-// if err != nil {
-// return nil, err
-// }
-// return swag.ConcatJSON(b1, b2, b3, b4), nil
-// }
-
-// // UnmarshalJSON marshal this from JSON
-// func (s *JSONSchema) UnmarshalJSON(data []byte) error {
-// var sch JSONSchema
-// if err := json.Unmarshal(data, &sch.SchemaProps); err != nil {
-// return err
-// }
-// if err := json.Unmarshal(data, &sch.Ref); err != nil {
-// return err
-// }
-// if err := json.Unmarshal(data, &sch.Schema); err != nil {
-// return err
-// }
-// if err := json.Unmarshal(data, &sch.ExtraSchemaProps); err != nil {
-// return err
-// }
-// *s = sch
-// return nil
-// }
-
// SchemaProps describes a JSON schema (draft 4)
type SchemaProps struct {
ID string `json:"id,omitempty"`
@@ -351,7 +304,7 @@ func (s *Schema) AddType(tpe, format string) *Schema {
// CollectionOf a fluent builder method for an array parameter
func (s *Schema) CollectionOf(items Schema) *Schema {
- s.Type = []string{"array"}
+ s.Type = []string{jsonArray}
s.Items = &SchemaOrArray{Schema: &items}
return s
}
diff --git a/vendor/github.com/go-openapi/spec/schema_loader.go b/vendor/github.com/go-openapi/spec/schema_loader.go
new file mode 100644
index 00000000..c34a96fa
--- /dev/null
+++ b/vendor/github.com/go-openapi/spec/schema_loader.go
@@ -0,0 +1,275 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package spec
+
+import (
+ "encoding/json"
+ "fmt"
+ "log"
+ "net/url"
+ "reflect"
+ "strings"
+
+ "github.com/go-openapi/swag"
+)
+
+// PathLoader function to use when loading remote refs
+var PathLoader func(string) (json.RawMessage, error)
+
+func init() {
+ PathLoader = func(path string) (json.RawMessage, error) {
+ data, err := swag.LoadFromFileOrHTTP(path)
+ if err != nil {
+ return nil, err
+ }
+ return json.RawMessage(data), nil
+ }
+}
+
+// resolverContext allows to share a context during spec processing.
+// At the moment, it just holds the index of circular references found.
+type resolverContext struct {
+ // circulars holds all visited circular references, which allows shortcuts.
+ // NOTE: this is not just a performance improvement: it is required to figure out
+ // circular references which participate several cycles.
+ // This structure is privately instantiated and needs not be locked against
+ // concurrent access, unless we chose to implement a parallel spec walking.
+ circulars map[string]bool
+ basePath string
+}
+
+func newResolverContext(originalBasePath string) *resolverContext {
+ return &resolverContext{
+ circulars: make(map[string]bool),
+ basePath: originalBasePath, // keep the root base path in context
+ }
+}
+
+type schemaLoader struct {
+ root interface{}
+ options *ExpandOptions
+ cache ResolutionCache
+ context *resolverContext
+ loadDoc func(string) (json.RawMessage, error)
+}
+
+func (r *schemaLoader) transitiveResolver(basePath string, ref Ref) (*schemaLoader, error) {
+ if ref.IsRoot() || ref.HasFragmentOnly {
+ return r, nil
+ }
+
+ baseRef, _ := NewRef(basePath)
+ currentRef := normalizeFileRef(&ref, basePath)
+ if strings.HasPrefix(currentRef.String(), baseRef.String()) {
+ return r, nil
+ }
+
+ // Set a new root to resolve against
+ rootURL := currentRef.GetURL()
+ rootURL.Fragment = ""
+ root, _ := r.cache.Get(rootURL.String())
+
+ // shallow copy of resolver options to set a new RelativeBase when
+ // traversing multiple documents
+ newOptions := r.options
+ newOptions.RelativeBase = rootURL.String()
+ debugLog("setting new root: %s", newOptions.RelativeBase)
+ resolver, err := defaultSchemaLoader(root, newOptions, r.cache, r.context)
+ if err != nil {
+ return nil, err
+ }
+
+ return resolver, nil
+}
+
+func (r *schemaLoader) updateBasePath(transitive *schemaLoader, basePath string) string {
+ if transitive != r {
+ debugLog("got a new resolver")
+ if transitive.options != nil && transitive.options.RelativeBase != "" {
+ basePath, _ = absPath(transitive.options.RelativeBase)
+ debugLog("new basePath = %s", basePath)
+ }
+ }
+ return basePath
+}
+
+func (r *schemaLoader) resolveRef(ref *Ref, target interface{}, basePath string) error {
+ tgt := reflect.ValueOf(target)
+ if tgt.Kind() != reflect.Ptr {
+ return fmt.Errorf("resolve ref: target needs to be a pointer")
+ }
+
+ refURL := ref.GetURL()
+ if refURL == nil {
+ return nil
+ }
+
+ var res interface{}
+ var data interface{}
+ var err error
+ // Resolve against the root if it isn't nil, and if ref is pointing at the root, or has a fragment only which means
+ // it is pointing somewhere in the root.
+ root := r.root
+ if (ref.IsRoot() || ref.HasFragmentOnly) && root == nil && basePath != "" {
+ if baseRef, erb := NewRef(basePath); erb == nil {
+ root, _, _, _ = r.load(baseRef.GetURL())
+ }
+ }
+ if (ref.IsRoot() || ref.HasFragmentOnly) && root != nil {
+ data = root
+ } else {
+ baseRef := normalizeFileRef(ref, basePath)
+ debugLog("current ref is: %s", ref.String())
+ debugLog("current ref normalized file: %s", baseRef.String())
+ data, _, _, err = r.load(baseRef.GetURL())
+ if err != nil {
+ return err
+ }
+ }
+
+ res = data
+ if ref.String() != "" {
+ res, _, err = ref.GetPointer().Get(data)
+ if err != nil {
+ return err
+ }
+ }
+ return swag.DynamicJSONToStruct(res, target)
+}
+
+func (r *schemaLoader) load(refURL *url.URL) (interface{}, url.URL, bool, error) {
+ debugLog("loading schema from url: %s", refURL)
+ toFetch := *refURL
+ toFetch.Fragment = ""
+
+ normalized := normalizeAbsPath(toFetch.String())
+
+ data, fromCache := r.cache.Get(normalized)
+ if !fromCache {
+ b, err := r.loadDoc(normalized)
+ if err != nil {
+ return nil, url.URL{}, false, err
+ }
+
+ if err := json.Unmarshal(b, &data); err != nil {
+ return nil, url.URL{}, false, err
+ }
+ r.cache.Set(normalized, data)
+ }
+
+ return data, toFetch, fromCache, nil
+}
+
+// isCircular detects cycles in sequences of $ref.
+// It relies on a private context (which needs not be locked).
+func (r *schemaLoader) isCircular(ref *Ref, basePath string, parentRefs ...string) (foundCycle bool) {
+ normalizedRef := normalizePaths(ref.String(), basePath)
+ if _, ok := r.context.circulars[normalizedRef]; ok {
+ // circular $ref has been already detected in another explored cycle
+ foundCycle = true
+ return
+ }
+ foundCycle = swag.ContainsStringsCI(parentRefs, normalizedRef)
+ if foundCycle {
+ r.context.circulars[normalizedRef] = true
+ }
+ return
+}
+
+// Resolve resolves a reference against basePath and stores the result in target
+// Resolve is not in charge of following references, it only resolves ref by following its URL
+// if the schema that ref is referring to has more refs in it. Resolve doesn't resolve them
+// if basePath is an empty string, ref is resolved against the root schema stored in the schemaLoader struct
+func (r *schemaLoader) Resolve(ref *Ref, target interface{}, basePath string) error {
+ return r.resolveRef(ref, target, basePath)
+}
+
+func (r *schemaLoader) deref(input interface{}, parentRefs []string, basePath string) error {
+ var ref *Ref
+ switch refable := input.(type) {
+ case *Schema:
+ ref = &refable.Ref
+ case *Parameter:
+ ref = &refable.Ref
+ case *Response:
+ ref = &refable.Ref
+ case *PathItem:
+ ref = &refable.Ref
+ default:
+ return fmt.Errorf("deref: unsupported type %T", input)
+ }
+
+ curRef := ref.String()
+ if curRef != "" {
+ normalizedRef := normalizeFileRef(ref, basePath)
+ normalizedBasePath := normalizedRef.RemoteURI()
+
+ if r.isCircular(normalizedRef, basePath, parentRefs...) {
+ return nil
+ }
+
+ if err := r.resolveRef(ref, input, basePath); r.shouldStopOnError(err) {
+ return err
+ }
+
+ // NOTE(fredbi): removed basePath check => needs more testing
+ if ref.String() != "" && ref.String() != curRef {
+ parentRefs = append(parentRefs, normalizedRef.String())
+ return r.deref(input, parentRefs, normalizedBasePath)
+ }
+ }
+
+ return nil
+}
+
+func (r *schemaLoader) shouldStopOnError(err error) bool {
+ if err != nil && !r.options.ContinueOnError {
+ return true
+ }
+
+ if err != nil {
+ log.Println(err)
+ }
+
+ return false
+}
+
+func defaultSchemaLoader(
+ root interface{},
+ expandOptions *ExpandOptions,
+ cache ResolutionCache,
+ context *resolverContext) (*schemaLoader, error) {
+
+ if cache == nil {
+ cache = resCache
+ }
+ if expandOptions == nil {
+ expandOptions = &ExpandOptions{}
+ }
+ absBase, _ := absPath(expandOptions.RelativeBase)
+ if context == nil {
+ context = newResolverContext(absBase)
+ }
+ return &schemaLoader{
+ root: root,
+ options: expandOptions,
+ cache: cache,
+ context: context,
+ loadDoc: func(path string) (json.RawMessage, error) {
+ debugLog("fetching document at %q", path)
+ return PathLoader(path)
+ },
+ }, nil
+}
diff --git a/vendor/github.com/go-openapi/spec/security_scheme.go b/vendor/github.com/go-openapi/spec/security_scheme.go
index 9f1b454e..fe353842 100644
--- a/vendor/github.com/go-openapi/spec/security_scheme.go
+++ b/vendor/github.com/go-openapi/spec/security_scheme.go
@@ -136,8 +136,5 @@ func (s *SecurityScheme) UnmarshalJSON(data []byte) error {
if err := json.Unmarshal(data, &s.SecuritySchemeProps); err != nil {
return err
}
- if err := json.Unmarshal(data, &s.VendorExtensible); err != nil {
- return err
- }
- return nil
+ return json.Unmarshal(data, &s.VendorExtensible)
}
diff --git a/vendor/github.com/go-openapi/spec/swagger.go b/vendor/github.com/go-openapi/spec/swagger.go
index 4586a21c..454617e5 100644
--- a/vendor/github.com/go-openapi/spec/swagger.go
+++ b/vendor/github.com/go-openapi/spec/swagger.go
@@ -24,7 +24,8 @@ import (
)
// Swagger this is the root document object for the API specification.
-// It combines what previously was the Resource Listing and API Declaration (version 1.2 and earlier) together into one document.
+// It combines what previously was the Resource Listing and API Declaration (version 1.2 and earlier)
+// together into one document.
//
// For more information: http://goo.gl/8us55a#swagger-object-
type Swagger struct {
@@ -68,16 +69,21 @@ func (s *Swagger) UnmarshalJSON(data []byte) error {
}
// SwaggerProps captures the top-level properties of an Api specification
+//
+// NOTE: validation rules
+// - the scheme, when present must be from [http, https, ws, wss]
+// - BasePath must start with a leading "/"
+// - Paths is required
type SwaggerProps struct {
ID string `json:"id,omitempty"`
Consumes []string `json:"consumes,omitempty"`
Produces []string `json:"produces,omitempty"`
- Schemes []string `json:"schemes,omitempty"` // the scheme, when present must be from [http, https, ws, wss]
+ Schemes []string `json:"schemes,omitempty"`
Swagger string `json:"swagger,omitempty"`
Info *Info `json:"info,omitempty"`
Host string `json:"host,omitempty"`
- BasePath string `json:"basePath,omitempty"` // must start with a leading "/"
- Paths *Paths `json:"paths"` // required
+ BasePath string `json:"basePath,omitempty"`
+ Paths *Paths `json:"paths"`
Definitions Definitions `json:"definitions,omitempty"`
Parameters map[string]Parameter `json:"parameters,omitempty"`
Responses map[string]Response `json:"responses,omitempty"`
@@ -244,9 +250,9 @@ func (s *StringOrArray) UnmarshalJSON(data []byte) error {
if single == nil {
return nil
}
- switch single.(type) {
+ switch v := single.(type) {
case string:
- *s = StringOrArray([]string{single.(string)})
+ *s = StringOrArray([]string{v})
return nil
default:
return fmt.Errorf("only string or array is allowed, not %T", single)
diff --git a/vendor/github.com/go-openapi/spec/tag.go b/vendor/github.com/go-openapi/spec/tag.go
index 25256c4b..faa3d3de 100644
--- a/vendor/github.com/go-openapi/spec/tag.go
+++ b/vendor/github.com/go-openapi/spec/tag.go
@@ -30,10 +30,11 @@ type TagProps struct {
// NewTag creates a new tag
func NewTag(name, description string, externalDocs *ExternalDocumentation) Tag {
- return Tag{TagProps: TagProps{description, name, externalDocs}}
+ return Tag{TagProps: TagProps{Description: description, Name: name, ExternalDocs: externalDocs}}
}
-// Tag allows adding meta data to a single tag that is used by the [Operation Object](http://goo.gl/8us55a#operationObject).
+// Tag allows adding meta data to a single tag that is used by the
+// [Operation Object](http://goo.gl/8us55a#operationObject).
// It is not mandatory to have a Tag Object per tag used there.
//
// For more information: http://goo.gl/8us55a#tagObject
diff --git a/vendor/github.com/go-openapi/spec/unused.go b/vendor/github.com/go-openapi/spec/unused.go
new file mode 100644
index 00000000..aa12b56f
--- /dev/null
+++ b/vendor/github.com/go-openapi/spec/unused.go
@@ -0,0 +1,174 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package spec
+
+/*
+
+import (
+ "net/url"
+ "os"
+ "path"
+ "path/filepath"
+
+ "github.com/go-openapi/jsonpointer"
+)
+
+ // Some currently unused functions and definitions that
+ // used to be part of the expander.
+
+ // Moved here for the record and possible future reuse
+
+var (
+ idPtr, _ = jsonpointer.New("/id")
+ refPtr, _ = jsonpointer.New("/$ref")
+)
+
+func idFromNode(node interface{}) (*Ref, error) {
+ if idValue, _, err := idPtr.Get(node); err == nil {
+ if refStr, ok := idValue.(string); ok && refStr != "" {
+ idRef, err := NewRef(refStr)
+ if err != nil {
+ return nil, err
+ }
+ return &idRef, nil
+ }
+ }
+ return nil, nil
+}
+
+func nextRef(startingNode interface{}, startingRef *Ref, ptr *jsonpointer.Pointer) *Ref {
+ if startingRef == nil {
+ return nil
+ }
+
+ if ptr == nil {
+ return startingRef
+ }
+
+ ret := startingRef
+ var idRef *Ref
+ node := startingNode
+
+ for _, tok := range ptr.DecodedTokens() {
+ node, _, _ = jsonpointer.GetForToken(node, tok)
+ if node == nil {
+ break
+ }
+
+ idRef, _ = idFromNode(node)
+ if idRef != nil {
+ nw, err := ret.Inherits(*idRef)
+ if err != nil {
+ break
+ }
+ ret = nw
+ }
+
+ refRef, _, _ := refPtr.Get(node)
+ if refRef != nil {
+ var rf Ref
+ switch value := refRef.(type) {
+ case string:
+ rf, _ = NewRef(value)
+ }
+ nw, err := ret.Inherits(rf)
+ if err != nil {
+ break
+ }
+ nwURL := nw.GetURL()
+ if nwURL.Scheme == "file" || (nwURL.Scheme == "" && nwURL.Host == "") {
+ nwpt := filepath.ToSlash(nwURL.Path)
+ if filepath.IsAbs(nwpt) {
+ _, err := os.Stat(nwpt)
+ if err != nil {
+ nwURL.Path = filepath.Join(".", nwpt)
+ }
+ }
+ }
+
+ ret = nw
+ }
+
+ }
+
+ return ret
+}
+
+// basePathFromSchemaID returns a new basePath based on an existing basePath and a schema ID
+func basePathFromSchemaID(oldBasePath, id string) string {
+ u, err := url.Parse(oldBasePath)
+ if err != nil {
+ panic(err)
+ }
+ uid, err := url.Parse(id)
+ if err != nil {
+ panic(err)
+ }
+
+ if path.IsAbs(uid.Path) {
+ return id
+ }
+ u.Path = path.Join(path.Dir(u.Path), uid.Path)
+ return u.String()
+}
+*/
+
+// type ExtraSchemaProps map[string]interface{}
+
+// // JSONSchema represents a structure that is a json schema draft 04
+// type JSONSchema struct {
+// SchemaProps
+// ExtraSchemaProps
+// }
+
+// // MarshalJSON marshal this to JSON
+// func (s JSONSchema) MarshalJSON() ([]byte, error) {
+// b1, err := json.Marshal(s.SchemaProps)
+// if err != nil {
+// return nil, err
+// }
+// b2, err := s.Ref.MarshalJSON()
+// if err != nil {
+// return nil, err
+// }
+// b3, err := s.Schema.MarshalJSON()
+// if err != nil {
+// return nil, err
+// }
+// b4, err := json.Marshal(s.ExtraSchemaProps)
+// if err != nil {
+// return nil, err
+// }
+// return swag.ConcatJSON(b1, b2, b3, b4), nil
+// }
+
+// // UnmarshalJSON marshal this from JSON
+// func (s *JSONSchema) UnmarshalJSON(data []byte) error {
+// var sch JSONSchema
+// if err := json.Unmarshal(data, &sch.SchemaProps); err != nil {
+// return err
+// }
+// if err := json.Unmarshal(data, &sch.Ref); err != nil {
+// return err
+// }
+// if err := json.Unmarshal(data, &sch.Schema); err != nil {
+// return err
+// }
+// if err := json.Unmarshal(data, &sch.ExtraSchemaProps); err != nil {
+// return err
+// }
+// *s = sch
+// return nil
+// }
diff --git a/vendor/github.com/mattn/go-isatty/go.mod b/vendor/github.com/mattn/go-isatty/go.mod
new file mode 100644
index 00000000..f310320c
--- /dev/null
+++ b/vendor/github.com/mattn/go-isatty/go.mod
@@ -0,0 +1,3 @@
+module github.com/mattn/go-isatty
+
+require golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223
diff --git a/vendor/github.com/mattn/go-isatty/go.sum b/vendor/github.com/mattn/go-isatty/go.sum
new file mode 100644
index 00000000..426c8973
--- /dev/null
+++ b/vendor/github.com/mattn/go-isatty/go.sum
@@ -0,0 +1,2 @@
+golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8=
+golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
diff --git a/vendor/github.com/mattn/go-isatty/isatty_linux.go b/vendor/github.com/mattn/go-isatty/isatty_android.go
similarity index 62%
rename from vendor/github.com/mattn/go-isatty/isatty_linux.go
rename to vendor/github.com/mattn/go-isatty/isatty_android.go
index 7384cf99..d3567cb5 100644
--- a/vendor/github.com/mattn/go-isatty/isatty_linux.go
+++ b/vendor/github.com/mattn/go-isatty/isatty_android.go
@@ -1,5 +1,4 @@
-// +build linux
-// +build !appengine,!ppc64,!ppc64le
+// +build android
package isatty
@@ -16,3 +15,9 @@ func IsTerminal(fd uintptr) bool {
_, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0)
return err == 0
}
+
+// IsCygwinTerminal return true if the file descriptor is a cygwin or msys2
+// terminal. This is also always false on this environment.
+func IsCygwinTerminal(fd uintptr) bool {
+ return false
+}
diff --git a/vendor/github.com/mattn/go-isatty/isatty_appengine.go b/vendor/github.com/mattn/go-isatty/isatty_appengine.go
deleted file mode 100644
index 9584a988..00000000
--- a/vendor/github.com/mattn/go-isatty/isatty_appengine.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// +build appengine
-
-package isatty
-
-// IsTerminal returns true if the file descriptor is terminal which
-// is always false on on appengine classic which is a sandboxed PaaS.
-func IsTerminal(fd uintptr) bool {
- return false
-}
-
-// IsCygwinTerminal() return true if the file descriptor is a cygwin or msys2
-// terminal. This is also always false on this environment.
-func IsCygwinTerminal(fd uintptr) bool {
- return false
-}
diff --git a/vendor/github.com/mattn/go-isatty/isatty_bsd.go b/vendor/github.com/mattn/go-isatty/isatty_bsd.go
index 42f2514d..07e93039 100644
--- a/vendor/github.com/mattn/go-isatty/isatty_bsd.go
+++ b/vendor/github.com/mattn/go-isatty/isatty_bsd.go
@@ -16,3 +16,9 @@ func IsTerminal(fd uintptr) bool {
_, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0)
return err == 0
}
+
+// IsCygwinTerminal return true if the file descriptor is a cygwin or msys2
+// terminal. This is also always false on this environment.
+func IsCygwinTerminal(fd uintptr) bool {
+ return false
+}
diff --git a/vendor/github.com/mattn/go-isatty/isatty_linux_ppc64x.go b/vendor/github.com/mattn/go-isatty/isatty_linux_ppc64x.go
deleted file mode 100644
index 44e5d213..00000000
--- a/vendor/github.com/mattn/go-isatty/isatty_linux_ppc64x.go
+++ /dev/null
@@ -1,19 +0,0 @@
-// +build linux
-// +build ppc64 ppc64le
-
-package isatty
-
-import (
- "unsafe"
-
- syscall "golang.org/x/sys/unix"
-)
-
-const ioctlReadTermios = syscall.TCGETS
-
-// IsTerminal return true if the file descriptor is terminal.
-func IsTerminal(fd uintptr) bool {
- var termios syscall.Termios
- _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0)
- return err == 0
-}
diff --git a/vendor/github.com/mattn/go-isatty/isatty_others.go b/vendor/github.com/mattn/go-isatty/isatty_others.go
index 9d8b4a59..ff714a37 100644
--- a/vendor/github.com/mattn/go-isatty/isatty_others.go
+++ b/vendor/github.com/mattn/go-isatty/isatty_others.go
@@ -1,9 +1,14 @@
-// +build !windows
-// +build !appengine
+// +build appengine js nacl
package isatty
-// IsCygwinTerminal return true if the file descriptor is a cygwin or msys2
+// IsTerminal returns true if the file descriptor is terminal which
+// is always false on js and appengine classic which is a sandboxed PaaS.
+func IsTerminal(fd uintptr) bool {
+ return false
+}
+
+// IsCygwinTerminal() return true if the file descriptor is a cygwin or msys2
// terminal. This is also always false on this environment.
func IsCygwinTerminal(fd uintptr) bool {
return false
diff --git a/vendor/github.com/mattn/go-isatty/isatty_solaris.go b/vendor/github.com/mattn/go-isatty/isatty_solaris.go
index 1f0c6bf5..bdd5c79a 100644
--- a/vendor/github.com/mattn/go-isatty/isatty_solaris.go
+++ b/vendor/github.com/mattn/go-isatty/isatty_solaris.go
@@ -14,3 +14,9 @@ func IsTerminal(fd uintptr) bool {
err := unix.IoctlSetTermio(int(fd), unix.TCGETA, &termio)
return err == nil
}
+
+// IsCygwinTerminal return true if the file descriptor is a cygwin or msys2
+// terminal. This is also always false on this environment.
+func IsCygwinTerminal(fd uintptr) bool {
+ return false
+}
diff --git a/vendor/github.com/mattn/go-isatty/isatty_tcgets.go b/vendor/github.com/mattn/go-isatty/isatty_tcgets.go
new file mode 100644
index 00000000..453b025d
--- /dev/null
+++ b/vendor/github.com/mattn/go-isatty/isatty_tcgets.go
@@ -0,0 +1,19 @@
+// +build linux aix
+// +build !appengine
+// +build !android
+
+package isatty
+
+import "golang.org/x/sys/unix"
+
+// IsTerminal return true if the file descriptor is terminal.
+func IsTerminal(fd uintptr) bool {
+ _, err := unix.IoctlGetTermios(int(fd), unix.TCGETS)
+ return err == nil
+}
+
+// IsCygwinTerminal return true if the file descriptor is a cygwin or msys2
+// terminal. This is also always false on this environment.
+func IsCygwinTerminal(fd uintptr) bool {
+ return false
+}
diff --git a/vendor/github.com/modern-go/concurrent/.gitignore b/vendor/github.com/modern-go/concurrent/.gitignore
new file mode 100644
index 00000000..3f2bc474
--- /dev/null
+++ b/vendor/github.com/modern-go/concurrent/.gitignore
@@ -0,0 +1 @@
+/coverage.txt
diff --git a/vendor/github.com/modern-go/concurrent/.travis.yml b/vendor/github.com/modern-go/concurrent/.travis.yml
new file mode 100644
index 00000000..449e67cd
--- /dev/null
+++ b/vendor/github.com/modern-go/concurrent/.travis.yml
@@ -0,0 +1,14 @@
+language: go
+
+go:
+ - 1.8.x
+ - 1.x
+
+before_install:
+ - go get -t -v ./...
+
+script:
+ - ./test.sh
+
+after_success:
+ - bash <(curl -s https://codecov.io/bash)
diff --git a/vendor/github.com/modern-go/concurrent/README.md b/vendor/github.com/modern-go/concurrent/README.md
index 91d6adb3..acab3200 100644
--- a/vendor/github.com/modern-go/concurrent/README.md
+++ b/vendor/github.com/modern-go/concurrent/README.md
@@ -1,2 +1,49 @@
# concurrent
-concurrency utilities
+
+[](https://sourcegraph.com/github.com/modern-go/concurrent?badge)
+[](http://godoc.org/github.com/modern-go/concurrent)
+[](https://travis-ci.org/modern-go/concurrent)
+[](https://codecov.io/gh/modern-go/concurrent)
+[](https://goreportcard.com/report/github.com/modern-go/concurrent)
+[](https://raw.githubusercontent.com/modern-go/concurrent/master/LICENSE)
+
+* concurrent.Map: backport sync.Map for go below 1.9
+* concurrent.Executor: goroutine with explicit ownership and cancellable
+
+# concurrent.Map
+
+because sync.Map is only available in go 1.9, we can use concurrent.Map to make code portable
+
+```go
+m := concurrent.NewMap()
+m.Store("hello", "world")
+elem, found := m.Load("hello")
+// elem will be "world"
+// found will be true
+```
+
+# concurrent.Executor
+
+```go
+executor := concurrent.NewUnboundedExecutor()
+executor.Go(func(ctx context.Context) {
+ everyMillisecond := time.NewTicker(time.Millisecond)
+ for {
+ select {
+ case <-ctx.Done():
+ fmt.Println("goroutine exited")
+ return
+ case <-everyMillisecond.C:
+ // do something
+ }
+ }
+})
+time.Sleep(time.Second)
+executor.StopAndWaitForever()
+fmt.Println("executor stopped")
+```
+
+attach goroutine to executor instance, so that we can
+
+* cancel it by stop the executor with Stop/StopAndWait/StopAndWaitForever
+* handle panic by callback: the default behavior will no longer crash your application
\ No newline at end of file
diff --git a/vendor/github.com/modern-go/concurrent/executor.go b/vendor/github.com/modern-go/concurrent/executor.go
index 56e5d22b..623dba1a 100644
--- a/vendor/github.com/modern-go/concurrent/executor.go
+++ b/vendor/github.com/modern-go/concurrent/executor.go
@@ -2,6 +2,13 @@ package concurrent
import "context"
+// Executor replace go keyword to start a new goroutine
+// the goroutine should cancel itself if the context passed in has been cancelled
+// the goroutine started by the executor, is owned by the executor
+// we can cancel all executors owned by the executor just by stop the executor itself
+// however Executor interface does not Stop method, the one starting and owning executor
+// should use the concrete type of executor, instead of this interface.
type Executor interface {
+ // Go starts a new goroutine controlled by the context
Go(handler func(ctx context.Context))
-}
\ No newline at end of file
+}
diff --git a/vendor/github.com/modern-go/concurrent/go_above_19.go b/vendor/github.com/modern-go/concurrent/go_above_19.go
index a9f25934..aeabf8c4 100644
--- a/vendor/github.com/modern-go/concurrent/go_above_19.go
+++ b/vendor/github.com/modern-go/concurrent/go_above_19.go
@@ -4,10 +4,12 @@ package concurrent
import "sync"
+// Map is a wrapper for sync.Map introduced in go1.9
type Map struct {
sync.Map
}
+// NewMap creates a thread safe Map
func NewMap() *Map {
return &Map{}
-}
\ No newline at end of file
+}
diff --git a/vendor/github.com/modern-go/concurrent/go_below_19.go b/vendor/github.com/modern-go/concurrent/go_below_19.go
index 3f79f4fe..b9c8df7f 100644
--- a/vendor/github.com/modern-go/concurrent/go_below_19.go
+++ b/vendor/github.com/modern-go/concurrent/go_below_19.go
@@ -4,17 +4,20 @@ package concurrent
import "sync"
+// Map implements a thread safe map for go version below 1.9 using mutex
type Map struct {
lock sync.RWMutex
data map[interface{}]interface{}
}
+// NewMap creates a thread safe map
func NewMap() *Map {
return &Map{
data: make(map[interface{}]interface{}, 32),
}
}
+// Load is same as sync.Map Load
func (m *Map) Load(key interface{}) (elem interface{}, found bool) {
m.lock.RLock()
elem, found = m.data[key]
@@ -22,9 +25,9 @@ func (m *Map) Load(key interface{}) (elem interface{}, found bool) {
return
}
+// Load is same as sync.Map Store
func (m *Map) Store(key interface{}, elem interface{}) {
m.lock.Lock()
m.data[key] = elem
m.lock.Unlock()
}
-
diff --git a/vendor/github.com/modern-go/concurrent/log.go b/vendor/github.com/modern-go/concurrent/log.go
new file mode 100644
index 00000000..9756fcc7
--- /dev/null
+++ b/vendor/github.com/modern-go/concurrent/log.go
@@ -0,0 +1,13 @@
+package concurrent
+
+import (
+ "os"
+ "log"
+ "io/ioutil"
+)
+
+// ErrorLogger is used to print out error, can be set to writer other than stderr
+var ErrorLogger = log.New(os.Stderr, "", 0)
+
+// InfoLogger is used to print informational message, default to off
+var InfoLogger = log.New(ioutil.Discard, "", 0)
\ No newline at end of file
diff --git a/vendor/github.com/modern-go/concurrent/test.sh b/vendor/github.com/modern-go/concurrent/test.sh
new file mode 100644
index 00000000..d1e6b2ec
--- /dev/null
+++ b/vendor/github.com/modern-go/concurrent/test.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+
+set -e
+echo "" > coverage.txt
+
+for d in $(go list ./... | grep -v vendor); do
+ go test -coverprofile=profile.out -coverpkg=github.com/modern-go/concurrent $d
+ if [ -f profile.out ]; then
+ cat profile.out >> coverage.txt
+ rm profile.out
+ fi
+done
diff --git a/vendor/github.com/modern-go/concurrent/unbounded_executor.go b/vendor/github.com/modern-go/concurrent/unbounded_executor.go
index 70a1cf0f..05a77dce 100644
--- a/vendor/github.com/modern-go/concurrent/unbounded_executor.go
+++ b/vendor/github.com/modern-go/concurrent/unbounded_executor.go
@@ -4,33 +4,37 @@ import (
"context"
"fmt"
"runtime"
+ "runtime/debug"
"sync"
"time"
- "runtime/debug"
+ "reflect"
)
-var LogInfo = func(event string, properties ...interface{}) {
-}
-
-var LogPanic = func(recovered interface{}, properties ...interface{}) interface{} {
- fmt.Println(fmt.Sprintf("paniced: %v", recovered))
- debug.PrintStack()
- return recovered
+// HandlePanic logs goroutine panic by default
+var HandlePanic = func(recovered interface{}, funcName string) {
+ ErrorLogger.Println(fmt.Sprintf("%s panic: %v", funcName, recovered))
+ ErrorLogger.Println(string(debug.Stack()))
}
-const StopSignal = "STOP!"
-
+// UnboundedExecutor is a executor without limits on counts of alive goroutines
+// it tracks the goroutine started by it, and can cancel them when shutdown
type UnboundedExecutor struct {
ctx context.Context
cancel context.CancelFunc
activeGoroutinesMutex *sync.Mutex
activeGoroutines map[string]int
+ HandlePanic func(recovered interface{}, funcName string)
}
// GlobalUnboundedExecutor has the life cycle of the program itself
// any goroutine want to be shutdown before main exit can be started from this executor
+// GlobalUnboundedExecutor expects the main function to call stop
+// it does not magically knows the main function exits
var GlobalUnboundedExecutor = NewUnboundedExecutor()
+// NewUnboundedExecutor creates a new UnboundedExecutor,
+// UnboundedExecutor can not be created by &UnboundedExecutor{}
+// HandlePanic can be set with a callback to override global HandlePanic
func NewUnboundedExecutor() *UnboundedExecutor {
ctx, cancel := context.WithCancel(context.TODO())
return &UnboundedExecutor{
@@ -41,8 +45,13 @@ func NewUnboundedExecutor() *UnboundedExecutor {
}
}
+// Go starts a new goroutine and tracks its lifecycle.
+// Panic will be recovered and logged automatically, except for StopSignal
func (executor *UnboundedExecutor) Go(handler func(ctx context.Context)) {
- _, file, line, _ := runtime.Caller(1)
+ pc := reflect.ValueOf(handler).Pointer()
+ f := runtime.FuncForPC(pc)
+ funcName := f.Name()
+ file, line := f.FileLine(pc)
executor.activeGoroutinesMutex.Lock()
defer executor.activeGoroutinesMutex.Unlock()
startFrom := fmt.Sprintf("%s:%d", file, line)
@@ -50,46 +59,57 @@ func (executor *UnboundedExecutor) Go(handler func(ctx context.Context)) {
go func() {
defer func() {
recovered := recover()
- if recovered != nil && recovered != StopSignal {
- LogPanic(recovered)
+ // if you want to quit a goroutine without trigger HandlePanic
+ // use runtime.Goexit() to quit
+ if recovered != nil {
+ if executor.HandlePanic == nil {
+ HandlePanic(recovered, funcName)
+ } else {
+ executor.HandlePanic(recovered, funcName)
+ }
}
executor.activeGoroutinesMutex.Lock()
- defer executor.activeGoroutinesMutex.Unlock()
executor.activeGoroutines[startFrom] -= 1
+ executor.activeGoroutinesMutex.Unlock()
}()
handler(executor.ctx)
}()
}
+// Stop cancel all goroutines started by this executor without wait
func (executor *UnboundedExecutor) Stop() {
executor.cancel()
}
+// StopAndWaitForever cancel all goroutines started by this executor and
+// wait until all goroutines exited
func (executor *UnboundedExecutor) StopAndWaitForever() {
executor.StopAndWait(context.Background())
}
+// StopAndWait cancel all goroutines started by this executor and wait.
+// Wait can be cancelled by the context passed in.
func (executor *UnboundedExecutor) StopAndWait(ctx context.Context) {
executor.cancel()
for {
- fiveSeconds := time.NewTimer(time.Millisecond * 100)
+ oneHundredMilliseconds := time.NewTimer(time.Millisecond * 100)
select {
- case <-fiveSeconds.C:
+ case <-oneHundredMilliseconds.C:
+ if executor.checkNoActiveGoroutines() {
+ return
+ }
case <-ctx.Done():
return
}
- if executor.checkGoroutines() {
- return
- }
}
}
-func (executor *UnboundedExecutor) checkGoroutines() bool {
+func (executor *UnboundedExecutor) checkNoActiveGoroutines() bool {
executor.activeGoroutinesMutex.Lock()
defer executor.activeGoroutinesMutex.Unlock()
for startFrom, count := range executor.activeGoroutines {
if count > 0 {
- LogInfo("event!unbounded_executor.still waiting goroutines to quit",
+ InfoLogger.Println("UnboundedExecutor is still waiting goroutines to quit",
"startFrom", startFrom,
"count", count)
return false
diff --git a/vendor/github.com/modern-go/reflect2/type_map.go b/vendor/github.com/modern-go/reflect2/type_map.go
index 6d489112..3acfb558 100644
--- a/vendor/github.com/modern-go/reflect2/type_map.go
+++ b/vendor/github.com/modern-go/reflect2/type_map.go
@@ -4,6 +4,7 @@ import (
"reflect"
"runtime"
"strings"
+ "sync"
"unsafe"
)
@@ -15,10 +16,17 @@ func typelinks1() [][]unsafe.Pointer
//go:linkname typelinks2 reflect.typelinks
func typelinks2() (sections []unsafe.Pointer, offset [][]int32)
-var types = map[string]reflect.Type{}
-var packages = map[string]map[string]reflect.Type{}
+// initOnce guards initialization of types and packages
+var initOnce sync.Once
+
+var types map[string]reflect.Type
+var packages map[string]map[string]reflect.Type
+
+// discoverTypes initializes types and packages
+func discoverTypes() {
+ types = make(map[string]reflect.Type)
+ packages = make(map[string]map[string]reflect.Type)
-func init() {
ver := runtime.Version()
if ver == "go1.5" || strings.HasPrefix(ver, "go1.5.") {
loadGo15Types()
@@ -90,11 +98,13 @@ type emptyInterface struct {
// TypeByName return the type by its name, just like Class.forName in java
func TypeByName(typeName string) Type {
+ initOnce.Do(discoverTypes)
return Type2(types[typeName])
}
// TypeByPackageName return the type by its package and name
func TypeByPackageName(pkgPath string, name string) Type {
+ initOnce.Do(discoverTypes)
pkgTypes := packages[pkgPath]
if pkgTypes == nil {
return nil
diff --git a/vendor/github.com/swaggo/gin-swagger/.gitignore b/vendor/github.com/swaggo/gin-swagger/.gitignore
index 8c66381d..a6683886 100644
--- a/vendor/github.com/swaggo/gin-swagger/.gitignore
+++ b/vendor/github.com/swaggo/gin-swagger/.gitignore
@@ -9,4 +9,8 @@
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
-dist
\ No newline at end of file
+dist
+
+.idea
+vendor
+.envrc
diff --git a/vendor/github.com/swaggo/gin-swagger/README.md b/vendor/github.com/swaggo/gin-swagger/README.md
index d4b27fcd..e4f016a6 100644
--- a/vendor/github.com/swaggo/gin-swagger/README.md
+++ b/vendor/github.com/swaggo/gin-swagger/README.md
@@ -21,7 +21,7 @@ $ go get -u github.com/swaggo/swag/cmd/swag
```sh
$ swag init
```
-4.Download [gin-swagger](https://github.com/swaggo/gin-swagger) by using:
+4. Download [gin-swagger](https://github.com/swaggo/gin-swagger) by using:
```sh
$ go get -u github.com/swaggo/gin-swagger
$ go get -u github.com/swaggo/gin-swagger/swaggerFiles
@@ -64,8 +64,11 @@ import (
func main() {
r := gin.New()
- // use ginSwagger middleware to
- r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
+ config := &ginSwagger.Config{
+ URL: "http://localhost:8080/swagger/doc.json", //The url pointing to API definition
+ }
+ // use ginSwagger middleware to
+ r.GET("/swagger/*any", ginSwagger.CustomWrapHandler(config, swaggerFiles.Handler))
r.Run()
}
diff --git a/vendor/github.com/swaggo/gin-swagger/go.mod b/vendor/github.com/swaggo/gin-swagger/go.mod
index a0740e3e..85830d3a 100644
--- a/vendor/github.com/swaggo/gin-swagger/go.mod
+++ b/vendor/github.com/swaggo/gin-swagger/go.mod
@@ -1,18 +1,17 @@
module github.com/swaggo/gin-swagger
require (
- github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7 // indirect
- github.com/gin-gonic/gin v1.3.0
- github.com/go-openapi/jsonreference v0.18.0 // indirect
- github.com/go-openapi/spec v0.18.0 // indirect
- github.com/golang/protobuf v1.2.0 // indirect
- github.com/mattn/go-isatty v0.0.4 // indirect
- github.com/pkg/errors v0.8.1 // indirect
+ github.com/gin-contrib/gzip v0.0.1
+ github.com/gin-contrib/sse v0.1.0 // indirect
+ github.com/gin-gonic/gin v1.4.0
+ github.com/kr/pretty v0.1.0 // indirect
+ github.com/mattn/go-isatty v0.0.8 // indirect
github.com/stretchr/testify v1.3.0
- github.com/swaggo/swag v1.4.0
- github.com/ugorji/go/codec v0.0.0-20181209151446-772ced7fd4c2 // indirect
- golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e
- golang.org/x/tools v0.0.0-20190110015856-aa033095749b // indirect
- gopkg.in/go-playground/validator.v8 v8.18.2 // indirect
- gopkg.in/yaml.v2 v2.2.2 // indirect
+ github.com/swaggo/swag v1.5.1
+ github.com/ugorji/go v1.1.5-pre // indirect
+ golang.org/x/net v0.0.0-20190611141213-3f473d35a33a
+ golang.org/x/sys v0.0.0-20190610200419-93c9922d18ae // indirect
+ golang.org/x/text v0.3.2 // indirect
+ golang.org/x/tools v0.0.0-20190611222205-d73e1c7e250b // indirect
+ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
)
diff --git a/vendor/github.com/swaggo/gin-swagger/go.sum b/vendor/github.com/swaggo/gin-swagger/go.sum
index dca68129..47d45afa 100644
--- a/vendor/github.com/swaggo/gin-swagger/go.sum
+++ b/vendor/github.com/swaggo/gin-swagger/go.sum
@@ -2,29 +2,49 @@ github.com/PuerkitoBio/purell v1.1.0 h1:rmGxhojJlM0tuKtfdvliR84CFHljx9ag64t2xmVk
github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
-github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
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/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7 h1:AzN37oI0cOS+cougNAV9szl6CVoj2RYwzS3DpUQNtlY=
+github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
+github.com/gin-contrib/gzip v0.0.1 h1:ezvKOL6jH+jlzdHNE4h9h8q8uMpDQjyl0NN0Jd7jozc=
+github.com/gin-contrib/gzip v0.0.1/go.mod h1:fGBJBCdt6qCZuCAOwWuFhBB4OOq9EFqlo5dEaFhhu5w=
github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s=
-github.com/gin-gonic/gin v1.3.0 h1:kCmZyPklC0gVdL728E6Aj20uYBJV93nj/TkwBTKhFbs=
+github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s=
+github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
+github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
github.com/gin-gonic/gin v1.3.0/go.mod h1:7cKuhb5qV2ggCFctp2fJQ+ErvciLZrIeoOSOm6mUr7Y=
+github.com/gin-gonic/gin v1.4.0 h1:3tMoCCfM7ppqsR0ptz/wi1impNpT7/9wQtMZ8lr1mCQ=
+github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/3rZdM=
github.com/go-openapi/jsonpointer v0.17.0 h1:nH6xp8XdXHx8dqveo0ZuJBluCO2qGrPbDNZ0dwoRHP0=
github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M=
github.com/go-openapi/jsonreference v0.17.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I=
-github.com/go-openapi/jsonreference v0.18.0 h1:oP2OUNdG1l2r5kYhrfVMXO54gWmzcfAwP/GFuHpNTkE=
-github.com/go-openapi/jsonreference v0.18.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I=
-github.com/go-openapi/spec v0.18.0 h1:aIjeyG5mo5/FrvDkpKKEGZPmF9MPHahS72mzfVqeQXQ=
-github.com/go-openapi/spec v0.18.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI=
+github.com/go-openapi/jsonreference v0.19.0 h1:BqWKpV1dFd+AuiKlgtddwVIFQsuMpxfBDBHGfM2yNpk=
+github.com/go-openapi/jsonreference v0.19.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I=
+github.com/go-openapi/spec v0.19.0 h1:A4SZ6IWh3lnjH0rG0Z5lkxazMGBECtrZcbyYQi+64k4=
+github.com/go-openapi/spec v0.19.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI=
github.com/go-openapi/swag v0.17.0 h1:iqrgMg7Q7SvtbWLlltPrkMs0UBJI6oTSs79JFRUi880=
github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg=
-github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg=
+github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
+github.com/json-iterator/go v1.1.6 h1:MrUvLMLTMxbqFJ9kzlvat/rYZqZnW3u4wkLzWTaFwKs=
+github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
+github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
+github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
+github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
+github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
+github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329 h1:2gxZ0XQIU/5z3Z3bUBu+FXuk2pFbkN6tcwi/pjyaDic=
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
-github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs=
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
+github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
+github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE=
+github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
+github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
+github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
+github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
+github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
@@ -33,18 +53,41 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
-github.com/swaggo/swag v1.4.0 h1:exX5ES4CdJWCCKmVPE+FAIN66cnHeMHU3i2SCMibBZc=
-github.com/swaggo/swag v1.4.0/go.mod h1:hog2WgeMOrQ/LvQ+o1YGTeT+vWVrbi0SiIslBtxKTyM=
-github.com/ugorji/go/codec v0.0.0-20181209151446-772ced7fd4c2 h1:EICbibRW4JNKMcY+LsWmuwob+CRS1BmdRdjphAm9mH4=
-github.com/ugorji/go/codec v0.0.0-20181209151446-772ced7fd4c2/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
+github.com/swaggo/swag v1.5.1 h1:2Agm8I4K5qb00620mHq0VJ05/KT4FtmALPIcQR9lEZM=
+github.com/swaggo/swag v1.5.1/go.mod h1:1Bl9F/ZBpVWh22nY0zmYyASPO1lI/zIwRDrpZU+tv8Y=
+github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
+github.com/ugorji/go v1.1.5-pre h1:jyJKFOSEbdOc2HODrf2qcCkYOdq7zzXqA9bhW5oV4fM=
+github.com/ugorji/go v1.1.5-pre/go.mod h1:FwP/aQVg39TXzItUBMwnWp9T9gPQnXw4Poh4/oBQZ/0=
+github.com/ugorji/go/codec v0.0.0-20181022190402-e5e69e061d4f/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
+github.com/ugorji/go/codec v1.1.5-pre h1:5YV9PsFAN+ndcCtTM7s60no7nY7eTG3LPtxhSwuxzCs=
+github.com/ugorji/go/codec v1.1.5-pre/go.mod h1:tULtS6Gy1AE1yCENaw4Vb//HLH5njI2tfCQDUqRd8fI=
+github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
-golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg=
-golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
-golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
+golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190611141213-3f473d35a33a h1:+KkCgOMgnKSgenxTBoiwkMqTiouMIy/3o8RLdmSbGoY=
+golang.org/x/net v0.0.0-20190611141213-3f473d35a33a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sys v0.0.0-20181228144115-9a3f9b0469bb/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190610200419-93c9922d18ae h1:xiXzMMEQdQcric9hXtr1QU98MHunKK7OTtsoU6bYWs4=
+golang.org/x/sys v0.0.0-20190610200419-93c9922d18ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
-golang.org/x/tools v0.0.0-20190110015856-aa033095749b h1:G5tsw1T5VA7PD7VmXyGtX/hQp3ABPSCPRKVfsdUcVxs=
-golang.org/x/tools v0.0.0-20190110015856-aa033095749b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
+golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
+golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20190606050223-4d9ae51c2468/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
+golang.org/x/tools v0.0.0-20190611222205-d73e1c7e250b h1:/mJ+GKieZA6hFDQGdWZrjj4AXPl5ylY+5HusG80roy0=
+golang.org/x/tools v0.0.0-20190611222205-d73e1c7e250b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
+gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM=
+gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE=
gopkg.in/go-playground/validator.v8 v8.18.2 h1:lFB4DoMU6B626w8ny76MV7VX6W2VHct2GVOI3xgiMrQ=
gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
diff --git a/vendor/github.com/swaggo/gin-swagger/swagger.go b/vendor/github.com/swaggo/gin-swagger/swagger.go
index fd58935c..445ecbca 100644
--- a/vendor/github.com/swaggo/gin-swagger/swagger.go
+++ b/vendor/github.com/swaggo/gin-swagger/swagger.go
@@ -4,6 +4,7 @@ import (
"html/template"
"os"
"regexp"
+ "strings"
"golang.org/x/net/webdav"
@@ -11,21 +12,48 @@ import (
"github.com/swaggo/swag"
)
+// Config stores ginSwagger configuration variables.
+type Config struct {
+ //The url pointing to API definition (normally swagger.json or swagger.yaml). Default is `doc.json`.
+ URL string
+}
+
+// URL presents the url pointing to API definition (normally swagger.json or swagger.yaml).
+func URL(url string) func(c *Config) {
+ return func(c *Config) {
+ c.URL = url
+ }
+}
+
// WrapHandler wraps `http.Handler` into `gin.HandlerFunc`.
-func WrapHandler(h *webdav.Handler) gin.HandlerFunc {
+func WrapHandler(h *webdav.Handler, confs ...func(c *Config)) gin.HandlerFunc {
+ defaultConfig := &Config{
+ URL: "doc.json",
+ }
+
+ for _, c := range confs {
+ c(defaultConfig)
+ }
+
+ return CustomWrapHandler(defaultConfig, h)
+}
+
+// CustomWrapHandler wraps `http.Handler` into `gin.HandlerFunc`
+func CustomWrapHandler(config *Config, h *webdav.Handler) gin.HandlerFunc {
//create a template with name
t := template.New("swagger_index.html")
index, _ := t.Parse(swagger_index_templ)
- type pro struct {
- Host string
- }
-
- var re = regexp.MustCompile(`(.*)(index\.html|doc\.json|favicon-16x16\.png|favicon-32x32\.png|/oauth2-redirect\.html|swagger-ui\.css|swagger-ui\.css\.map|swagger-ui\.js|swagger-ui\.js\.map|swagger-ui-bundle\.js|swagger-ui-bundle\.js\.map|swagger-ui-standalone-preset\.js|swagger-ui-standalone-preset\.js\.map)[\?|.]*`)
+ var rexp = regexp.MustCompile(`(.*)(index\.html|doc\.json|favicon-16x16\.png|favicon-32x32\.png|/oauth2-redirect\.html|swagger-ui\.css|swagger-ui\.css\.map|swagger-ui\.js|swagger-ui\.js\.map|swagger-ui-bundle\.js|swagger-ui-bundle\.js\.map|swagger-ui-standalone-preset\.js|swagger-ui-standalone-preset\.js\.map)[\?|.]*`)
return func(c *gin.Context) {
+
+ type swaggerUIBundle struct {
+ URL string
+ }
+
var matches []string
- if matches = re.FindStringSubmatch(c.Request.RequestURI); len(matches) != 3 {
+ if matches = rexp.FindStringSubmatch(c.Request.RequestURI); len(matches) != 3 {
c.Status(404)
c.Writer.Write([]byte("404 page not found"))
return
@@ -34,19 +62,30 @@ func WrapHandler(h *webdav.Handler) gin.HandlerFunc {
prefix := matches[1]
h.Prefix = prefix
+ if strings.HasSuffix(path, ".html") {
+ c.Header("Content-Type", "text/html; charset=utf-8")
+ } else if strings.HasSuffix(path, ".css") {
+ c.Header("Content-Type", "text/css; charset=utf-8")
+ } else if strings.HasSuffix(path, ".js") {
+ c.Header("Content-Type", "application/javascript")
+ } else if strings.HasSuffix(path, ".json") {
+ c.Header("Content-Type", "application/json")
+ }
+
switch path {
case "index.html":
- s := &pro{
- Host: "doc.json", //TODO: provide to customs?
- }
- index.Execute(c.Writer, s)
+ index.Execute(c.Writer, &swaggerUIBundle{
+ URL: config.URL,
+ })
case "doc.json":
- doc, _ := swag.ReadDoc()
+ doc, err := swag.ReadDoc()
+ if err != nil {
+ panic(err)
+ }
c.Writer.Write([]byte(doc))
return
default:
h.ServeHTTP(c.Writer, c.Request)
-
}
}
}
@@ -66,6 +105,21 @@ func DisablingWrapHandler(h *webdav.Handler, envName string) gin.HandlerFunc {
return WrapHandler(h)
}
+// DisablingCustomWrapHandler turn handler off
+// if specified environment variable passed
+func DisablingCustomWrapHandler(config *Config, h *webdav.Handler, envName string) gin.HandlerFunc {
+ eFlag := os.Getenv(envName)
+ if eFlag != "" {
+ return func(c *gin.Context) {
+ // Simulate behavior when route unspecified and
+ // return 404 HTTP code
+ c.String(404, "")
+ }
+ }
+
+ return CustomWrapHandler(config, h)
+}
+
const swagger_index_templ = `
@@ -141,7 +195,7 @@ const swagger_index_templ = `
window.onload = function() {
// Build a system
const ui = SwaggerUIBundle({
- url: "{{.Host}}",
+ url: "{{.URL}}",
dom_id: '#swagger-ui',
validatorUrl: null,
presets: [
diff --git a/vendor/github.com/swaggo/swag/.gitignore b/vendor/github.com/swaggo/swag/.gitignore
index 6f40cc7d..e0961241 100644
--- a/vendor/github.com/swaggo/swag/.gitignore
+++ b/vendor/github.com/swaggo/swag/.gitignore
@@ -1,5 +1,5 @@
-swag
-testdata/simple/docs
+dist
+testdata/simple*/docs
cover.out
# Test binary, build with `go test -c`
diff --git a/vendor/github.com/swaggo/swag/.golint_exclude b/vendor/github.com/swaggo/swag/.golint_exclude
deleted file mode 100644
index 956da6fa..00000000
--- a/vendor/github.com/swaggo/swag/.golint_exclude
+++ /dev/null
@@ -1 +0,0 @@
-^example
diff --git a/vendor/github.com/swaggo/swag/.goreleaser.yml b/vendor/github.com/swaggo/swag/.goreleaser.yml
new file mode 100644
index 00000000..d0b576ab
--- /dev/null
+++ b/vendor/github.com/swaggo/swag/.goreleaser.yml
@@ -0,0 +1,19 @@
+build:
+ main: cmd/swag/main.go
+archive:
+ replacements:
+ darwin: Darwin
+ linux: Linux
+ windows: Windows
+ 386: i386
+ amd64: x86_64
+checksum:
+ name_template: 'checksums.txt'
+snapshot:
+ name_template: "{{ .Tag }}-next"
+changelog:
+ sort: asc
+ filters:
+ exclude:
+ - '^docs:'
+ - '^test:'
diff --git a/vendor/github.com/swaggo/swag/.travis.yml b/vendor/github.com/swaggo/swag/.travis.yml
index dfb43cee..00fd3764 100644
--- a/vendor/github.com/swaggo/swag/.travis.yml
+++ b/vendor/github.com/swaggo/swag/.travis.yml
@@ -1,19 +1,21 @@
language: go
+sudo: false
go:
- - 1.8.x
- 1.9.x
- 1.10.x
- 1.11.x
+ - 1.12.x
-before_install:
- - make deps
+install:
+ - make install
script:
+ - make fmt-check
- make lint
+ - make vet
- make build
- make test
- - go test -race -coverprofile=coverage.txt -covermode=atomic
after_success:
- bash <(curl -s https://codecov.io/bash)
diff --git a/vendor/github.com/swaggo/swag/Makefile b/vendor/github.com/swaggo/swag/Makefile
index 7eb0b7bc..001853e3 100644
--- a/vendor/github.com/swaggo/swag/Makefile
+++ b/vendor/github.com/swaggo/swag/Makefile
@@ -1,43 +1,78 @@
-#! /usr/bin/make
-GOCMD=$(shell which go)
-GOLINT=$(shell which golint)
-GOIMPORT=$(shell which goimports)
-GOBUILD=$(GOCMD) build
-GOCLEAN=$(GOCMD) clean
-GOTEST=$(GOCMD) test
-GOGET=$(GOCMD) get
-GOLIST=$(GOCMD) list
-BINARY_NAME=swag
+GOCMD:=$(shell which go)
+GOLINT:=$(shell which golint)
+GOIMPORT:=$(shell which goimports)
+GOFMT:=$(shell which gofmt)
+GOBUILD:=$(GOCMD) build
+GOCLEAN:=$(GOCMD) clean
+GOTEST:=$(GOCMD) test
+GOGET:=$(GOCMD) get
+GOLIST:=$(GOCMD) list
+GOVET:=$(GOCMD) vet
+
+BINARY_NAME:=swag
+PACKAGES:=$(shell $(GOLIST) github.com/swaggo/swag github.com/swaggo/swag/cmd/swag github.com/swaggo/swag/gen)
+GOFILES:=$(shell find . -name "*.go" -type f)
+
+export GO111MODULE := on
all: test build
+.PHONY: build
build:
$(GOBUILD) -o $(BINARY_NAME) -v ./cmd/...
+.PHONY: test
test:
- $(GOTEST) -v ./...
+ echo "mode: count" > coverage.out
+ for PKG in $(PACKAGES); do \
+ $(GOCMD) test -v -covermode=count -coverprofile=profile.out $$PKG > tmp.out; \
+ cat tmp.out; \
+ if grep -q "^--- FAIL" tmp.out; then \
+ rm tmp.out; \
+ exit 1; \
+ elif grep -q "build failed" tmp.out; then \
+ rm tmp.out; \
+ exit; \
+ fi; \
+ if [ -f profile.out ]; then \
+ cat profile.out | grep -v "mode:" >> coverage.out; \
+ rm profile.out; \
+ fi; \
+ done
+.PHONY: clean
clean:
$(GOCLEAN)
rm -f $(BINARY_NAME)
-DIRS=$(shell $(GOLIST) -f {{.Dir}} ./...)
+.PHONY: install
+install:
+ $(GOGET) -v github.com/swaggo/swag github.com/swaggo/swag/cmd/swag github.com/swaggo/swag/gen
+ $(GOGET) github.com/stretchr/testify/assert
+
+.PHONY: lint
lint:
- @for d in $(DIRS) ; do \
- if [ "`$(GOIMPORT) -l $$d/*.go | tee /dev/stderr`" ]; then \
- echo "^ - Repo contains improperly formatted go files" && echo && exit 1; \
- fi \
- done
- @if [ "`$(GOLINT) ./... | grep -vf .golint_exclude | tee /dev/stderr`" ]; then \
- echo "^ - Lint errors!" && echo && exit 1; \
- fi
+ which golint || $(GOGET) -u golang.org/x/lint/golint
+ for PKG in $(PACKAGES); do golint -set_exit_status $$PKG || exit 1; done;
-deps:
- $(GOGET) -v ./...
- $(GOGET) github.com/stretchr/testify/assert
- $(GOGET) github.com/golang/lint/golint
- $(GOGET) golang.org/x/tools/cmd/goimports
+.PHONY: vet
+vet:
+ $(GOVET) $(PACKAGES)
+
+.PHONY: fmt
+fmt:
+ $(GOFMT) -s -w $(GOFILES)
+
+.PHONY: fmt-check
+fmt-check:
+ @diff=$$($(GOFMT) -s -d $(GOFILES)); \
+ if [ -n "$$diff" ]; then \
+ echo "Please run 'make fmt' and commit the result:"; \
+ echo "$${diff}"; \
+ exit 1; \
+ fi;
+.PHONY: view-covered
view-covered:
$(GOTEST) -coverprofile=cover.out $(TARGET)
- $(GOCMD) tool cover -html=cover.out
+ $(GOCMD) tool cover -html=cover.out
\ No newline at end of file
diff --git a/vendor/github.com/swaggo/swag/README.md b/vendor/github.com/swaggo/swag/README.md
index c702af56..4119cea0 100644
--- a/vendor/github.com/swaggo/swag/README.md
+++ b/vendor/github.com/swaggo/swag/README.md
@@ -1,78 +1,88 @@
# swag
-
-
-
+
-
- Automatically generate RESTful API documentation with Swagger 2.0 for Go.
-
+[](https://travis-ci.org/swaggo/swag)
+[](https://codecov.io/gh/swaggo/swag)
+[](https://goreportcard.com/report/github.com/swaggo/swag)
+[](https://codebeat.co/projects/github-com-swaggo-swag-master)
+[](https://godoc.org/github.com/swaggo/swag)
+[](#backers)
+[](#sponsors) [](https://app.fossa.io/projects/git%2Bgithub.com%2Fswaggo%2Fswag?ref=badge_shield)
+[](https://github.com/swaggo/swag/releases)
-
-
-
-
-
-
-
-gopher image source is tenntenn/gopher-stickers. It has licenses creative commons licensing.
+Swag converts Go annotations to Swagger Documentation 2.0. We've created a variety of plugins for popular [Go web frameworks](#supported-web-frameworks). This allows you to quickly integrate with an existing Go project (using Swagger UI).
-## Content
+## Contents
- [Getting started](#getting-started)
- - [Go web frameworks](#supported-web-frameworks)
- [Supported Web Frameworks](#supported-web-frameworks)
- - [How to use it with `gin`?](#how-to-use-it-with-`gin`?)
+ - [How to use it with Gin](#how-to-use-it-with-gin)
- [Implementation Status](#implementation-status)
- - [swag cli](#swag-cli)
- - [General API Info](#general-api-info)
- - [Security](#security)
- - [API Operation](#api-operation)
- - [TIPS](#tips)
- - [User defined structure with an array type](#user-defined-structure-with-an-array-type)
+ - [Declarative Comments Format](#declarative-comments-format)
+ - [General API Info](#general-api-info)
+ - [API Operation](#api-operation)
+ - [Security](#security)
+ - [Examples](#examples)
+ - [Descriptions over multiple lines](#descriptions-over-multiple-lines)
+ - [User defined structure with an array type](#user-defined-structure-with-an-array-type)
+ - [Add a headers in response](#add-a-headers-in-response)
- [Use multiple path params](#use-multiple-path-params)
- [Example value of struct](#example-value-of-struct)
- [Description of struct](#description-of-struct)
+ - [Use swaggertype tag to supported custom type](#use-swaggertype-tag-to-supported-custom-type)
+ - [Add extension info to struct field](#add-extension-info-to-struct-field)
+ - [How to using security annotations](#how-to-using-security-annotations)
- [About the Project](#about-the-project)
-## Summary
-
-Swag converts Go annotations to Swagger Documentation 2.0. We've created a variety of plugins for popular [Go web frameworks](#supported-web-frameworks). This allows you to quickly integrate with an existing Go project (using Swagger UI).
-
-## Examples
-
-[swaggo + gin](https://github.com/swaggo/swag/tree/master/example)
-
-
## Getting started
-1. Add comments to your API source code, [See Declarative Comments Format](#general-api-info).
+1. Add comments to your API source code, See [Declarative Comments Format](#declarative-comments-format).
2. Download swag by using:
```sh
$ go get -u github.com/swaggo/swag/cmd/swag
```
+To build from source you need [Go](https://golang.org/dl/) (1.9 or newer).
+
+Or download the pre-compiled binaries binray form [release page](https://github.com/swaggo/swag/releases).
3. Run `swag init` in the project's root folder which contains the `main.go` file. This will parse your comments and generate the required files (`docs` folder and `docs/docs.go`).
```sh
$ swag init
```
-4. In order to serve these files, you can utilize one of our supported plugins. For go's core library, check out [net/http](https://github.com/swaggo/http-swagger).
-
- * Make sure to import the generated `docs/docs.go` so that your specific configuration gets `init`'ed.
- * If your General API annotation do not live in `main.go`, you can let swag know with `-g`.
+ Make sure to import the generated `docs/docs.go` so that your specific configuration gets `init`'ed. If your General API annotations do not live in `main.go`, you can let swag know with `-g` flag.
```sh
swag init -g http/api.go
```
+## swag cli
+
+```sh
+$ swag init -h
+NAME:
+ swag init - Create docs.go
+
+USAGE:
+ swag init [command options] [arguments...]
+
+OPTIONS:
+ --generalInfo value, -g value Go file path in which 'swagger general API Info' is written (default: "main.go")
+ --dir value, -d value Directory you want to parse (default: "./")
+ --propertyStrategy value, -p value Property Naming Strategy like snakecase,camelcase,pascalcase (default: "camelcase")
+ --output value, -o value Output directory for al the generated files(swagger.json, swagger.yaml and doc.go) (default: "./docs")
+ --parseVendor Parse go files in 'vendor' folder, disabled by default
+```
+
## Supported Web Frameworks
- [gin](http://github.com/swaggo/gin-swagger)
- [echo](http://github.com/swaggo/echo-swagger)
+- [buffalo](https://github.com/swaggo/buffalo-swagger)
- [net/http](https://github.com/swaggo/http-swagger)
-## How to use it with `gin`?
+## How to use it with Gin
Find the example source code [here](https://github.com/swaggo/swag/tree/master/example/celler).
@@ -149,7 +159,46 @@ func main() {
r.Run(":8080")
}
//...
+```
+Additionally some general API info can be set dynamically. The generated code package `docs` exports `SwaggerInfo` variable which we can use to set the title, description, version, host and base path programatically. Example using Gin:
+
+```go
+package main
+
+import (
+ "github.com/gin-gonic/gin"
+ "github.com/swaggo/gin-swagger"
+ "github.com/swaggo/gin-swagger/swaggerFiles"
+
+ "./docs" // docs is generated by Swag CLI, you have to import it.
+)
+
+// @contact.name API Support
+// @contact.url http://www.swagger.io/support
+// @contact.email support@swagger.io
+
+// @license.name Apache 2.0
+// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
+
+// @termsOfService http://swagger.io/terms/
+
+func main() {
+
+ // programatically set swagger info
+ docs.SwaggerInfo.Title = "Swagger Example API"
+ docs.SwaggerInfo.Description = "This is a sample server Petstore server."
+ docs.SwaggerInfo.Version = "1.0"
+ docs.SwaggerInfo.Host = "petstore.swagger.io"
+ docs.SwaggerInfo.BasePath = "/v2"
+
+ r := gin.New()
+
+ // use ginSwagger middleware to serve the API docs
+ r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
+
+ r.Run()
+}
```
3. Add [API Operation](#api-operation) annotations in `controller` code
@@ -175,6 +224,7 @@ import (
// @Produce json
// @Param id path int true "Account ID"
// @Success 200 {object} model.Account
+// @Header 200 {string} Token "qwerty"
// @Failure 400 {object} httputil.HTTPError
// @Failure 404 {object} httputil.HTTPError
// @Failure 500 {object} httputil.HTTPError
@@ -201,6 +251,7 @@ func (c *Controller) ShowAccount(ctx *gin.Context) {
// @Produce json
// @Param q query string false "name search by q"
// @Success 200 {array} model.Account
+// @Header 200 {string} Token "qwerty"
// @Failure 400 {object} httputil.HTTPError
// @Failure 404 {object} httputil.HTTPError
// @Failure 500 {object} httputil.HTTPError
@@ -246,65 +297,35 @@ $ swag init
- [x] Grouping Operations With Tags
- [ ] Swagger Extensions
-# swag cli
-
-```console
-$ swag init -h
-NAME:
- swag init - Create docs.go
-
-USAGE:
- swag init [command options] [arguments...]
-
-OPTIONS:
- --generalInfo value, -g value Go file path in which 'swagger general API Info' is written (default: "main.go")
- --dir value, -d value Directory you want to parse (default: "./")
- --swagger value, -s value Output the swagger conf for json and yaml (default: "./docs/swagger")
- --propertyStrategy value, -p value Property Naming Strategy like snakecase,camelcase,pascalcase (default: "camelcase")
-```
+# Declarative Comments Format
-# General API Info
+## General API Info
-**Example**
+**Example**
[celler/main.go](https://github.com/swaggo/swag/blob/master/example/celler/main.go)
-| annotation | description | example |
-|--------------------|-------------------------------------------------------------------------------------------------|-----------------------------------------------------------------|
-| title | **Required.** The title of the application. | // @title Swagger Example API |
-| version | **Required.** Provides the version of the application API. | // @version 1.0 |
-| description | A short description of the application. | // @description This is a sample server celler server. |
-| termsOfService | The Terms of Service for the API. | // @termsOfService http://swagger.io/terms/ |
-| contact.name | The contact information for the exposed API. | // @contact.name API Support |
-| contact.url | The URL pointing to the contact information. MUST be in the format of a URL. | // @contact.url http://www.swagger.io/support |
-| contact.email | The email address of the contact person/organization. MUST be in the format of an email address.| // @contact.email support@swagger.io |
-| license.name | **Required.** The license name used for the API. | // @license.name Apache 2.0 |
-| license.url | A URL to the license used for the API. MUST be in the format of a URL. | // @license.url http://www.apache.org/licenses/LICENSE-2.0.html |
-| host | The host (name or ip) serving the API. | // @host localhost:8080 |
-| BasePath | The base path on which the API is served. | // @BasePath /api/v1 |
-
-## Security
-
-| annotation | description | parameters | example |
-|-----------------------------------------|------------------------------------------------------------------------------------------------|-----------------------------------|--------------------------------------------------------------|
-| securitydefinitions.basic | [Basic](https://swagger.io/docs/specification/2-0/authentication/basic-authentication/) auth. | | // @securityDefinitions.basic BasicAuth |
-| securitydefinitions.apikey | [API key](https://swagger.io/docs/specification/2-0/authentication/api-keys/) auth. | in, name | // @securityDefinitions.apikey ApiKeyAuth |
-| securitydefinitions.oauth2.application | [OAuth2 application](https://swagger.io/docs/specification/authentication/oauth2/) auth. | tokenUrl, scope | // @securitydefinitions.oauth2.application OAuth2Application |
-| securitydefinitions.oauth2.implicit | [OAuth2 implicit](https://swagger.io/docs/specification/authentication/oauth2/) auth. | authorizationUrl, scope | // @securitydefinitions.oauth2.implicit OAuth2Implicit |
-| securitydefinitions.oauth2.password | [OAuth2 password](https://swagger.io/docs/specification/authentication/oauth2/) auth. | tokenUrl, scope | // @securitydefinitions.oauth2.password OAuth2Password |
-| securitydefinitions.oauth2.accessCode | [OAuth2 access code](https://swagger.io/docs/specification/authentication/oauth2/) auth. | tokenUrl, authorizationUrl, scope | // @securitydefinitions.oauth2.accessCode OAuth2AccessCode |
-
-
-| parameters annotation | example |
-|-----------------------|----------------------------------------------------------|
-| in | // @in header |
-| name | // @name Authorization |
-| tokenUrl | // @tokenUrl https://example.com/oauth/token |
-| authorizationurl | // @authorizationurl https://example.com/oauth/authorize |
-| scope.hoge | // @scope.write Grants write access |
-
-# API Operation
-
-**Example**
+| annotation | description | example |
+|-------------|--------------------------------------------|---------------------------------|
+| title | **Required.** The title of the application.| // @title Swagger Example API |
+| version | **Required.** Provides the version of the application API.| // @version 1.0 |
+| description | A short description of the application. |// @description This is a sample server celler server. |
+| tag.name | Name of a tag.| // @tag.name This is the name of the tag |
+| tag.description | Description of the tag | // @tag.description Cool Description |
+| tag.docs.url | Url of the external Documentation of the tag | // @tag.docs.url https://example.com|
+| tag.docs.descripiton | Description of the external Documentation of the tag| // @tag.docs.descirption Best example documentation |
+| termsOfService | The Terms of Service for the API.| // @termsOfService http://swagger.io/terms/ |
+| contact.name | The contact information for the exposed API.| // @contact.name API Support |
+| contact.url | The URL pointing to the contact information. MUST be in the format of a URL. | // @contact.url http://www.swagger.io/support|
+| contact.email| The email address of the contact person/organization. MUST be in the format of an email address.| // @contact.email support@swagger.io |
+| license.name | **Required.** The license name used for the API.|// @license.name Apache 2.0|
+| license.url | A URL to the license used for the API. MUST be in the format of a URL. | // @license.url http://www.apache.org/licenses/LICENSE-2.0.html |
+| host | The host (name or ip) serving the API. | // @host localhost:8080 |
+| BasePath | The base path on which the API is served. | // @BasePath /api/v1 |
+| schemes | The transfer protocol for the operation that separated by spaces. | // @schemes http https |
+
+## API Operation
+
+**Example**
[celler/controller](https://github.com/swaggo/swag/tree/master/example/celler/controller)
@@ -320,59 +341,38 @@ OPTIONS:
| security | [Security](#security) to each API operation. |
| success | Success response that separated by spaces. `return code`,`{param type}`,`data type`,`comment` |
| failure | Failure response that separated by spaces. `return code`,`{param type}`,`data type`,`comment` |
+| header | Header in response that separated by spaces. `return code`,`{param type}`,`data type`,`comment` |
| router | Path definition that separated by spaces. `path`,`[httpMethod]` |
## Mime Types
-| Mime Type | annotation |
-|-----------------------------------|-----------------------------------------------------------|
-| application/json | application/json, json |
-| text/xml | text/xml, xml |
-| text/plain | text/plain, plain |
-| html | text/html, html |
-| multipart/form-data | multipart/form-data, mpfd |
-| application/x-www-form-urlencoded | application/x-www-form-urlencoded, x-www-form-urlencoded |
-| application/vnd.api+json | application/vnd.api+json, json-api |
-| application/x-json-stream | application/x-json-stream, json-stream |
-| application/octet-stream | application/octet-stream, octet-stream |
-| image/png | image/png, png |
-| image/jpeg | image/jpeg, jpeg |
-| image/gif | image/gif, gif |
+`swag` accepts all MIME Types which are in the correct format, that is, match `*/*`.
+Besides that, `swag` also accepts aliases for some MIME Types as follows:
-## Security
+| Alias | MIME Type |
+|-----------------------|-----------------------------------|
+| json | application/json |
+| xml | text/xml |
+| plain | text/plain |
+| html | text/html |
+| mpfd | multipart/form-data |
+| x-www-form-urlencoded | application/x-www-form-urlencoded |
+| json-api | application/vnd.api+json |
+| json-stream | application/x-json-stream |
+| octet-stream | application/octet-stream |
+| png | image/png |
+| jpeg | image/jpeg |
+| gif | image/gif |
-General API info.
-```go
-// @securityDefinitions.basic BasicAuth
-
-// @securitydefinitions.oauth2.application OAuth2Application
-// @tokenUrl https://example.com/oauth/token
-// @scope.write Grants write access
-// @scope.admin Grants read and write access to administrative information
-```
-
-Each API operation.
-
-```go
-// @Security ApiKeyAuth
-```
-
-Make it AND condition
-
-```go
-// @Security ApiKeyAuth
-// @Security OAuth2Application[write, admin]
-```
## Param Type
-- object (struct)
-- string (string)
-- integer (int, uint, uint32, uint64)
-- number (float32)
-- boolean (bool)
-- array
+- query
+- path
+- header
+- body
+- formData
## Data Type
@@ -382,6 +382,26 @@ Make it AND condition
- boolean (bool)
- user defined struct
+## Security
+| annotation | description | parameters | example |
+|------------|-------------|------------|---------|
+| securitydefinitions.basic | [Basic](https://swagger.io/docs/specification/2-0/authentication/basic-authentication/) auth. | | // @securityDefinitions.basic BasicAuth |
+| securitydefinitions.apikey | [API key](https://swagger.io/docs/specification/2-0/authentication/api-keys/) auth. | in, name | // @securityDefinitions.apikey ApiKeyAuth |
+| securitydefinitions.oauth2.application | [OAuth2 application](https://swagger.io/docs/specification/authentication/oauth2/) auth. | tokenUrl, scope | // @securitydefinitions.oauth2.application OAuth2Application |
+| securitydefinitions.oauth2.implicit | [OAuth2 implicit](https://swagger.io/docs/specification/authentication/oauth2/) auth. | authorizationUrl, scope | // @securitydefinitions.oauth2.implicit OAuth2Implicit |
+| securitydefinitions.oauth2.password | [OAuth2 password](https://swagger.io/docs/specification/authentication/oauth2/) auth. | tokenUrl, scope | // @securitydefinitions.oauth2.password OAuth2Password |
+| securitydefinitions.oauth2.accessCode | [OAuth2 access code](https://swagger.io/docs/specification/authentication/oauth2/) auth. | tokenUrl, authorizationUrl, scope | // @securitydefinitions.oauth2.accessCode OAuth2AccessCode |
+
+
+| parameters annotation | example |
+|-----------------------|----------------------------------------------------------|
+| in | // @in header |
+| name | // @name Authorization |
+| tokenUrl | // @tokenUrl https://example.com/oauth/token |
+| authorizationurl | // @authorizationurl https://example.com/oauth/authorize |
+| scope.hoge | // @scope.write Grants write access |
+
+
## Attribute
```go
@@ -393,6 +413,16 @@ Make it AND condition
// @Param default query string false "string default" default(A)
```
+It also works for the struct fields:
+
+```go
+type Foo struct {
+ Bar string `minLength:"4" maxLength:"16"`
+ Baz int `minimum:"10" maximum:"20" default:"15"`
+ Qux []string `enums:"foo,bar,baz"`
+}
+```
+
### Available
Field Name | Type | Description
@@ -403,12 +433,12 @@ Field Name | Type | Description
maxLength | `integer` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.1.
minLength | `integer` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.2.
enums | [\*] | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1.
+format | `string` | The extending format for the previously mentioned [`type`](#parameterType). See [Data Type Formats](#dataTypeFormat) for further details.
### Future
Field Name | Type | Description
---|:---:|---
-format | `string` | The extending format for the previously mentioned [`type`](#parameterType). See [Data Type Formats](#dataTypeFormat) for further details.
multipleOf | `number` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.1.
pattern | `string` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.3.
maxItems | `integer` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.2.
@@ -416,7 +446,17 @@ Field Name | Type | Description
uniqueItems | `boolean` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.4.
collectionFormat | `string` | Determines the format of the array if type array is used. Possible values are: - `csv` - comma separated values `foo,bar`.
- `ssv` - space separated values `foo bar`.
- `tsv` - tab separated values `foo\tbar`.
- `pipes` - pipe separated values
foo|bar
. - `multi` - corresponds to multiple parameter instances instead of multiple values for a single instance `foo=bar&foo=baz`. This is valid only for parameters [`in`](#parameterIn) "query" or "formData".
Default value is `csv`.
-## TIPS
+## Examples
+
+### Descriptions over multiple lines
+
+You can add descriptions spanning multiple lines in either the general api description or routes definitions like so:
+
+```go
+// @description This is the first line
+// @description This is the second line
+// @description And so forth.
+```
### User defined structure with an array type
@@ -432,6 +472,13 @@ type Account struct {
Name string `json:"name" example:"account name"`
}
```
+### Add a headers in response
+
+```go
+// @Success 200 {string} string "ok"
+// @Header 200 {string} Location "/entity/1"
+// @Header 200 {string} Token "qwerty"
+```
### Use multiple path params
@@ -457,10 +504,130 @@ type Account struct {
```go
type Account struct {
- // ID this is userid
- ID int `json:"id"
+ // ID this is userid
+ ID int `json:"id"`
+ Name string `json:"name"` // This is Name
+}
+```
+
+### Use swaggertype tag to supported custom type
+[#201](https://github.com/swaggo/swag/issues/201#issuecomment-475479409)
+
+```go
+type TimestampTime struct {
+ time.Time
+}
+
+///implement encoding.JSON.Marshaler interface
+func (t *TimestampTime) MarshalJSON() ([]byte, error) {
+ bin := make([]byte, 16)
+ bin = strconv.AppendInt(bin[:0], t.Time.Unix(), 10)
+ return bin, nil
+}
+
+func (t *TimestampTime) UnmarshalJSON(bin []byte) error {
+ v, err := strconv.ParseInt(string(bin), 10, 64)
+ if err != nil {
+ return err
+ }
+ t.Time = time.Unix(v, 0)
+ return nil
+}
+///
+
+type Account struct {
+ // Override primitive type by simply specifying it via `swaggertype` tag
+ ID sql.NullInt64 `json:"id" swaggertype:"integer"`
+
+ // Override struct type to a primitive type 'integer' by specifying it via `swaggertype` tag
+ RegisterTime TimestampTime `json:"register_time" swaggertype:"primitive,integer"`
+
+ // Array types can be overridden using "array," format
+ Coeffs []big.Float `json:"coeffs" swaggertype:"array,number"`
+}
+```
+
+### Add extension info to struct field
+
+```go
+type Account struct {
+ ID int `json:"id" extensions:"x-nullable,x-abc=def"` // extensions fields must start with "x-"
+}
+```
+
+generate swagger doc as follows:
+
+```go
+"Account": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string",
+ "x-nullable": true,
+ "x-abc": "def"
+ }
+ }
}
```
+### How to using security annotations
+
+General API info.
+
+```go
+// @securityDefinitions.basic BasicAuth
+
+// @securitydefinitions.oauth2.application OAuth2Application
+// @tokenUrl https://example.com/oauth/token
+// @scope.write Grants write access
+// @scope.admin Grants read and write access to administrative information
+```
+
+Each API operation.
+
+```go
+// @Security ApiKeyAuth
+```
+
+Make it AND condition
+
+```go
+// @Security ApiKeyAuth
+// @Security OAuth2Application[write, admin]
+```
+
## About the Project
-This project was inspired by [yvasiyarov/swagger](https://github.com/yvasiyarov/swagger) but we simplified the usage and added support a variety of [web frameworks](#supported-web-frameworks).
+This project was inspired by [yvasiyarov/swagger](https://github.com/yvasiyarov/swagger) but we simplified the usage and added support a variety of [web frameworks](#supported-web-frameworks). Gopher image source is [tenntenn/gopher-stickers](https://github.com/tenntenn/gopher-stickers). It has licenses [creative commons licensing](http://creativecommons.org/licenses/by/3.0/deed.en).
+## Contributors
+
+This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].
+
+
+
+## Backers
+
+Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/swag#backer)]
+
+
+
+
+## Sponsors
+
+Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/swag#sponsor)]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+## License
+[](https://app.fossa.io/projects/git%2Bgithub.com%2Fswaggo%2Fswag?ref=badge_large)
diff --git a/vendor/github.com/swaggo/swag/debug.go b/vendor/github.com/swaggo/swag/debug.go
new file mode 100644
index 00000000..f28a8e65
--- /dev/null
+++ b/vendor/github.com/swaggo/swag/debug.go
@@ -0,0 +1,30 @@
+package swag
+
+import (
+ "log"
+)
+
+const (
+ test = iota
+ release
+)
+
+var swagMode = release
+
+func isRelease() bool {
+ return swagMode == release
+}
+
+// Println calls Output to print to the standard logger when release mode.
+func Println(v ...interface{}) {
+ if isRelease() {
+ log.Println(v...)
+ }
+}
+
+// Printf calls Output to print to the standard logger when release mode.
+func Printf(format string, v ...interface{}) {
+ if isRelease() {
+ log.Printf(format, v...)
+ }
+}
diff --git a/vendor/github.com/swaggo/swag/go.mod b/vendor/github.com/swaggo/swag/go.mod
new file mode 100644
index 00000000..59d5055b
--- /dev/null
+++ b/vendor/github.com/swaggo/swag/go.mod
@@ -0,0 +1,10 @@
+module github.com/swaggo/swag
+
+require (
+ github.com/ghodss/yaml v1.0.0
+ github.com/go-openapi/jsonreference v0.19.0
+ github.com/go-openapi/spec v0.19.0
+ github.com/pkg/errors v0.8.1
+ github.com/urfave/cli v1.20.0
+ golang.org/x/tools v0.0.0-20190606050223-4d9ae51c2468
+)
diff --git a/vendor/github.com/swaggo/swag/go.sum b/vendor/github.com/swaggo/swag/go.sum
new file mode 100644
index 00000000..11f29c89
--- /dev/null
+++ b/vendor/github.com/swaggo/swag/go.sum
@@ -0,0 +1,37 @@
+github.com/PuerkitoBio/purell v1.1.0 h1:rmGxhojJlM0tuKtfdvliR84CFHljx9ag64t2xmVkjK4=
+github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
+github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M=
+github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
+github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
+github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
+github.com/go-openapi/jsonpointer v0.17.0 h1:nH6xp8XdXHx8dqveo0ZuJBluCO2qGrPbDNZ0dwoRHP0=
+github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M=
+github.com/go-openapi/jsonreference v0.17.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I=
+github.com/go-openapi/jsonreference v0.19.0 h1:BqWKpV1dFd+AuiKlgtddwVIFQsuMpxfBDBHGfM2yNpk=
+github.com/go-openapi/jsonreference v0.19.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I=
+github.com/go-openapi/spec v0.19.0 h1:A4SZ6IWh3lnjH0rG0Z5lkxazMGBECtrZcbyYQi+64k4=
+github.com/go-openapi/spec v0.19.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI=
+github.com/go-openapi/swag v0.17.0 h1:iqrgMg7Q7SvtbWLlltPrkMs0UBJI6oTSs79JFRUi880=
+github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg=
+github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329 h1:2gxZ0XQIU/5z3Z3bUBu+FXuk2pFbkN6tcwi/pjyaDic=
+github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
+github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
+github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
+github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw=
+github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628=
+golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+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 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
+golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+golang.org/x/tools v0.0.0-20190606050223-4d9ae51c2468 h1:fTfk6GjmihJbK0mSUFgPPgYpsdmApQ86Mcd4GuKax9U=
+golang.org/x/tools v0.0.0-20190606050223-4d9ae51c2468/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE=
+gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
diff --git a/vendor/github.com/swaggo/swag/operation.go b/vendor/github.com/swaggo/swag/operation.go
index 2ec0c890..c4a7d572 100644
--- a/vendor/github.com/swaggo/swag/operation.go
+++ b/vendor/github.com/swaggo/swag/operation.go
@@ -5,7 +5,6 @@ import (
"go/ast"
goparser "go/parser"
"go/token"
- "log"
"net/http"
"os"
"regexp"
@@ -28,6 +27,23 @@ type Operation struct {
parser *Parser
}
+var mimeTypeAliases = map[string]string{
+ "json": "application/json",
+ "xml": "text/xml",
+ "plain": "text/plain",
+ "html": "text/html",
+ "mpfd": "multipart/form-data",
+ "x-www-form-urlencoded": "application/x-www-form-urlencoded",
+ "json-api": "application/vnd.api+json",
+ "json-stream": "application/x-json-stream",
+ "octet-stream": "application/octet-stream",
+ "png": "image/png",
+ "jpeg": "image/jpeg",
+ "gif": "image/gif",
+}
+
+var mimeTypePattern = regexp.MustCompile("^[^/]+/[^/]+$")
+
// NewOperation creates a new Operation with default properties.
// map[int]Response
func NewOperation() *Operation {
@@ -50,7 +66,11 @@ func (operation *Operation) ParseComment(comment string, astFile *ast.File) erro
lineRemainder := strings.TrimSpace(commentLine[len(attribute):])
switch strings.ToLower(attribute) {
case "@description":
- operation.Description = lineRemainder
+ if operation.Description == "" {
+ operation.Description = lineRemainder
+ } else {
+ operation.Description += "\n" + lineRemainder
+ }
case "@summary":
operation.Summary = lineRemainder
case "@id":
@@ -77,28 +97,32 @@ func (operation *Operation) ParseComment(comment string, astFile *ast.File) erro
}
}
}
-
+ case "@header":
+ if err := operation.ParseResponseHeaderComment(lineRemainder, astFile); err != nil {
+ return err
+ }
case "@router":
- if err := operation.ParseRouterComment(strings.TrimSpace(commentLine[len(attribute):])); err != nil {
+ if err := operation.ParseRouterComment(lineRemainder); err != nil {
return err
}
case "@security":
- if err := operation.ParseSecurityComment(strings.TrimSpace(commentLine[len(attribute):])); err != nil {
+ if err := operation.ParseSecurityComment(lineRemainder); err != nil {
return err
}
}
return nil
}
+var paramPattern = regexp.MustCompile(`(\S+)[\s]+([\w]+)[\s]+([\S.]+)[\s]+([\w]+)[\s]+"([^"]+)"`)
+
// ParseParamComment parses params return []string of param properties
-// @Param queryText form string true "The email for login"
-// [param name] [paramType] [data type] [is mandatory?] [Comment]
-// @Param some_id path int true "Some ID"
+// E.g. @Param queryText form string true "The email for login"
+// [param name] [paramType] [data type] [is mandatory?] [Comment]
+// E.g. @Param some_id path int true "Some ID"
func (operation *Operation) ParseParamComment(commentLine string, astFile *ast.File) error {
- re := regexp.MustCompile(`([-\w]+)[\s]+([\w]+)[\s]+([\S.]+)[\s]+([\w]+)[\s]+"([^"]+)"`)
- matches := re.FindStringSubmatch(commentLine)
+ matches := paramPattern.FindStringSubmatch(commentLine)
if len(matches) != 6 {
- return fmt.Errorf("can not parse param comment \"%s\"", commentLine)
+ return fmt.Errorf("missing required param comment parameters \"%s\"", commentLine)
}
name := matches[1]
paramType := matches[2]
@@ -117,52 +141,68 @@ func (operation *Operation) ParseParamComment(commentLine string, astFile *ast.F
param = createParameter(paramType, description, name, TransToValidSchemeType(schemaType), required)
case "body":
param = createParameter(paramType, description, name, "object", required) // TODO: if Parameter types can be objects, but also primitives and arrays
- // TODO: this snippets have to extract out
- refSplit := strings.Split(schemaType, ".")
- if len(refSplit) == 2 {
- pkgName := refSplit[0]
- typeName := refSplit[1]
- if typeSpec, ok := operation.parser.TypeDefinitions[pkgName][typeName]; ok {
- operation.parser.registerTypes[schemaType] = typeSpec
- } else {
- var typeSpec *ast.TypeSpec
- if astFile != nil {
- for _, imp := range astFile.Imports {
- if imp.Name != nil && imp.Name.Name == pkgName { // the import had an alias that matched
- break
- }
- impPath := strings.Replace(imp.Path.Value, `"`, ``, -1)
- if strings.HasSuffix(impPath, "/"+pkgName) {
- var err error
- typeSpec, err = findTypeDef(impPath, typeName)
- if err != nil {
- return errors.Wrapf(err, "can not find ref type: %q", schemaType)
- }
- break
- }
- }
- }
-
- if typeSpec == nil {
- return fmt.Errorf("can not find ref type:\"%s\"", schemaType)
- }
-
- operation.parser.TypeDefinitions[pkgName][typeName] = typeSpec
- operation.parser.registerTypes[schemaType] = typeSpec
-
- }
- param.Schema.Ref = spec.Ref{
- Ref: jsonreference.MustCreateRef("#/definitions/" + schemaType),
- }
+ if err := operation.registerSchemaType(schemaType, astFile); err != nil {
+ return err
+ }
+ param.Schema.Ref = spec.Ref{
+ Ref: jsonreference.MustCreateRef("#/definitions/" + schemaType),
}
case "formData":
param = createParameter(paramType, description, name, TransToValidSchemeType(schemaType), required)
+ default:
+ return fmt.Errorf("%s is not supported paramType", paramType)
+ }
+
+ if err := operation.parseAndExtractionParamAttribute(commentLine, schemaType, ¶m); err != nil {
+ return err
}
- param = operation.parseAndExtractionParamAttribute(commentLine, schemaType, param)
operation.Operation.Parameters = append(operation.Operation.Parameters, param)
return nil
}
+func (operation *Operation) registerSchemaType(schemaType string, astFile *ast.File) error {
+ refSplit := strings.Split(schemaType, ".")
+ if len(refSplit) != 2 {
+ return nil
+ }
+ pkgName := refSplit[0]
+ typeName := refSplit[1]
+ if typeSpec, ok := operation.parser.TypeDefinitions[pkgName][typeName]; ok {
+ operation.parser.registerTypes[schemaType] = typeSpec
+ return nil
+ }
+ var typeSpec *ast.TypeSpec
+ if astFile == nil {
+ return fmt.Errorf("can not register schema type: %q reason: astFile == nil", schemaType)
+ }
+ for _, imp := range astFile.Imports {
+ if imp.Name != nil && imp.Name.Name == pkgName { // the import had an alias that matched
+ break
+ }
+ impPath := strings.Replace(imp.Path.Value, `"`, ``, -1)
+ if strings.HasSuffix(impPath, "/"+pkgName) {
+ var err error
+ typeSpec, err = findTypeDef(impPath, typeName)
+ if err != nil {
+ return errors.Wrapf(err, "can not find type def: %q", schemaType)
+ }
+ break
+ }
+ }
+
+ if typeSpec == nil {
+ return fmt.Errorf("can not find schema type: %q", schemaType)
+ }
+
+ if _, ok := operation.parser.TypeDefinitions[pkgName]; !ok {
+ operation.parser.TypeDefinitions[pkgName] = make(map[string]*ast.TypeSpec)
+ }
+
+ operation.parser.TypeDefinitions[pkgName][typeName] = typeSpec
+ operation.parser.registerTypes[schemaType] = typeSpec
+ return nil
+}
+
var regexAttributes = map[string]*regexp.Regexp{
// for Enums(A, B)
"enums": regexp.MustCompile(`(?i)enums\(.*\)`),
@@ -180,127 +220,141 @@ var regexAttributes = map[string]*regexp.Regexp{
"format": regexp.MustCompile(`(?i)format\(.*\)`),
}
-func (operation *Operation) parseAndExtractionParamAttribute(commentLine, schemaType string, param spec.Parameter) spec.Parameter {
+func (operation *Operation) parseAndExtractionParamAttribute(commentLine, schemaType string, param *spec.Parameter) error {
schemaType = TransToValidSchemeType(schemaType)
for attrKey, re := range regexAttributes {
switch attrKey {
case "enums":
- attr := re.FindString(commentLine)
- l := strings.Index(attr, "(")
- r := strings.Index(attr, ")")
- if !(l == -1 && r == -1) {
- enums := strings.Split(attr[l+1:r], ",")
- for _, e := range enums {
- e = strings.TrimSpace(e)
- param.Enum = append(param.Enum, defineType(schemaType, e))
- }
+ enums, err := findAttrList(re, commentLine)
+ if err != nil {
+ break
}
- case "maxinum":
- attr := re.FindString(commentLine)
- l := strings.Index(attr, "(")
- r := strings.Index(attr, ")")
- if !(l == -1 && r == -1) {
- if schemaType != "integer" && schemaType != "number" {
- log.Panicf("maxinum is attribute to set to a number. comment=%s got=%s", commentLine, schemaType)
- }
- attr = strings.TrimSpace(attr[l+1 : r])
- n, err := strconv.ParseFloat(attr, 64)
+ for _, e := range enums {
+ e = strings.TrimSpace(e)
+
+ value, err := defineType(schemaType, e)
if err != nil {
- log.Panicf("maximum is allow only a number. comment=%s got=%s", commentLine, attr)
+ return err
}
- param.Maximum = &n
+ param.Enum = append(param.Enum, value)
+ }
+ case "maxinum":
+ attr, err := findAttr(re, commentLine)
+ if err != nil {
+ break
+ }
+ if schemaType != "integer" && schemaType != "number" {
+ return fmt.Errorf("maxinum is attribute to set to a number. comment=%s got=%s", commentLine, schemaType)
+ }
+ n, err := strconv.ParseFloat(attr, 64)
+ if err != nil {
+ return fmt.Errorf("maximum is allow only a number. comment=%s got=%s", commentLine, attr)
}
+ param.Maximum = &n
case "mininum":
- attr := re.FindString(commentLine)
- l := strings.Index(attr, "(")
- r := strings.Index(attr, ")")
- if !(l == -1 && r == -1) {
- if schemaType != "integer" && schemaType != "number" {
- log.Panicf("mininum is attribute to set to a number. comment=%s got=%s", commentLine, schemaType)
- }
- attr = strings.TrimSpace(attr[l+1 : r])
- n, err := strconv.ParseFloat(attr, 64)
- if err != nil {
- log.Panicf("mininum is allow only a number got=%s", attr)
- }
- param.Minimum = &n
+ attr, err := findAttr(re, commentLine)
+ if err != nil {
+ break
+ }
+ if schemaType != "integer" && schemaType != "number" {
+ return fmt.Errorf("mininum is attribute to set to a number. comment=%s got=%s", commentLine, schemaType)
}
+ n, err := strconv.ParseFloat(attr, 64)
+ if err != nil {
+ return fmt.Errorf("mininum is allow only a number got=%s", attr)
+ }
+ param.Minimum = &n
case "default":
- attr := re.FindString(commentLine)
- l := strings.Index(attr, "(")
- r := strings.Index(attr, ")")
- if !(l == -1 && r == -1) {
- attr = strings.TrimSpace(attr[l+1 : r])
- param.Default = defineType(schemaType, attr)
+ attr, err := findAttr(re, commentLine)
+ if err != nil {
+ break
+ }
+ value, err := defineType(schemaType, attr)
+ if err != nil {
+ return nil
}
+ param.Default = value
case "maxlength":
- attr := re.FindString(commentLine)
- l := strings.Index(attr, "(")
- r := strings.Index(attr, ")")
- if !(l == -1 && r == -1) {
- if schemaType != "string" {
- log.Panicf("maxlength is attribute to set to a number. comment=%s got=%s", commentLine, schemaType)
- }
- attr = strings.TrimSpace(attr[l+1 : r])
- n, err := strconv.ParseInt(attr, 10, 64)
- if err != nil {
- log.Panicf("maxlength is allow only a number got=%s", attr)
- }
- param.MaxLength = &n
+ attr, err := findAttr(re, commentLine)
+ if err != nil {
+ break
+ }
+ if schemaType != "string" {
+ return fmt.Errorf("maxlength is attribute to set to a number. comment=%s got=%s", commentLine, schemaType)
}
+ n, err := strconv.ParseInt(attr, 10, 64)
+ if err != nil {
+ return fmt.Errorf("maxlength is allow only a number got=%s", attr)
+ }
+ param.MaxLength = &n
case "minlength":
- attr := re.FindString(commentLine)
- l := strings.Index(attr, "(")
- r := strings.Index(attr, ")")
- if !(l == -1 && r == -1) {
- if schemaType != "string" {
- log.Panicf("maxlength is attribute to set to a number. comment=%s got=%s", commentLine, schemaType)
- }
- attr = strings.TrimSpace(attr[l+1 : r])
- n, err := strconv.ParseInt(attr, 10, 64)
- if err != nil {
- log.Panicf("minlength is allow only a number got=%s", attr)
- }
- param.MinLength = &n
+ attr, err := findAttr(re, commentLine)
+ if err != nil {
+ break
+ }
+ if schemaType != "string" {
+ return fmt.Errorf("maxlength is attribute to set to a number. comment=%s got=%s", commentLine, schemaType)
+ }
+ n, err := strconv.ParseInt(attr, 10, 64)
+ if err != nil {
+ return fmt.Errorf("minlength is allow only a number got=%s", attr)
}
+ param.MinLength = &n
case "format":
- attr := re.FindString(commentLine)
- l := strings.Index(attr, "(")
- r := strings.Index(attr, ")")
- if !(l == -1 && r == -1) {
- param.Format = strings.TrimSpace(attr[l+1 : r])
+ attr, err := findAttr(re, commentLine)
+ if err != nil {
+ break
}
+ param.Format = attr
}
}
- return param
+ return nil
+}
+
+func findAttr(re *regexp.Regexp, commentLine string) (string, error) {
+ attr := re.FindString(commentLine)
+ l := strings.Index(attr, "(")
+ r := strings.Index(attr, ")")
+ if l == -1 || r == -1 {
+ return "", fmt.Errorf("can not find regex=%s, comment=%s", re.String(), commentLine)
+ }
+ return strings.TrimSpace(attr[l+1 : r]), nil
+}
+
+func findAttrList(re *regexp.Regexp, commentLine string) ([]string, error) {
+ attr, err := findAttr(re, commentLine)
+ if err != nil {
+ return []string{""}, err
+ }
+ return strings.Split(attr, ","), nil
}
// defineType enum value define the type (object and array unsupported)
-func defineType(schemaType string, value string) interface{} {
+func defineType(schemaType string, value string) (interface{}, error) {
schemaType = TransToValidSchemeType(schemaType)
switch schemaType {
case "string":
- return value
+ return value, nil
case "number":
v, err := strconv.ParseFloat(value, 64)
if err != nil {
- panic(fmt.Errorf("enum value %s can't convert to %s err: %s", value, schemaType, err))
+ return nil, fmt.Errorf("enum value %s can't convert to %s err: %s", value, schemaType, err)
}
- return v
+ return v, nil
case "integer":
v, err := strconv.Atoi(value)
if err != nil {
- panic(fmt.Errorf("enum value %s can't convert to %s err: %s", value, schemaType, err))
+ return nil, fmt.Errorf("enum value %s can't convert to %s err: %s", value, schemaType, err)
}
- return v
+ return v, nil
case "boolean":
v, err := strconv.ParseBool(value)
if err != nil {
- panic(fmt.Errorf("enum value %s can't convert to %s err: %s", value, schemaType, err))
+ return nil, fmt.Errorf("enum value %s can't convert to %s err: %s", value, schemaType, err)
}
- return v
+ return v, nil
default:
- panic(fmt.Errorf("%s is unsupported type in enum value", schemaType))
+ return nil, fmt.Errorf("%s is unsupported type in enum value", schemaType)
}
}
@@ -314,82 +368,40 @@ func (operation *Operation) ParseTagsComment(commentLine string) {
// ParseAcceptComment parses comment for given `accept` comment string.
func (operation *Operation) ParseAcceptComment(commentLine string) error {
- accepts := strings.Split(commentLine, ",")
- for _, a := range accepts {
- switch a {
- case "json", "application/json":
- operation.Consumes = append(operation.Consumes, "application/json")
- case "xml", "text/xml":
- operation.Consumes = append(operation.Consumes, "text/xml")
- case "plain", "text/plain":
- operation.Consumes = append(operation.Consumes, "text/plain")
- case "html", "text/html":
- operation.Consumes = append(operation.Consumes, "text/html")
- case "mpfd", "multipart/form-data":
- operation.Consumes = append(operation.Consumes, "multipart/form-data")
- case "x-www-form-urlencoded", "application/x-www-form-urlencoded":
- operation.Consumes = append(operation.Consumes, "application/x-www-form-urlencoded")
- case "json-api", "application/vnd.api+json":
- operation.Consumes = append(operation.Consumes, "application/vnd.api+json")
- case "json-stream", "application/x-json-stream":
- operation.Consumes = append(operation.Consumes, "application/x-json-stream")
- case "octet-stream", "application/octet-stream":
- operation.Consumes = append(operation.Consumes, "application/octet-stream")
- case "png", "image/png":
- operation.Consumes = append(operation.Consumes, "image/png")
- case "jpeg", "image/jpeg":
- operation.Consumes = append(operation.Consumes, "image/jpeg")
- case "gif", "image/gif":
- operation.Consumes = append(operation.Consumes, "image/gif")
- default:
- return fmt.Errorf("%v accept type can't accepted", a)
- }
- }
- return nil
+ return parseMimeTypeList(commentLine, &operation.Consumes, "%v accept type can't be accepted")
}
-// ParseProduceComment parses comment for gived `produce` comment string.
+// ParseProduceComment parses comment for given `produce` comment string.
func (operation *Operation) ParseProduceComment(commentLine string) error {
- produces := strings.Split(commentLine, ",")
- for _, a := range produces {
- switch a {
- case "json", "application/json":
- operation.Produces = append(operation.Produces, "application/json")
- case "xml", "text/xml":
- operation.Produces = append(operation.Produces, "text/xml")
- case "plain", "text/plain":
- operation.Produces = append(operation.Produces, "text/plain")
- case "html", "text/html":
- operation.Produces = append(operation.Produces, "text/html")
- case "mpfd", "multipart/form-data":
- operation.Produces = append(operation.Produces, "multipart/form-data")
- case "x-www-form-urlencoded", "application/x-www-form-urlencoded":
- operation.Produces = append(operation.Produces, "application/x-www-form-urlencoded")
- case "json-api", "application/vnd.api+json":
- operation.Produces = append(operation.Produces, "application/vnd.api+json")
- case "json-stream", "application/x-json-stream":
- operation.Produces = append(operation.Produces, "application/x-json-stream")
- case "octet-stream", "application/octet-stream":
- operation.Produces = append(operation.Produces, "application/octet-stream")
- case "png", "image/png":
- operation.Produces = append(operation.Produces, "image/png")
- case "jpeg", "image/jpeg":
- operation.Produces = append(operation.Produces, "image/jpeg")
- case "gif", "image/gif":
- operation.Produces = append(operation.Produces, "image/gif")
- default:
- return fmt.Errorf("%v produce type can't accepted", a)
+ return parseMimeTypeList(commentLine, &operation.Produces, "%v produce type can't be accepted")
+}
+
+// parseMimeTypeList parses a list of MIME Types for a comment like
+// `produce` (`Content-Type:` response header) or
+// `accept` (`Accept:` request header)
+func parseMimeTypeList(mimeTypeList string, typeList *[]string, format string) error {
+ mimeTypes := strings.Split(mimeTypeList, ",")
+ for _, typeName := range mimeTypes {
+ if mimeTypePattern.MatchString(typeName) {
+ *typeList = append(*typeList, typeName)
+ continue
}
+ if aliasMimeType, ok := mimeTypeAliases[typeName]; ok {
+ *typeList = append(*typeList, aliasMimeType)
+ continue
+ }
+ return fmt.Errorf(format, typeName)
}
return nil
}
+var routerPattern = regexp.MustCompile(`([\w\.\/\-{}\+]+)[^\[]+\[([^\]]+)`)
+
// ParseRouterComment parses comment for gived `router` comment string.
func (operation *Operation) ParseRouterComment(commentLine string) error {
- re := regexp.MustCompile(`([\w\.\/\-{}]+)[^\[]+\[([^\]]+)`)
var matches []string
- if matches = re.FindStringSubmatch(commentLine); len(matches) != 3 {
+ if matches = routerPattern.FindStringSubmatch(commentLine); len(matches) != 3 {
return fmt.Errorf("can not parse router comment \"%s\"", commentLine)
}
path := matches[1]
@@ -429,6 +441,7 @@ func (operation *Operation) ParseSecurityComment(commentLine string) error {
// findTypeDef attempts to find the *ast.TypeSpec for a specific type given the
// type's name and the package's import path
+// TODO: improve finding external pkg
func findTypeDef(importPath, typeName string) (*ast.TypeSpec, error) {
cwd, err := os.Getwd()
if err != nil {
@@ -481,12 +494,13 @@ func findTypeDef(importPath, typeName string) (*ast.TypeSpec, error) {
return nil, errors.New("type spec not found")
}
+var responsePattern = regexp.MustCompile(`([\d]+)[\s]+([\w\{\}]+)[\s]+([\w\-\.\/]+)[^"]*(.*)?`)
+
// ParseResponseComment parses comment for gived `response` comment string.
func (operation *Operation) ParseResponseComment(commentLine string, astFile *ast.File) error {
- re := regexp.MustCompile(`([\d]+)[\s]+([\w\{\}]+)[\s]+([\w\-\.\/]+)[^"]*(.*)?`)
var matches []string
- if matches = re.FindStringSubmatch(commentLine); len(matches) != 5 {
+ if matches = responsePattern.FindStringSubmatch(commentLine); len(matches) != 5 {
return fmt.Errorf("can not parse response comment \"%s\"", commentLine)
}
@@ -504,46 +518,8 @@ func (operation *Operation) ParseResponseComment(commentLine string, astFile *as
refType := matches[3]
if operation.parser != nil { // checking refType has existing in 'TypeDefinitions'
- refSplit := strings.Split(refType, ".")
- if len(refSplit) == 2 {
- pkgName := refSplit[0]
- typeName := refSplit[1]
-
- if typeSpec, ok := operation.parser.TypeDefinitions[pkgName][typeName]; ok {
- operation.parser.registerTypes[refType] = typeSpec
- } else {
- var typeSpec *ast.TypeSpec
- if astFile != nil {
- for _, imp := range astFile.Imports {
- if imp.Name != nil && imp.Name.Name == pkgName { // the import had an alias that matched
- break
- }
- impPath := strings.Replace(imp.Path.Value, `"`, ``, -1)
-
- if strings.HasSuffix(impPath, "/"+pkgName) {
- var err error
-
- typeSpec, err = findTypeDef(impPath, typeName)
- if err != nil {
- return errors.Wrapf(err, "can not find ref type: %q", refType)
- }
- break
- }
- }
- }
-
- if typeSpec == nil {
- return fmt.Errorf("can not find ref type: %q", refType)
- }
-
- if _, ok := operation.parser.TypeDefinitions[pkgName]; !ok {
- operation.parser.TypeDefinitions[pkgName] = make(map[string]*ast.TypeSpec)
-
- }
- operation.parser.TypeDefinitions[pkgName][typeName] = typeSpec
- operation.parser.registerTypes[refType] = typeSpec
- }
-
+ if err := operation.registerSchemaType(refType, astFile); err != nil {
+ return err
}
}
@@ -591,12 +567,59 @@ func (operation *Operation) ParseResponseComment(commentLine string, astFile *as
return nil
}
+// ParseResponseHeaderComment parses comment for gived `response header` comment string.
+func (operation *Operation) ParseResponseHeaderComment(commentLine string, astFile *ast.File) error {
+ var matches []string
+
+ if matches = responsePattern.FindStringSubmatch(commentLine); len(matches) != 5 {
+ return fmt.Errorf("can not parse response comment \"%s\"", commentLine)
+ }
+
+ response := spec.Response{}
+
+ code, _ := strconv.Atoi(matches[1])
+
+ responseDescription := strings.Trim(matches[4], "\"")
+ if responseDescription == "" {
+ responseDescription = http.StatusText(code)
+ }
+ response.Description = responseDescription
+
+ schemaType := strings.Trim(matches[2], "{}")
+ refType := matches[3]
+
+ if operation.Responses == nil {
+ operation.Responses = &spec.Responses{
+ ResponsesProps: spec.ResponsesProps{
+ StatusCodeResponses: make(map[int]spec.Response),
+ },
+ }
+ }
+
+ response, responseExist := operation.Responses.StatusCodeResponses[code]
+ if responseExist {
+ header := spec.Header{}
+ header.Description = responseDescription
+ header.Type = schemaType
+
+ if response.Headers == nil {
+ response.Headers = make(map[string]spec.Header)
+ }
+ response.Headers[refType] = header
+
+ operation.Responses.StatusCodeResponses[code] = response
+ }
+
+ return nil
+}
+
+var emptyResponsePattern = regexp.MustCompile(`([\d]+)[\s]+"(.*)"`)
+
// ParseEmptyResponseComment parse only comment out status code and description,eg: @Success 200 "it's ok"
func (operation *Operation) ParseEmptyResponseComment(commentLine string) error {
- re := regexp.MustCompile(`([\d]+)[\s]+"(.*)"`)
var matches []string
- if matches = re.FindStringSubmatch(commentLine); len(matches) != 3 {
+ if matches = emptyResponsePattern.FindStringSubmatch(commentLine); len(matches) != 3 {
return fmt.Errorf("can not parse response comment \"%s\"", commentLine)
}
diff --git a/vendor/github.com/swaggo/swag/parser.go b/vendor/github.com/swaggo/swag/parser.go
index a8a7e05b..85887b8d 100644
--- a/vendor/github.com/swaggo/swag/parser.go
+++ b/vendor/github.com/swaggo/swag/parser.go
@@ -5,18 +5,19 @@ import (
"go/ast"
goparser "go/parser"
"go/token"
- "log"
"net/http"
"os"
"path"
"path/filepath"
"reflect"
+ "sort"
"strconv"
"strings"
"unicode"
"github.com/go-openapi/jsonreference"
"github.com/go-openapi/spec"
+ "github.com/pkg/errors"
)
const (
@@ -48,6 +49,11 @@ type Parser struct {
registerTypes map[string]*ast.TypeSpec
PropNamingStrategy string
+
+ ParseVendor bool
+
+ // structStack stores full names of the structures that were already parsed or are being parsed now
+ structStack []string
}
// New creates a new Parser with default properties.
@@ -76,46 +82,67 @@ func New() *Parser {
}
// ParseAPI parses general api info for gived searchDir and mainAPIFile
-func (parser *Parser) ParseAPI(searchDir string, mainAPIFile string) {
- log.Println("Generate general API Info")
- parser.getAllGoFileInfo(searchDir)
+func (parser *Parser) ParseAPI(searchDir string, mainAPIFile string) error {
+ Println("Generate general API Info")
+ if err := parser.getAllGoFileInfo(searchDir); err != nil {
+ return err
+ }
parser.ParseGeneralAPIInfo(path.Join(searchDir, mainAPIFile))
for _, astFile := range parser.files {
parser.ParseType(astFile)
}
- for _, astFile := range parser.files {
- parser.ParseRouterAPIInfo(astFile)
+ for fileName, astFile := range parser.files {
+ if err := parser.ParseRouterAPIInfo(fileName, astFile); err != nil {
+ return err
+ }
}
parser.ParseDefinitions()
+
+ return nil
}
// ParseGeneralAPIInfo parses general api info for gived mainAPIFile path
-func (parser *Parser) ParseGeneralAPIInfo(mainAPIFile string) {
+func (parser *Parser) ParseGeneralAPIInfo(mainAPIFile string) error {
fileSet := token.NewFileSet()
fileTree, err := goparser.ParseFile(fileSet, mainAPIFile, nil, goparser.ParseComments)
-
if err != nil {
- log.Panicf("ParseGeneralApiInfo occur error:%+v", err)
+ return errors.Wrap(err, "cannot parse soure files")
}
parser.swagger.Swagger = "2.0"
securityMap := map[string]*spec.SecurityScheme{}
+ // templated defaults
+ parser.swagger.Info.Version = "{{.Version}}"
+ parser.swagger.Info.Title = "{{.Title}}"
+ parser.swagger.Info.Description = "{{.Description}}"
+ parser.swagger.Host = "{{.Host}}"
+ parser.swagger.BasePath = "{{.BasePath}}"
+
if fileTree.Comments != nil {
for _, comment := range fileTree.Comments {
comments := strings.Split(comment.Text(), "\n")
+ previousAttribute := ""
for _, commentLine := range comments {
attribute := strings.ToLower(strings.Split(commentLine, " ")[0])
+ multilineBlock := false
+ if previousAttribute == attribute {
+ multilineBlock = true
+ }
switch attribute {
case "@version":
parser.swagger.Info.Version = strings.TrimSpace(commentLine[len(attribute):])
case "@title":
parser.swagger.Info.Title = strings.TrimSpace(commentLine[len(attribute):])
case "@description":
- parser.swagger.Info.Description = strings.TrimSpace(commentLine[len(attribute):])
+ if parser.swagger.Info.Description == "{{.Description}}" {
+ parser.swagger.Info.Description = strings.TrimSpace(commentLine[len(attribute):])
+ } else if multilineBlock {
+ parser.swagger.Info.Description += "\n" + strings.TrimSpace(commentLine[len(attribute):])
+ }
case "@termsofservice":
parser.swagger.Info.TermsOfService = strings.TrimSpace(commentLine[len(attribute):])
case "@contact.name":
@@ -133,8 +160,37 @@ func (parser *Parser) ParseGeneralAPIInfo(mainAPIFile string) {
case "@basepath":
parser.swagger.BasePath = strings.TrimSpace(commentLine[len(attribute):])
case "@schemes":
- parser.swagger.Schemes = GetSchemes(commentLine)
+ parser.swagger.Schemes = getSchemes(commentLine)
+ case "@tag.name":
+ commentInfo := strings.TrimSpace(commentLine[len(attribute):])
+ parser.swagger.Tags = append(parser.swagger.Tags, spec.Tag{
+ TagProps: spec.TagProps{
+ Name: strings.TrimSpace(commentInfo),
+ },
+ })
+ case "@tag.description":
+ commentInfo := strings.TrimSpace(commentLine[len(attribute):])
+ tag := parser.swagger.Tags[len(parser.swagger.Tags)-1]
+ tag.TagProps.Description = commentInfo
+ replaceLastTag(parser.swagger.Tags, tag)
+ case "@tag.docs.url":
+ commentInfo := strings.TrimSpace(commentLine[len(attribute):])
+ tag := parser.swagger.Tags[len(parser.swagger.Tags)-1]
+ tag.TagProps.ExternalDocs = &spec.ExternalDocumentation{
+ URL: commentInfo,
+ }
+ replaceLastTag(parser.swagger.Tags, tag)
+
+ case "@tag.docs.description":
+ commentInfo := strings.TrimSpace(commentLine[len(attribute):])
+ tag := parser.swagger.Tags[len(parser.swagger.Tags)-1]
+ if tag.TagProps.ExternalDocs == nil {
+ return errors.New("@tag.docs.description needs to come after a @tags.docs.url")
+ }
+ tag.TagProps.ExternalDocs.Description = commentInfo
+ replaceLastTag(parser.swagger.Tags, tag)
}
+ previousAttribute = attribute
}
for i := 0; i < len(comments); i++ {
@@ -155,7 +211,7 @@ func (parser *Parser) ParseGeneralAPIInfo(mainAPIFile string) {
}
}
if len(attrMap) != 2 {
- log.Panic("@securitydefinitions.apikey is @name and @in required")
+ return errors.New("@securitydefinitions.apikey is @name and @in required")
}
securityMap[strings.TrimSpace(comments[i][len(attribute):])] = spec.APIKeyAuth(attrMap["@name"], attrMap["@in"])
case "@securitydefinitions.oauth2.application":
@@ -165,8 +221,18 @@ func (parser *Parser) ParseGeneralAPIInfo(mainAPIFile string) {
securityAttr := strings.ToLower(strings.Split(v, " ")[0])
if securityAttr == "@tokenurl" {
attrMap[securityAttr] = strings.TrimSpace(v[len(securityAttr):])
- } else if isExistsScope(securityAttr) {
- scopes[getScopeScheme(securityAttr)] = v[len(securityAttr):]
+ } else {
+ isExists, err := isExistsScope(securityAttr)
+ if err != nil {
+ return err
+ }
+ if isExists {
+ scopScheme, err := getScopeScheme(securityAttr)
+ if err != nil {
+ return err
+ }
+ scopes[scopScheme] = v[len(securityAttr):]
+ }
}
// next securityDefinitions
if strings.Index(securityAttr, "@securitydefinitions.") == 0 {
@@ -174,7 +240,7 @@ func (parser *Parser) ParseGeneralAPIInfo(mainAPIFile string) {
}
}
if len(attrMap) != 1 {
- log.Panic("@securitydefinitions.oauth2.application is @tokenUrl required")
+ return errors.New("@securitydefinitions.oauth2.application is @tokenUrl required")
}
securityScheme := spec.OAuth2Application(attrMap["@tokenurl"])
for scope, description := range scopes {
@@ -188,8 +254,18 @@ func (parser *Parser) ParseGeneralAPIInfo(mainAPIFile string) {
securityAttr := strings.ToLower(strings.Split(v, " ")[0])
if securityAttr == "@authorizationurl" {
attrMap[securityAttr] = strings.TrimSpace(v[len(securityAttr):])
- } else if isExistsScope(securityAttr) {
- scopes[getScopeScheme(securityAttr)] = v[len(securityAttr):]
+ } else {
+ isExists, err := isExistsScope(securityAttr)
+ if err != nil {
+ return err
+ }
+ if isExists {
+ scopScheme, err := getScopeScheme(securityAttr)
+ if err != nil {
+ return err
+ }
+ scopes[scopScheme] = v[len(securityAttr):]
+ }
}
// next securityDefinitions
if strings.Index(securityAttr, "@securitydefinitions.") == 0 {
@@ -197,7 +273,7 @@ func (parser *Parser) ParseGeneralAPIInfo(mainAPIFile string) {
}
}
if len(attrMap) != 1 {
- log.Panic("@securitydefinitions.oauth2.implicit is @authorizationUrl required")
+ return errors.New("@securitydefinitions.oauth2.implicit is @authorizationUrl required")
}
securityScheme := spec.OAuth2Implicit(attrMap["@authorizationurl"])
for scope, description := range scopes {
@@ -211,8 +287,18 @@ func (parser *Parser) ParseGeneralAPIInfo(mainAPIFile string) {
securityAttr := strings.ToLower(strings.Split(v, " ")[0])
if securityAttr == "@tokenurl" {
attrMap[securityAttr] = strings.TrimSpace(v[len(securityAttr):])
- } else if isExistsScope(securityAttr) {
- scopes[getScopeScheme(securityAttr)] = v[len(securityAttr):]
+ } else {
+ isExists, err := isExistsScope(securityAttr)
+ if err != nil {
+ return err
+ }
+ if isExists {
+ scopScheme, err := getScopeScheme(securityAttr)
+ if err != nil {
+ return err
+ }
+ scopes[scopScheme] = v[len(securityAttr):]
+ }
}
// next securityDefinitions
if strings.Index(securityAttr, "@securitydefinitions.") == 0 {
@@ -220,7 +306,7 @@ func (parser *Parser) ParseGeneralAPIInfo(mainAPIFile string) {
}
}
if len(attrMap) != 1 {
- log.Panic("@securitydefinitions.oauth2.password is @tokenUrl required")
+ return errors.New("@securitydefinitions.oauth2.password is @tokenUrl required")
}
securityScheme := spec.OAuth2Password(attrMap["@tokenurl"])
for scope, description := range scopes {
@@ -234,8 +320,18 @@ func (parser *Parser) ParseGeneralAPIInfo(mainAPIFile string) {
securityAttr := strings.ToLower(strings.Split(v, " ")[0])
if securityAttr == "@tokenurl" || securityAttr == "@authorizationurl" {
attrMap[securityAttr] = strings.TrimSpace(v[len(securityAttr):])
- } else if isExistsScope(securityAttr) {
- scopes[getScopeScheme(securityAttr)] = v[len(securityAttr):]
+ } else {
+ isExists, err := isExistsScope(securityAttr)
+ if err != nil {
+ return err
+ }
+ if isExists {
+ scopScheme, err := getScopeScheme(securityAttr)
+ if err != nil {
+ return err
+ }
+ scopes[scopScheme] = v[len(securityAttr):]
+ }
}
// next securityDefinitions
if strings.Index(securityAttr, "@securitydefinitions.") == 0 {
@@ -243,7 +339,7 @@ func (parser *Parser) ParseGeneralAPIInfo(mainAPIFile string) {
}
}
if len(attrMap) != 2 {
- log.Panic("@securitydefinitions.oauth2.accessCode is @tokenUrl and @authorizationUrl required")
+ return errors.New("@securitydefinitions.oauth2.accessCode is @tokenUrl and @authorizationUrl required")
}
securityScheme := spec.OAuth2AccessToken(attrMap["@authorizationurl"], attrMap["@tokenurl"])
for scope, description := range scopes {
@@ -257,36 +353,38 @@ func (parser *Parser) ParseGeneralAPIInfo(mainAPIFile string) {
if len(securityMap) > 0 {
parser.swagger.SecurityDefinitions = securityMap
}
+
+ return nil
}
-func getScopeScheme(scope string) string {
+func getScopeScheme(scope string) (string, error) {
scopeValue := scope[strings.Index(scope, "@scope."):]
if scopeValue == "" {
- panic("@scope is empty")
+ return "", errors.New("@scope is empty")
}
- return scope[len("@scope."):]
+ return scope[len("@scope."):], nil
}
-func isExistsScope(scope string) bool {
+func isExistsScope(scope string) (bool, error) {
s := strings.Fields(scope)
for _, v := range s {
if strings.Index(v, "@scope.") != -1 {
if strings.Index(v, ",") != -1 {
- panic("@scope can't use comma(,) get=" + v)
+ return false, fmt.Errorf("@scope can't use comma(,) get=" + v)
}
}
}
- return strings.Index(scope, "@scope.") != -1
+ return strings.Index(scope, "@scope.") != -1, nil
}
-// GetSchemes parses swagger schemes for given commentLine
-func GetSchemes(commentLine string) []string {
+// getSchemes parses swagger schemes for given commentLine
+func getSchemes(commentLine string) []string {
attribute := strings.ToLower(strings.Split(commentLine, " ")[0])
return strings.Split(strings.TrimSpace(commentLine[len(attribute):]), " ")
}
// ParseRouterAPIInfo parses router api info for given astFile
-func (parser *Parser) ParseRouterAPIInfo(astFile *ast.File) {
+func (parser *Parser) ParseRouterAPIInfo(fileName string, astFile *ast.File) error {
for _, astDescription := range astFile.Decls {
switch astDeclaration := astDescription.(type) {
case *ast.FuncDecl:
@@ -295,7 +393,7 @@ func (parser *Parser) ParseRouterAPIInfo(astFile *ast.File) {
operation.parser = parser
for _, comment := range astDeclaration.Doc.List {
if err := operation.ParseComment(comment.Text, astFile); err != nil {
- log.Panicf("ParseComment panic:%+v", err)
+ return fmt.Errorf("ParseComment error in file %s :%+v", fileName, err)
}
}
var pathItem spec.PathItem
@@ -325,6 +423,8 @@ func (parser *Parser) ParseRouterAPIInfo(astFile *ast.File) {
}
}
}
+
+ return nil
}
// ParseType parses type info for given astFile.
@@ -340,7 +440,7 @@ func (parser *Parser) ParseType(astFile *ast.File) {
typeName := fmt.Sprintf("%v", typeSpec.Type)
// check if its a custom primitive type
if IsGolangPrimitiveType(typeName) {
- parser.CustomPrimitiveTypes[typeSpec.Name.String()] = typeName
+ parser.CustomPrimitiveTypes[typeSpec.Name.String()] = TransToValidSchemeType(typeName)
} else {
parser.TypeDefinitions[astFile.Name.String()][typeSpec.Name.String()] = typeSpec
}
@@ -351,99 +451,224 @@ func (parser *Parser) ParseType(astFile *ast.File) {
}
}
+func (parser *Parser) isInStructStack(refTypeName string) bool {
+ for _, structName := range parser.structStack {
+ if refTypeName == structName {
+ return true
+ }
+ }
+ return false
+}
+
// ParseDefinitions parses Swagger Api definitions.
func (parser *Parser) ParseDefinitions() {
- for refTypeName, typeSpec := range parser.registerTypes {
+ // sort the typeNames so that parsing definitions is deterministic
+ typeNames := make([]string, 0, len(parser.registerTypes))
+ for refTypeName := range parser.registerTypes {
+ typeNames = append(typeNames, refTypeName)
+ }
+ sort.Strings(typeNames)
+
+ for _, refTypeName := range typeNames {
+ typeSpec := parser.registerTypes[refTypeName]
ss := strings.Split(refTypeName, ".")
pkgName := ss[0]
- parser.ParseDefinition(pkgName, typeSpec, typeSpec.Name.Name)
+ parser.structStack = nil
+ parser.ParseDefinition(pkgName, typeSpec.Name.Name, typeSpec)
}
}
-var structStacks []string
+// ParseDefinition parses given type spec that corresponds to the type under
+// given name and package, and populates swagger schema definitions registry
+// with a schema for the given type
+func (parser *Parser) ParseDefinition(pkgName, typeName string, typeSpec *ast.TypeSpec) error {
+ refTypeName := fullTypeName(pkgName, typeName)
+ if _, isParsed := parser.swagger.Definitions[refTypeName]; isParsed {
+ Println("Skipping '" + refTypeName + "', already parsed.")
+ return nil
+ }
-// isNotRecurringNestStruct check if a structure that is not a not repeating
-func isNotRecurringNestStruct(refTypeName string, structStacks []string) bool {
- if len(structStacks) <= 0 {
- return true
+ if parser.isInStructStack(refTypeName) {
+ Println("Skipping '" + refTypeName + "', recursion detected.")
+ return nil
}
- startStruct := structStacks[0]
- for _, v := range structStacks[1:] {
- if startStruct == v {
- return false
- }
+ parser.structStack = append(parser.structStack, refTypeName)
+
+ Println("Generating " + refTypeName)
+
+ schema, err := parser.parseTypeExpr(pkgName, typeName, typeSpec.Type)
+ if err != nil {
+ return err
}
- return true
+ parser.swagger.Definitions[refTypeName] = schema
+ return nil
}
-// ParseDefinition TODO: NEEDS COMMENT INFO
-func (parser *Parser) ParseDefinition(pkgName string, typeSpec *ast.TypeSpec, typeName string) {
- var refTypeName string
- if len(pkgName) > 0 {
- refTypeName = pkgName + "." + typeName
- } else {
- refTypeName = typeName
- }
- if _, already := parser.swagger.Definitions[refTypeName]; already {
- log.Println("Skipping '" + refTypeName + "', already present.")
- return
- }
- properties := make(map[string]spec.Schema)
- // stop repetitive structural parsing
- if isNotRecurringNestStruct(refTypeName, structStacks) {
- structStacks = append(structStacks, refTypeName)
- parser.parseTypeSpec(pkgName, typeSpec, properties)
+func (parser *Parser) collectRequiredFields(pkgName string, properties map[string]spec.Schema, extraRequired []string) (requiredFields []string) {
+ // created sorted list of properties keys so when we iterate over them it's deterministic
+ ks := make([]string, 0, len(properties))
+ for k := range properties {
+ ks = append(ks, k)
}
- structStacks = []string{}
+ sort.Strings(ks)
+
+ requiredFields = make([]string, 0)
+
+ // iterate over keys list instead of map to avoid the random shuffle of the order that go does for maps
+ for _, k := range ks {
+ prop := properties[k]
- requiredFields := make([]string, 0)
- for k, prop := range properties {
// todo find the pkgName of the property type
tname := prop.SchemaProps.Type[0]
if _, ok := parser.TypeDefinitions[pkgName][tname]; ok {
tspec := parser.TypeDefinitions[pkgName][tname]
- parser.ParseDefinition(pkgName, tspec, tname)
+ parser.ParseDefinition(pkgName, tname, tspec)
}
if tname != "object" {
requiredFields = append(requiredFields, prop.SchemaProps.Required...)
- prop.SchemaProps.Required = make([]string, 0)
}
properties[k] = prop
}
- log.Println("Generating " + refTypeName)
- parser.swagger.Definitions[refTypeName] = spec.Schema{
- SchemaProps: spec.SchemaProps{
- Type: []string{"object"},
- Properties: properties,
- Required: requiredFields,
- },
+
+ if extraRequired != nil {
+ requiredFields = append(requiredFields, extraRequired...)
+ }
+
+ sort.Strings(requiredFields)
+
+ return
+}
+
+func fullTypeName(pkgName, typeName string) string {
+ if pkgName != "" {
+ return pkgName + "." + typeName
}
+ return typeName
}
-func (parser *Parser) parseTypeSpec(pkgName string, typeSpec *ast.TypeSpec, properties map[string]spec.Schema) {
- switch typeSpec.Type.(type) {
+// parseTypeExpr parses given type expression that corresponds to the type under
+// given name and package, and returns swagger schema for it.
+func (parser *Parser) parseTypeExpr(pkgName, typeName string, typeExpr ast.Expr) (spec.Schema, error) {
+ //TODO: return pointer to spec.Schema
+
+ switch expr := typeExpr.(type) {
+ // type Foo struct {...}
case *ast.StructType:
- structDecl := typeSpec.Type.(*ast.StructType)
- fields := structDecl.Fields.List
+ refTypeName := fullTypeName(pkgName, typeName)
+ if schema, isParsed := parser.swagger.Definitions[refTypeName]; isParsed {
+ return schema, nil
+ }
- for _, field := range fields {
- if field.Names == nil { //anonymous field
- parser.parseAnonymousField(pkgName, field, properties)
+ extraRequired := make([]string, 0)
+ properties := make(map[string]spec.Schema)
+ for _, field := range expr.Fields.List {
+ var fieldProps map[string]spec.Schema
+ var requiredFromAnon []string
+ if field.Names == nil {
+ var err error
+ fieldProps, requiredFromAnon, err = parser.parseAnonymousField(pkgName, field)
+ if err != nil {
+ return spec.Schema{}, err
+ }
+ extraRequired = append(extraRequired, requiredFromAnon...)
} else {
- props := parser.parseStruct(pkgName, field)
- for k, v := range props {
- properties[k] = v
+ var err error
+ fieldProps, err = parser.parseStruct(pkgName, field)
+ if err != nil {
+ return spec.Schema{}, err
}
}
+
+ for k, v := range fieldProps {
+ properties[k] = v
+ }
+ }
+
+ // collect requireds from our properties and anonymous fields
+ required := parser.collectRequiredFields(pkgName, properties, extraRequired)
+
+ // unset required from properties because we've collected them
+ for k, prop := range properties {
+ tname := prop.SchemaProps.Type[0]
+ if tname != "object" {
+ prop.SchemaProps.Required = make([]string, 0)
+ }
+ properties[k] = prop
+ }
+
+ return spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Type: []string{"object"},
+ Properties: properties,
+ Required: required,
+ }}, nil
+
+ // type Foo Baz
+ case *ast.Ident:
+ refTypeName := fullTypeName(pkgName, expr.Name)
+ if _, isParsed := parser.swagger.Definitions[refTypeName]; !isParsed {
+ if typedef, ok := parser.TypeDefinitions[pkgName][expr.Name]; ok {
+ parser.ParseDefinition(pkgName, expr.Name, typedef)
+ }
}
+ return parser.swagger.Definitions[refTypeName], nil
+
+ // type Foo *Baz
+ case *ast.StarExpr:
+ return parser.parseTypeExpr(pkgName, typeName, expr.X)
+ // type Foo []Baz
case *ast.ArrayType:
- log.Panic("ParseDefinitions not supported 'Array' yet.")
- case *ast.InterfaceType:
- log.Panic("ParseDefinitions not supported 'Interface' yet.")
+ itemSchema, err := parser.parseTypeExpr(pkgName, "", expr.Elt)
+ if err != nil {
+ return spec.Schema{}, err
+ }
+ return spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Type: []string{"array"},
+ Items: &spec.SchemaOrArray{
+ Schema: &itemSchema,
+ },
+ },
+ }, nil
+
+ // type Foo pkg.Bar
+ case *ast.SelectorExpr:
+ if xIdent, ok := expr.X.(*ast.Ident); ok {
+ pkgName = xIdent.Name
+ typeName = expr.Sel.Name
+ refTypeName := fullTypeName(pkgName, typeName)
+ if _, isParsed := parser.swagger.Definitions[refTypeName]; !isParsed {
+ typedef := parser.TypeDefinitions[pkgName][typeName]
+ parser.ParseDefinition(pkgName, typeName, typedef)
+ }
+ return parser.swagger.Definitions[refTypeName], nil
+ }
+
+ // type Foo map[string]Bar
case *ast.MapType:
- log.Panic("ParseDefinitions not supported 'Map' yet.")
+ itemSchema, err := parser.parseTypeExpr(pkgName, "", expr.Value)
+ if err != nil {
+ return spec.Schema{}, err
+ }
+ return spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Type: []string{"object"},
+ AdditionalProperties: &spec.SchemaOrBool{
+ Schema: &itemSchema,
+ },
+ },
+ }, nil
+ // ...
+ default:
+ Printf("Type definition of type '%T' is not supported yet. Using 'object' instead.\n", typeExpr)
}
+
+ return spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Type: []string{"object"},
+ },
+ }, nil
}
type structField struct {
@@ -454,18 +679,31 @@ type structField struct {
isRequired bool
crossPkg string
exampleValue interface{}
+ maximum *float64
+ minimum *float64
+ maxLength *int64
+ minLength *int64
+ enums []interface{}
+ defaultValue interface{}
+ extensions map[string]interface{}
}
-func (parser *Parser) parseStruct(pkgName string, field *ast.Field) (properties map[string]spec.Schema) {
- properties = map[string]spec.Schema{}
- structField := parser.parseField(field)
+func (parser *Parser) parseStruct(pkgName string, field *ast.Field) (map[string]spec.Schema, error) {
+ properties := map[string]spec.Schema{}
+ structField, err := parser.parseField(field)
+ if err != nil {
+ return properties, nil
+ }
if structField.name == "" {
- return
+ return properties, nil
}
var desc string
if field.Doc != nil {
desc = strings.TrimSpace(field.Doc.Text())
}
+ if desc == "" && field.Comment != nil {
+ desc = strings.TrimSpace(field.Comment.Text())
+ }
// TODO: find package of schemaType and/or arrayType
if structField.crossPkg != "" {
@@ -473,7 +711,8 @@ func (parser *Parser) parseStruct(pkgName string, field *ast.Field) (properties
}
if _, ok := parser.TypeDefinitions[pkgName][structField.schemaType]; ok { // user type field
// write definition if not yet present
- parser.ParseDefinition(pkgName, parser.TypeDefinitions[pkgName][structField.schemaType], structField.schemaType)
+ parser.ParseDefinition(pkgName, structField.schemaType,
+ parser.TypeDefinitions[pkgName][structField.schemaType])
properties[structField.name] = spec.Schema{
SchemaProps: spec.SchemaProps{
Type: []string{"object"}, // to avoid swagger validation error
@@ -486,7 +725,8 @@ func (parser *Parser) parseStruct(pkgName string, field *ast.Field) (properties
} else if structField.schemaType == "array" { // array field type
// if defined -- ref it
if _, ok := parser.TypeDefinitions[pkgName][structField.arrayType]; ok { // user type in array
- parser.ParseDefinition(pkgName, parser.TypeDefinitions[pkgName][structField.arrayType], structField.arrayType)
+ parser.ParseDefinition(pkgName, structField.arrayType,
+ parser.TypeDefinitions[pkgName][structField.arrayType])
properties[structField.name] = spec.Schema{
SchemaProps: spec.SchemaProps{
Type: []string{structField.schemaType},
@@ -517,7 +757,13 @@ func (parser *Parser) parseStruct(pkgName string, field *ast.Field) (properties
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
- Type: []string{structField.arrayType},
+ Type: []string{structField.arrayType},
+ Maximum: structField.maximum,
+ Minimum: structField.minimum,
+ MaxLength: structField.maxLength,
+ MinLength: structField.minLength,
+ Enum: structField.enums,
+ Default: structField.defaultValue,
},
},
},
@@ -538,17 +784,30 @@ func (parser *Parser) parseStruct(pkgName string, field *ast.Field) (properties
Description: desc,
Format: structField.formatType,
Required: required,
+ Maximum: structField.maximum,
+ Minimum: structField.minimum,
+ MaxLength: structField.maxLength,
+ MinLength: structField.minLength,
+ Enum: structField.enums,
+ Default: structField.defaultValue,
},
SwaggerSchemaProps: spec.SwaggerSchemaProps{
Example: structField.exampleValue,
},
+ VendorExtensible: spec.VendorExtensible{
+ Extensions: structField.extensions,
+ },
}
+
nestStruct, ok := field.Type.(*ast.StructType)
if ok {
props := map[string]spec.Schema{}
nestRequired := make([]string, 0)
for _, v := range nestStruct.Fields.List {
- p := parser.parseStruct(pkgName, v)
+ p, err := parser.parseStruct(pkgName, v)
+ if err != nil {
+ return properties, err
+ }
for k, v := range p {
if v.SchemaProps.Type[0] != "object" {
nestRequired = append(nestRequired, v.SchemaProps.Required...)
@@ -565,6 +824,12 @@ func (parser *Parser) parseStruct(pkgName string, field *ast.Field) (properties
Format: structField.formatType,
Properties: props,
Required: nestRequired,
+ Maximum: structField.maximum,
+ Minimum: structField.minimum,
+ MaxLength: structField.maxLength,
+ MinLength: structField.minLength,
+ Enum: structField.enums,
+ Default: structField.defaultValue,
},
SwaggerSchemaProps: spec.SwaggerSchemaProps{
Example: structField.exampleValue,
@@ -572,26 +837,67 @@ func (parser *Parser) parseStruct(pkgName string, field *ast.Field) (properties
}
}
}
- return
+ return properties, nil
}
-func (parser *Parser) parseAnonymousField(pkgName string, field *ast.Field, properties map[string]spec.Schema) {
- if astTypeIdent, ok := field.Type.(*ast.Ident); ok {
- findPgkName := pkgName
- findBaseTypeName := astTypeIdent.Name
- ss := strings.Split(astTypeIdent.Name, ".")
- if len(ss) > 1 {
- findPgkName = ss[0]
- findBaseTypeName = ss[1]
+func (parser *Parser) parseAnonymousField(pkgName string, field *ast.Field) (map[string]spec.Schema, []string, error) {
+ properties := make(map[string]spec.Schema)
+
+ fullTypeName := ""
+ switch ftype := field.Type.(type) {
+ case *ast.Ident:
+ fullTypeName = ftype.Name
+ case *ast.StarExpr:
+ if ftypeX, ok := ftype.X.(*ast.Ident); ok {
+ fullTypeName = ftypeX.Name
+ } else if ftypeX, ok := ftype.X.(*ast.SelectorExpr); ok {
+ if packageX, ok := ftypeX.X.(*ast.Ident); ok {
+ fullTypeName = fmt.Sprintf("%s.%s", packageX.Name, ftypeX.Sel.Name)
+ }
+ } else {
+ Printf("Composite field type of '%T' is unhandle by parser. Skipping", ftype)
+ return properties, []string{}, nil
}
+ default:
+ Printf("Field type of '%T' is unsupported. Skipping", ftype)
+ return properties, []string{}, nil
+ }
+
+ typeName := fullTypeName
+ if splits := strings.Split(fullTypeName, "."); len(splits) > 1 {
+ pkgName = splits[0]
+ typeName = splits[1]
+ }
- baseTypeSpec := parser.TypeDefinitions[findPgkName][findBaseTypeName]
- parser.parseTypeSpec(findPgkName, baseTypeSpec, properties)
+ typeSpec := parser.TypeDefinitions[pkgName][typeName]
+ schema, err := parser.parseTypeExpr(pkgName, typeName, typeSpec.Type)
+ if err != nil {
+ return properties, []string{}, err
+ }
+ schemaType := "unknown"
+ if len(schema.SchemaProps.Type) > 0 {
+ schemaType = schema.SchemaProps.Type[0]
+ }
+
+ switch schemaType {
+ case "object":
+ for k, v := range schema.SchemaProps.Properties {
+ properties[k] = v
+ }
+ case "array":
+ properties[typeName] = schema
+ default:
+ Printf("Can't extract properties from a schema of type '%s'", schemaType)
}
+
+ return properties, schema.SchemaProps.Required, nil
}
-func (parser *Parser) parseField(field *ast.Field) *structField {
- prop := getPropertyName(field, parser)
+func (parser *Parser) parseField(field *ast.Field) (*structField, error) {
+ prop, err := getPropertyName(field.Type, parser)
+ if err != nil {
+ return nil, err
+ }
if len(prop.ArrayType) == 0 {
CheckSchemaType(prop.SchemaType)
} else {
@@ -616,11 +922,11 @@ func (parser *Parser) parseField(field *ast.Field) *structField {
}
if field.Tag == nil {
- return structField
+ return structField, nil
}
// `json:"tag"` -> json:"tag"
- structTag := strings.Replace(field.Tag.Value, "`", "", -1)
- jsonTag := reflect.StructTag(structTag).Get("json")
+ structTag := reflect.StructTag(strings.Replace(field.Tag.Value, "`", "", -1))
+ jsonTag := structTag.Get("json")
// json:"tag,hoge"
if strings.Contains(jsonTag, ",") {
// json:",hoge"
@@ -636,16 +942,37 @@ func (parser *Parser) parseField(field *ast.Field) *structField {
structField.name = jsonTag
}
- exampleTag := reflect.StructTag(structTag).Get("example")
- if exampleTag != "" {
- structField.exampleValue = defineTypeOfExample(structField.schemaType, exampleTag)
+ if typeTag := structTag.Get("swaggertype"); typeTag != "" {
+ parts := strings.Split(typeTag, ",")
+ if 0 < len(parts) && len(parts) <= 2 {
+ newSchemaType := parts[0]
+ newArrayType := structField.arrayType
+ if len(parts) >= 2 {
+ if newSchemaType == "array" {
+ newArrayType = parts[1]
+ } else if newSchemaType == "primitive" {
+ newSchemaType = parts[1]
+ newArrayType = parts[1]
+ }
+ }
+
+ CheckSchemaType(newSchemaType)
+ CheckSchemaType(newArrayType)
+ structField.schemaType = newSchemaType
+ structField.arrayType = newArrayType
+ }
}
- formatTag := reflect.StructTag(structTag).Get("format")
- if formatTag != "" {
+ if exampleTag := structTag.Get("example"); exampleTag != "" {
+ example, err := defineTypeOfExample(structField.schemaType, structField.arrayType, exampleTag)
+ if err != nil {
+ return nil, err
+ }
+ structField.exampleValue = example
+ }
+ if formatTag := structTag.Get("format"); formatTag != "" {
structField.formatType = formatTag
}
- bindingTag := reflect.StructTag(structTag).Get("binding")
- if bindingTag != "" {
+ if bindingTag := structTag.Get("binding"); bindingTag != "" {
for _, val := range strings.Split(bindingTag, ",") {
if val == "required" {
structField.isRequired = true
@@ -653,8 +980,7 @@ func (parser *Parser) parseField(field *ast.Field) *structField {
}
}
}
- validateTag := reflect.StructTag(structTag).Get("validate")
- if validateTag != "" {
+ if validateTag := structTag.Get("validate"); validateTag != "" {
for _, val := range strings.Split(validateTag, ",") {
if val == "required" {
structField.isRequired = true
@@ -662,7 +988,100 @@ func (parser *Parser) parseField(field *ast.Field) *structField {
}
}
}
- return structField
+ if extensionsTag := structTag.Get("extensions"); extensionsTag != "" {
+ structField.extensions = map[string]interface{}{}
+ for _, val := range strings.Split(extensionsTag, ",") {
+ parts := strings.SplitN(val, "=", 2)
+ if len(parts) == 2 {
+ structField.extensions[parts[0]] = parts[1]
+ } else {
+ structField.extensions[parts[0]] = true
+ }
+ }
+ }
+ if enumsTag := structTag.Get("enums"); enumsTag != "" {
+ enumType := structField.schemaType
+ if structField.schemaType == "array" {
+ enumType = structField.arrayType
+ }
+
+ for _, e := range strings.Split(enumsTag, ",") {
+ value, err := defineType(enumType, e)
+ if err != nil {
+ return nil, err
+ }
+ structField.enums = append(structField.enums, value)
+ }
+ }
+ if defaultTag := structTag.Get("default"); defaultTag != "" {
+ value, err := defineType(structField.schemaType, defaultTag)
+ if err != nil {
+ return nil, err
+ }
+ structField.defaultValue = value
+ }
+
+ if IsNumericType(structField.schemaType) || IsNumericType(structField.arrayType) {
+ maximum, err := getFloatTag(structTag, "maximum")
+ if err != nil {
+ return nil, err
+ }
+ structField.maximum = maximum
+
+ minimum, err := getFloatTag(structTag, "minimum")
+ if err != nil {
+ return nil, err
+ }
+ structField.minimum = minimum
+ }
+ if structField.schemaType == "string" || structField.arrayType == "string" {
+ maxLength, err := getIntTag(structTag, "maxLength")
+ if err != nil {
+ return nil, err
+ }
+ structField.maxLength = maxLength
+
+ minLength, err := getIntTag(structTag, "minLength")
+ if err != nil {
+ return nil, err
+ }
+ structField.minLength = minLength
+ }
+
+ return structField, nil
+}
+
+func replaceLastTag(slice []spec.Tag, element spec.Tag) {
+ slice = slice[:len(slice)-1]
+ slice = append(slice, element)
+}
+
+func getFloatTag(structTag reflect.StructTag, tagName string) (*float64, error) {
+ strValue := structTag.Get(tagName)
+ if strValue == "" {
+ return nil, nil
+ }
+
+ value, err := strconv.ParseFloat(strValue, 64)
+ if err != nil {
+ return nil, fmt.Errorf("can't parse numeric value of %q tag: %v", tagName, err)
+ }
+
+ return &value, nil
+}
+
+func getIntTag(structTag reflect.StructTag, tagName string) (*int64, error) {
+ strValue := structTag.Get(tagName)
+ if strValue == "" {
+ return nil, nil
+ }
+
+ value, err := strconv.ParseInt(strValue, 10, 64)
+ if err != nil {
+ return nil, fmt.Errorf("can't parse numeric value of %q tag: %v", tagName, err)
+ }
+
+ return &value, nil
}
func toSnakeCase(in string) string {
@@ -698,42 +1117,51 @@ func toLowerCamelCase(in string) string {
}
// defineTypeOfExample example value define the type (object and array unsupported)
-func defineTypeOfExample(schemaType string, exampleValue string) interface{} {
+func defineTypeOfExample(schemaType, arrayType, exampleValue string) (interface{}, error) {
switch schemaType {
case "string":
- return exampleValue
+ return exampleValue, nil
case "number":
v, err := strconv.ParseFloat(exampleValue, 64)
if err != nil {
- panic(fmt.Errorf("example value %s can't convert to %s err: %s", exampleValue, schemaType, err))
+ return nil, fmt.Errorf("example value %s can't convert to %s err: %s", exampleValue, schemaType, err)
}
- return v
+ return v, nil
case "integer":
v, err := strconv.Atoi(exampleValue)
if err != nil {
- panic(fmt.Errorf("example value %s can't convert to %s err: %s", exampleValue, schemaType, err))
+ return nil, fmt.Errorf("example value %s can't convert to %s err: %s", exampleValue, schemaType, err)
}
- return v
+ return v, nil
case "boolean":
v, err := strconv.ParseBool(exampleValue)
if err != nil {
- panic(fmt.Errorf("example value %s can't convert to %s err: %s", exampleValue, schemaType, err))
+ return nil, fmt.Errorf("example value %s can't convert to %s err: %s", exampleValue, schemaType, err)
}
- return v
+ return v, nil
case "array":
- return strings.Split(exampleValue, ",")
+ values := strings.Split(exampleValue, ",")
+ result := make([]interface{}, 0)
+ for _, value := range values {
+ v, err := defineTypeOfExample(arrayType, "", value)
+ if err != nil {
+ return nil, err
+ }
+ result = append(result, v)
+ }
+ return result, nil
default:
- panic(fmt.Errorf("%s is unsupported type in example value", schemaType))
+ return nil, fmt.Errorf("%s is unsupported type in example value", schemaType)
}
}
// GetAllGoFileInfo gets all Go source files information for given searchDir.
-func (parser *Parser) getAllGoFileInfo(searchDir string) {
- filepath.Walk(searchDir, parser.visit)
+func (parser *Parser) getAllGoFileInfo(searchDir string) error {
+ return filepath.Walk(searchDir, parser.visit)
}
func (parser *Parser) visit(path string, f os.FileInfo, err error) error {
- if err := Skip(f); err != nil {
+ if err := parser.Skip(path, f); err != nil {
return err
}
@@ -741,7 +1169,7 @@ func (parser *Parser) visit(path string, f os.FileInfo, err error) error {
fset := token.NewFileSet() // positions are relative to fset
astFile, err := goparser.ParseFile(fset, path, nil, goparser.ParseComments)
if err != nil {
- log.Panicf("ParseFile panic:%+v", err)
+ return fmt.Errorf("ParseFile error:%+v", err)
}
parser.files[path] = astFile
@@ -750,10 +1178,12 @@ func (parser *Parser) visit(path string, f os.FileInfo, err error) error {
}
// Skip returns filepath.SkipDir error if match vendor and hidden folder
-func Skip(f os.FileInfo) error {
- // exclude vendor folder
- if f.IsDir() && f.Name() == "vendor" {
- return filepath.SkipDir
+func (parser *Parser) Skip(path string, f os.FileInfo) error {
+
+ if !parser.ParseVendor { // ignore vendor
+ if f.IsDir() && f.Name() == "vendor" {
+ return filepath.SkipDir
+ }
}
// exclude all hidden folder
diff --git a/vendor/github.com/swaggo/swag/property.go b/vendor/github.com/swaggo/swag/property.go
index 5bd7bd8d..11e02821 100644
--- a/vendor/github.com/swaggo/swag/property.go
+++ b/vendor/github.com/swaggo/swag/property.go
@@ -52,77 +52,79 @@ func parseFieldSelectorExpr(astTypeSelectorExpr *ast.SelectorExpr, parser *Parse
if pkgName, ok := astTypeSelectorExpr.X.(*ast.Ident); ok {
if typeDefinitions, ok := parser.TypeDefinitions[pkgName.Name][astTypeSelectorExpr.Sel.Name]; ok {
- parser.ParseDefinition(pkgName.Name, typeDefinitions, astTypeSelectorExpr.Sel.Name)
+ if expr, ok := typeDefinitions.Type.(*ast.SelectorExpr); ok {
+ if primitiveType, err := convertFromSpecificToPrimitive(expr.Sel.Name); err == nil {
+ return propertyNewFunc(primitiveType, "")
+ }
+ }
+ parser.ParseDefinition(pkgName.Name, astTypeSelectorExpr.Sel.Name, typeDefinitions)
return propertyNewFunc(astTypeSelectorExpr.Sel.Name, pkgName.Name)
}
+ if actualPrimitiveType, isCustomType := parser.CustomPrimitiveTypes[astTypeSelectorExpr.Sel.Name]; isCustomType {
+ return propertyName{SchemaType: actualPrimitiveType, ArrayType: actualPrimitiveType}
+ }
}
-
- fmt.Printf("%s is not supported. but it will be set with string temporary. Please report any problems.", astTypeSelectorExpr.Sel.Name)
return propertyName{SchemaType: "string", ArrayType: "string"}
}
-// getPropertyName returns the string value for the given field if it exists, otherwise it panics.
+// getPropertyName returns the string value for the given field if it exists
// allowedValues: array, boolean, integer, null, number, object, string
-func getPropertyName(field *ast.Field, parser *Parser) propertyName {
- if astTypeSelectorExpr, ok := field.Type.(*ast.SelectorExpr); ok {
- return parseFieldSelectorExpr(astTypeSelectorExpr, parser, newProperty)
+func getPropertyName(expr ast.Expr, parser *Parser) (propertyName, error) {
+ if astTypeSelectorExpr, ok := expr.(*ast.SelectorExpr); ok {
+ return parseFieldSelectorExpr(astTypeSelectorExpr, parser, newProperty), nil
}
// check if it is a custom type
- typeName := fmt.Sprintf("%v", field.Type)
+ typeName := fmt.Sprintf("%v", expr)
if actualPrimitiveType, isCustomType := parser.CustomPrimitiveTypes[typeName]; isCustomType {
- return propertyName{SchemaType: actualPrimitiveType, ArrayType: actualPrimitiveType}
+ return propertyName{SchemaType: actualPrimitiveType, ArrayType: actualPrimitiveType}, nil
}
- if astTypeIdent, ok := field.Type.(*ast.Ident); ok {
+ if astTypeIdent, ok := expr.(*ast.Ident); ok {
name := astTypeIdent.Name
schemeType := TransToValidSchemeType(name)
- return propertyName{SchemaType: schemeType, ArrayType: schemeType}
+ return propertyName{SchemaType: schemeType, ArrayType: schemeType}, nil
}
- if ptr, ok := field.Type.(*ast.StarExpr); ok {
- if astTypeSelectorExpr, ok := ptr.X.(*ast.SelectorExpr); ok {
- return parseFieldSelectorExpr(astTypeSelectorExpr, parser, newProperty)
- }
- if astTypeIdent, ok := ptr.X.(*ast.Ident); ok {
- name := astTypeIdent.Name
- schemeType := TransToValidSchemeType(name)
- return propertyName{SchemaType: schemeType, ArrayType: schemeType}
- }
- if astTypeArray, ok := ptr.X.(*ast.ArrayType); ok { // if array
- if astTypeArrayExpr, ok := astTypeArray.Elt.(*ast.SelectorExpr); ok {
- return parseFieldSelectorExpr(astTypeArrayExpr, parser, newArrayProperty)
- }
- if astTypeArrayIdent, ok := astTypeArray.Elt.(*ast.Ident); ok {
- name := astTypeArrayIdent.Name
- return propertyName{SchemaType: "array", ArrayType: name}
- }
- }
+
+ if ptr, ok := expr.(*ast.StarExpr); ok {
+ return getPropertyName(ptr.X, parser)
}
- if astTypeArray, ok := field.Type.(*ast.ArrayType); ok { // if array
- if astTypeArrayExpr, ok := astTypeArray.Elt.(*ast.SelectorExpr); ok {
- return parseFieldSelectorExpr(astTypeArrayExpr, parser, newArrayProperty)
- }
- if astTypeArrayExpr, ok := astTypeArray.Elt.(*ast.StarExpr); ok {
- if astTypeArrayIdent, ok := astTypeArrayExpr.X.(*ast.Ident); ok {
- name := astTypeArrayIdent.Name
- return propertyName{SchemaType: "array", ArrayType: name}
- }
- }
- itemTypeName := fmt.Sprintf("%s", astTypeArray.Elt)
- if actualPrimitiveType, isCustomType := parser.CustomPrimitiveTypes[itemTypeName]; isCustomType {
- itemTypeName = actualPrimitiveType
- }
- return propertyName{SchemaType: "array", ArrayType: itemTypeName}
+
+ if astTypeArray, ok := expr.(*ast.ArrayType); ok { // if array
+ return getArrayPropertyName(astTypeArray, parser), nil
+ }
+
+ if _, ok := expr.(*ast.MapType); ok { // if map
+ return propertyName{SchemaType: "object", ArrayType: "object"}, nil
+ }
+
+ if _, ok := expr.(*ast.StructType); ok { // if struct
+ return propertyName{SchemaType: "object", ArrayType: "object"}, nil
+ }
+
+ if _, ok := expr.(*ast.InterfaceType); ok { // if interface{}
+ return propertyName{SchemaType: "object", ArrayType: "object"}, nil
}
- if _, ok := field.Type.(*ast.MapType); ok { // if map
- //TODO: support map
- return propertyName{SchemaType: "object", ArrayType: "object"}
+
+ return propertyName{}, errors.New("not supported" + fmt.Sprint(expr))
+}
+
+func getArrayPropertyName(astTypeArray *ast.ArrayType, parser *Parser) propertyName {
+ if astTypeArrayExpr, ok := astTypeArray.Elt.(*ast.SelectorExpr); ok {
+ return parseFieldSelectorExpr(astTypeArrayExpr, parser, newArrayProperty)
}
- if _, ok := field.Type.(*ast.StructType); ok { // if struct
- return propertyName{SchemaType: "object", ArrayType: "object"}
+ if astTypeArrayExpr, ok := astTypeArray.Elt.(*ast.StarExpr); ok {
+ if astTypeArraySel, ok := astTypeArrayExpr.X.(*ast.SelectorExpr); ok {
+ return parseFieldSelectorExpr(astTypeArraySel, parser, newArrayProperty)
+ }
+ if astTypeArrayIdent, ok := astTypeArrayExpr.X.(*ast.Ident); ok {
+ name := TransToValidSchemeType(astTypeArrayIdent.Name)
+ return propertyName{SchemaType: "array", ArrayType: name}
+ }
}
- if _, ok := field.Type.(*ast.InterfaceType); ok { // if interface{}
- return propertyName{SchemaType: "object", ArrayType: "object"}
+ itemTypeName := TransToValidSchemeType(fmt.Sprintf("%s", astTypeArray.Elt))
+ if actualPrimitiveType, isCustomType := parser.CustomPrimitiveTypes[itemTypeName]; isCustomType {
+ itemTypeName = actualPrimitiveType
}
- panic("not supported" + fmt.Sprint(field.Type))
+ return propertyName{SchemaType: "array", ArrayType: itemTypeName}
}
diff --git a/vendor/github.com/swaggo/swag/schema.go b/vendor/github.com/swaggo/swag/schema.go
index 1faeef26..2ebef167 100644
--- a/vendor/github.com/swaggo/swag/schema.go
+++ b/vendor/github.com/swaggo/swag/schema.go
@@ -2,11 +2,12 @@ package swag
import "fmt"
-// CheckSchemaType TODO: NEEDS COMMENT INFO
-func CheckSchemaType(typeName string) {
+// CheckSchemaType checks if typeName is not a name of primitive type
+func CheckSchemaType(typeName string) error {
if !IsPrimitiveType(typeName) {
- panic(fmt.Errorf("%s is not basic types", typeName))
+ return fmt.Errorf("%s is not basic types", typeName)
}
+ return nil
}
// IsPrimitiveType determine whether the type name is a primitive type
@@ -19,6 +20,11 @@ func IsPrimitiveType(typeName string) bool {
}
}
+// IsNumericType determines whether the swagger type name is a numeric type
+func IsNumericType(typeName string) bool {
+ return typeName == "integer" || typeName == "number"
+}
+
// TransToValidSchemeType indicates type will transfer golang basic type to swagger supported type.
func TransToValidSchemeType(typeName string) string {
switch typeName {
diff --git a/vendor/github.com/swaggo/swag/version.go b/vendor/github.com/swaggo/swag/version.go
index a813e84f..040118b7 100644
--- a/vendor/github.com/swaggo/swag/version.go
+++ b/vendor/github.com/swaggo/swag/version.go
@@ -1,4 +1,4 @@
package swag
// Version of swag
-const Version = "v1.3.2"
+const Version = "v1.5.1"
diff --git a/vendor/github.com/ugorji/go/codec/0_importpath.go b/vendor/github.com/ugorji/go/codec/0_importpath.go
new file mode 100644
index 00000000..adbe862c
--- /dev/null
+++ b/vendor/github.com/ugorji/go/codec/0_importpath.go
@@ -0,0 +1,7 @@
+// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved.
+// Use of this source code is governed by a MIT license found in the LICENSE file.
+
+package codec // import "github.com/ugorji/go/codec"
+
+// This establishes that this package must be imported as github.com/ugorji/go/codec.
+// It makes forking easier, and plays well with pre-module releases of go.
diff --git a/vendor/github.com/ugorji/go/codec/README.md b/vendor/github.com/ugorji/go/codec/README.md
deleted file mode 100644
index c9424783..00000000
--- a/vendor/github.com/ugorji/go/codec/README.md
+++ /dev/null
@@ -1,207 +0,0 @@
-# Codec
-
-High Performance, Feature-Rich Idiomatic Go codec/encoding library for
-binc, msgpack, cbor, json.
-
-Supported Serialization formats are:
-
- - msgpack: https://github.com/msgpack/msgpack
- - binc: http://github.com/ugorji/binc
- - cbor: http://cbor.io http://tools.ietf.org/html/rfc7049
- - json: http://json.org http://tools.ietf.org/html/rfc7159
- - simple:
-
-To install:
-
- go get github.com/ugorji/go/codec
-
-This package will carefully use 'unsafe' for performance reasons in specific places.
-You can build without unsafe use by passing the safe or appengine tag
-i.e. 'go install -tags=safe ...'. Note that unsafe is only supported for the last 3
-go sdk versions e.g. current go release is go 1.9, so we support unsafe use only from
-go 1.7+ . This is because supporting unsafe requires knowledge of implementation details.
-
-Online documentation: http://godoc.org/github.com/ugorji/go/codec
-Detailed Usage/How-to Primer: http://ugorji.net/blog/go-codec-primer
-
-The idiomatic Go support is as seen in other encoding packages in
-the standard library (ie json, xml, gob, etc).
-
-Rich Feature Set includes:
-
- - Simple but extremely powerful and feature-rich API
- - Support for go1.4 and above, while selectively using newer APIs for later releases
- - Excellent code coverage ( > 90% )
- - Very High Performance.
- Our extensive benchmarks show us outperforming Gob, Json, Bson, etc by 2-4X.
- - Careful selected use of 'unsafe' for targeted performance gains.
- 100% mode exists where 'unsafe' is not used at all.
- - Lock-free (sans mutex) concurrency for scaling to 100's of cores
- - In-place updates during decode, with option to zero the value in maps and slices prior to decode
- - Coerce types where appropriate
- e.g. decode an int in the stream into a float, decode numbers from formatted strings, etc
- - Corner Cases:
- Overflows, nil maps/slices, nil values in streams are handled correctly
- - Standard field renaming via tags
- - Support for omitting empty fields during an encoding
- - Encoding from any value and decoding into pointer to any value
- (struct, slice, map, primitives, pointers, interface{}, etc)
- - Extensions to support efficient encoding/decoding of any named types
- - Support encoding.(Binary|Text)(M|Unm)arshaler interfaces
- - Support IsZero() bool to determine if a value is a zero value.
- Analogous to time.Time.IsZero() bool.
- - Decoding without a schema (into a interface{}).
- Includes Options to configure what specific map or slice type to use
- when decoding an encoded list or map into a nil interface{}
- - Mapping a non-interface type to an interface, so we can decode appropriately
- into any interface type with a correctly configured non-interface value.
- - Encode a struct as an array, and decode struct from an array in the data stream
- - Option to encode struct keys as numbers (instead of strings)
- (to support structured streams with fields encoded as numeric codes)
- - Comprehensive support for anonymous fields
- - Fast (no-reflection) encoding/decoding of common maps and slices
- - Code-generation for faster performance.
- - Support binary (e.g. messagepack, cbor) and text (e.g. json) formats
- - Support indefinite-length formats to enable true streaming
- (for formats which support it e.g. json, cbor)
- - Support canonical encoding, where a value is ALWAYS encoded as same sequence of bytes.
- This mostly applies to maps, where iteration order is non-deterministic.
- - NIL in data stream decoded as zero value
- - Never silently skip data when decoding.
- User decides whether to return an error or silently skip data when keys or indexes
- in the data stream do not map to fields in the struct.
- - Encode/Decode from/to chan types (for iterative streaming support)
- - Drop-in replacement for encoding/json. `json:` key in struct tag supported.
- - Provides a RPC Server and Client Codec for net/rpc communication protocol.
- - Handle unique idiosyncrasies of codecs e.g.
- - For messagepack, configure how ambiguities in handling raw bytes are resolved
- - For messagepack, provide rpc server/client codec to support
- msgpack-rpc protocol defined at:
- https://github.com/msgpack-rpc/msgpack-rpc/blob/master/spec.md
-
-## Extension Support
-
-Users can register a function to handle the encoding or decoding of
-their custom types.
-
-There are no restrictions on what the custom type can be. Some examples:
-
- type BisSet []int
- type BitSet64 uint64
- type UUID string
- type MyStructWithUnexportedFields struct { a int; b bool; c []int; }
- type GifImage struct { ... }
-
-As an illustration, MyStructWithUnexportedFields would normally be
-encoded as an empty map because it has no exported fields, while UUID
-would be encoded as a string. However, with extension support, you can
-encode any of these however you like.
-
-## Custom Encoding and Decoding
-
-This package maintains symmetry in the encoding and decoding halfs.
-We determine how to encode or decode by walking this decision tree
-
- - is type a codec.Selfer?
- - is there an extension registered for the type?
- - is format binary, and is type a encoding.BinaryMarshaler and BinaryUnmarshaler?
- - is format specifically json, and is type a encoding/json.Marshaler and Unmarshaler?
- - is format text-based, and type an encoding.TextMarshaler?
- - else we use a pair of functions based on the "kind" of the type e.g. map, slice, int64, etc
-
-This symmetry is important to reduce chances of issues happening because the
-encoding and decoding sides are out of sync e.g. decoded via very specific
-encoding.TextUnmarshaler but encoded via kind-specific generalized mode.
-
-Consequently, if a type only defines one-half of the symmetry
-(e.g. it implements UnmarshalJSON() but not MarshalJSON() ),
-then that type doesn't satisfy the check and we will continue walking down the
-decision tree.
-
-## RPC
-
-RPC Client and Server Codecs are implemented, so the codecs can be used
-with the standard net/rpc package.
-
-## Usage
-
-Typical usage model:
-
- // create and configure Handle
- var (
- bh codec.BincHandle
- mh codec.MsgpackHandle
- ch codec.CborHandle
- )
-
- mh.MapType = reflect.TypeOf(map[string]interface{}(nil))
-
- // configure extensions
- // e.g. for msgpack, define functions and enable Time support for tag 1
- // mh.SetExt(reflect.TypeOf(time.Time{}), 1, myExt)
-
- // create and use decoder/encoder
- var (
- r io.Reader
- w io.Writer
- b []byte
- h = &bh // or mh to use msgpack
- )
-
- dec = codec.NewDecoder(r, h)
- dec = codec.NewDecoderBytes(b, h)
- err = dec.Decode(&v)
-
- enc = codec.NewEncoder(w, h)
- enc = codec.NewEncoderBytes(&b, h)
- err = enc.Encode(v)
-
- //RPC Server
- go func() {
- for {
- conn, err := listener.Accept()
- rpcCodec := codec.GoRpc.ServerCodec(conn, h)
- //OR rpcCodec := codec.MsgpackSpecRpc.ServerCodec(conn, h)
- rpc.ServeCodec(rpcCodec)
- }
- }()
-
- //RPC Communication (client side)
- conn, err = net.Dial("tcp", "localhost:5555")
- rpcCodec := codec.GoRpc.ClientCodec(conn, h)
- //OR rpcCodec := codec.MsgpackSpecRpc.ClientCodec(conn, h)
- client := rpc.NewClientWithCodec(rpcCodec)
-
-## Running Tests
-
-To run tests, use the following:
-
- go test
-
-To run the full suite of tests, use the following:
-
- go test -tags alltests -run Suite
-
-You can run the tag 'safe' to run tests or build in safe mode. e.g.
-
- go test -tags safe -run Json
- go test -tags "alltests safe" -run Suite
-
-## Running Benchmarks
-
-Please see http://github.com/ugorji/go-codec-bench .
-
-## Caveats
-
-Struct fields matching the following are ignored during encoding and decoding
-
- - struct tag value set to -
- - func, complex numbers, unsafe pointers
- - unexported and not embedded
- - unexported and embedded and not struct kind
- - unexported and embedded pointers (from go1.10)
-
-Every other field in a struct will be encoded/decoded.
-
-Embedded fields are encoded as if they exist in the top-level struct,
-with some caveats. See Encode documentation.
diff --git a/vendor/github.com/ugorji/go/codec/binc.go b/vendor/github.com/ugorji/go/codec/binc.go
index e6f3f49b..333d9cea 100644
--- a/vendor/github.com/ugorji/go/codec/binc.go
+++ b/vendor/github.com/ugorji/go/codec/binc.go
@@ -100,6 +100,7 @@ func bincdesc(vd, vs byte) string {
}
type bincEncDriver struct {
+ encDriverNoopContainerWriter
e *Encoder
h *BincHandle
w *encWriterSwitch
@@ -107,10 +108,10 @@ type bincEncDriver struct {
b [16]byte // scratch, used for encoding numbers - bigendian style
s uint16 // symbols sequencer
// c containerState
- encDriverTrackContainerWriter
+ // encDriverTrackContainerWriter
noBuiltInTypes
// encNoSeparator
- _ [1]uint64 // padding
+ // _ [1]uint64 // padding
}
func (e *bincEncDriver) EncodeNil() {
@@ -236,12 +237,10 @@ func (e *bincEncDriver) encodeExtPreamble(xtag byte, length int) {
func (e *bincEncDriver) WriteArrayStart(length int) {
e.encLen(bincVdArray<<4, uint64(length))
- e.c = containerArrayStart
}
func (e *bincEncDriver) WriteMapStart(length int) {
e.encLen(bincVdMap<<4, uint64(length))
- e.c = containerMapStart
}
func (e *bincEncDriver) EncodeSymbol(v string) {
@@ -308,20 +307,8 @@ func (e *bincEncDriver) EncodeSymbol(v string) {
}
}
-func (e *bincEncDriver) EncodeString(c charEncoding, v string) {
- if e.c == containerMapKey && c == cUTF8 && (e.h.AsSymbols == 0 || e.h.AsSymbols == 1) {
- e.EncodeSymbol(v)
- return
- }
- l := uint64(len(v))
- e.encBytesLen(c, l)
- if l > 0 {
- e.w.writestr(v)
- }
-}
-
func (e *bincEncDriver) EncodeStringEnc(c charEncoding, v string) {
- if e.c == containerMapKey && c == cUTF8 && (e.h.AsSymbols == 0 || e.h.AsSymbols == 1) {
+ if e.e.c == containerMapKey && c == cUTF8 && (e.h.AsSymbols == 0 || e.h.AsSymbols == 1) {
e.EncodeSymbol(v)
return
}
@@ -333,18 +320,6 @@ func (e *bincEncDriver) EncodeStringEnc(c charEncoding, v string) {
}
-func (e *bincEncDriver) EncodeStringBytes(c charEncoding, v []byte) {
- if v == nil {
- e.EncodeNil()
- return
- }
- l := uint64(len(v))
- e.encBytesLen(c, l)
- if l > 0 {
- e.w.writeb(v)
- }
-}
-
func (e *bincEncDriver) EncodeStringBytesRaw(v []byte) {
if v == nil {
e.EncodeNil()
@@ -409,7 +384,7 @@ type bincDecDriver struct {
bd byte
vd byte
vs byte
- _ [3]byte // padding
+ // _ [3]byte // padding
// linear searching on this slice is ok,
// because we typically expect < 32 symbols in each stream.
s []bincDecSymbol
@@ -932,8 +907,7 @@ func (d *bincDecDriver) DecodeNaked() {
n.v = valueTypeString
n.s = d.DecodeString()
case bincVdByteArray:
- n.v = valueTypeBytes
- n.l = d.DecodeBytes(nil, false)
+ decNakedReadRawBytes(d, d.d, n, d.h.RawToString)
case bincVdTimestamp:
n.v = valueTypeTime
tt, err := bincDecodeTime(d.r.readx(uint(d.vs)))
@@ -1008,7 +982,7 @@ type BincHandle struct {
// - n: none
// - a: all: same as m, s, ...
- // _ [1]uint64 // padding
+ _ [1]uint64 // padding (cache-aligned)
}
// Name returns the name of the handle: binc
@@ -1016,26 +990,25 @@ func (h *BincHandle) Name() string { return "binc" }
// SetBytesExt sets an extension
func (h *BincHandle) SetBytesExt(rt reflect.Type, tag uint64, ext BytesExt) (err error) {
- return h.SetExt(rt, tag, &extWrapper{ext, interfaceExtFailer{}})
+ return h.SetExt(rt, tag, &bytesExtWrapper{BytesExt: ext})
}
func (h *BincHandle) newEncDriver(e *Encoder) encDriver {
- return &bincEncDriver{e: e, h: h, w: e.w}
+ return &bincEncDriver{e: e, h: h, w: e.w()}
}
func (h *BincHandle) newDecDriver(d *Decoder) decDriver {
- return &bincDecDriver{d: d, h: h, r: d.r, br: d.bytes}
+ return &bincDecDriver{d: d, h: h, r: d.r(), br: d.bytes}
}
func (e *bincEncDriver) reset() {
- e.w = e.e.w
+ e.w = e.e.w()
e.s = 0
- e.c = 0
e.m = nil
}
func (d *bincDecDriver) reset() {
- d.r, d.br = d.d.r, d.d.bytes
+ d.r, d.br = d.d.r(), d.d.bytes
d.s = nil
d.bd, d.bdRead, d.vd, d.vs = 0, false, 0, 0
}
@@ -1174,7 +1147,7 @@ func bincDecodeTime(bs []byte) (tt time.Time, err error) {
return
}
// In stdlib time.Parse, when a date is parsed without a zone name, it uses "" as zone name.
- // However, we need name here, so it can be shown when time is printed.
+ // However, we need name here, so it can be shown when time is printf.d.
// Zone name is in form: UTC-08:00.
// Note that Go Libs do not give access to dst flag, so we ignore dst bits
diff --git a/vendor/github.com/ugorji/go/codec/build.sh b/vendor/github.com/ugorji/go/codec/build.sh
index bcab12aa..f1ba243e 100644
--- a/vendor/github.com/ugorji/go/codec/build.sh
+++ b/vendor/github.com/ugorji/go/codec/build.sh
@@ -116,57 +116,67 @@ run("fast-path.go.tmpl", "fast-path.generated.go")
run("gen-helper.go.tmpl", "gen-helper.generated.go")
run("mammoth-test.go.tmpl", "mammoth_generated_test.go")
run("mammoth2-test.go.tmpl", "mammoth2_generated_test.go")
+// run("sort-slice.go.tmpl", "sort-slice.generated.go")
}
EOF
+ sed -e 's+// __DO_NOT_REMOVE__NEEDED_FOR_REPLACING__IMPORT_PATH__FOR_CODEC_BENCH__+import . "github.com/ugorji/go/codec"+' \
+ shared_test.go > bench/shared_test.go
+
# explicitly return 0 if this passes, else return 1
- go run -tags "notfastpath safe codecgen.exec" gen-from-tmpl.generated.go &&
- rm -f gen-from-tmpl.*generated.go &&
- return 0
- return 1
+ go run -tags "prebuild" prebuild.go || return 1
+ go run -tags "notfastpath safe codecgen.exec" gen-from-tmpl.generated.go || return 1
+ rm -f gen-from-tmpl.*generated.go
+ return 0
}
_codegenerators() {
- if ! [[ $zforce ||
- $(_ng "values_codecgen${zsfx}") ]]; then return 0; fi
-
- # Note: ensure you run the codecgen for this codebase (using $zgobase/bin/codecgen)
+ local c5="_generated_test.go"
+ local c7="$PWD/codecgen"
+ local c8="$c7/__codecgen"
local c9="codecgen-scratch.go"
+
+ if ! [[ $zforce || $(_ng "values_codecgen${c5}") ]]; then return 0; fi
+
+ # Note: ensure you run the codecgen for this codebase/directory i.e. ./codecgen/codecgen
true &&
echo "codecgen ... " &&
- $zgobase/bin/codecgen -rt codecgen -t 'codecgen generated' -o values_codecgen${zsfx} -d 19780 $zfin $zfin2 &&
+ if [[ $zforce || ! -f "$c8" || "$c7/gen.go" -nt "$c8" ]]; then
+ echo "rebuilding codecgen ... " && ( cd codecgen && go build -o $c8 ${zargs[*]} . )
+ fi &&
+ $c8 -rt codecgen -t 'codecgen generated' -o values_codecgen${c5} -d 19780 $zfin $zfin2 &&
cp mammoth2_generated_test.go $c9 &&
- $zgobase/bin/codecgen -t '!notfastpath' -o mammoth2_codecgen${zsfx} -d 19781 mammoth2_generated_test.go &&
+ $c8 -t 'codecgen,!notfastpath generated,!notfastpath' -o mammoth2_codecgen${c5} -d 19781 mammoth2_generated_test.go &&
rm -f $c9 &&
echo "generators done!"
}
_prebuild() {
- echo "prebuild: zforce: $zforce , zexternal: $zexternal"
- zmydir=`pwd`
- zfin="test_values.generated.go"
- zfin2="test_values_flex.generated.go"
- zsfx="_generated_test.go"
- # zpkg="ugorji.net/codec"
- zpkg=${zmydir##*/src/}
- zgobase=${zmydir%%/src/*}
+ echo "prebuild: zforce: $zforce"
+ local d="$PWD"
+ local zfin="test_values.generated.go"
+ local zfin2="test_values_flex.generated.go"
+ local zpkg="github.com/ugorji/go/codec"
+ # zpkg=${d##*/src/}
+ # zgobase=${d%%/src/*}
# rm -f *_generated_test.go
rm -f codecgen-*.go &&
_build &&
- cp $zmydir/values_test.go $zmydir/$zfin &&
- cp $zmydir/values_flex_test.go $zmydir/$zfin2 &&
+ cp $d/values_test.go $d/$zfin &&
+ cp $d/values_flex_test.go $d/$zfin2 &&
_codegenerators &&
if [[ "$(type -t _codegenerators_external )" = "function" ]]; then _codegenerators_external ; fi &&
if [[ $zforce ]]; then go install ${zargs[*]} .; fi &&
echo "prebuild done successfully"
- rm -f $zmydir/$zfin $zmydir/$zfin2
+ rm -f $d/$zfin $d/$zfin2
+ # unset zfin zfin2 zpkg
}
_make() {
+ local makeforce=${zforce}
zforce=1
- zexternal=1
- ( cd codecgen && go install ${zargs[*]} . ) && _prebuild && go install ${zargs[*]} .
- unset zforce zexternal
+ (cd codecgen && go install ${zargs[*]} .) && _prebuild && go install ${zargs[*]} .
+ zforce=${makeforce}
}
_clean() {
@@ -175,6 +185,43 @@ _clean() {
test_values.generated.go test_values_flex.generated.go
}
+_release() {
+ local reply
+ read -p "Pre-release validation takes a few minutes and MUST be run from within GOPATH/src. Confirm y/n? " -n 1 -r reply
+ echo
+ if [[ ! $reply =~ ^[Yy]$ ]]; then return 1; fi
+
+ # expects GOROOT, GOROOT_BOOTSTRAP to have been set.
+ if [[ -z "${GOROOT// }" || -z "${GOROOT_BOOTSTRAP// }" ]]; then return 1; fi
+ # (cd $GOROOT && git checkout -f master && git pull && git reset --hard)
+ (cd $GOROOT && git pull)
+ local f=`pwd`/make.release.out
+ cat > $f <>$f
+ if [[ "$i" != "master" ]]; then i="release-branch.go$i"; fi
+ (false ||
+ (echo "===== BUILDING GO SDK for branch: $i ... =====" &&
+ cd $GOROOT &&
+ git checkout -f $i && git reset --hard && git clean -f . &&
+ cd src && ./make.bash >>$f 2>&1 && sleep 1 ) ) &&
+ echo "===== GO SDK BUILD DONE =====" &&
+ _prebuild &&
+ echo "===== PREBUILD DONE with exit: $? =====" &&
+ _tests "$@"
+ if [[ "$?" != 0 ]]; then return 1; fi
+ done
+ zforce=${makeforce}
+ echo "++++++++ RELEASE TEST SUITES ALL PASSED ++++++++"
+}
+
_usage() {
cat <= cborBaseBytes && d.bd < cborBaseString:
- n.v = valueTypeBytes
- n.l = d.DecodeBytes(nil, false)
+ decNakedReadRawBytes(d, d.d, n, d.h.RawToString)
case d.bd >= cborBaseString && d.bd < cborBaseArray:
n.v = valueTypeString
n.s = d.DecodeString()
@@ -737,7 +721,7 @@ type CborHandle struct {
// If unset, we encode time.Time using seconds past epoch.
TimeRFC3339 bool
- // _ [1]uint64 // padding
+ _ [1]uint64 // padding (cache-aligned)
}
// Name returns the name of the handle: cbor
@@ -745,23 +729,23 @@ func (h *CborHandle) Name() string { return "cbor" }
// SetInterfaceExt sets an extension
func (h *CborHandle) SetInterfaceExt(rt reflect.Type, tag uint64, ext InterfaceExt) (err error) {
- return h.SetExt(rt, tag, &extWrapper{bytesExtFailer{}, ext})
+ return h.SetExt(rt, tag, &interfaceExtWrapper{InterfaceExt: ext})
}
func (h *CborHandle) newEncDriver(e *Encoder) encDriver {
- return &cborEncDriver{e: e, w: e.w, h: h}
+ return &cborEncDriver{e: e, w: e.w(), h: h}
}
func (h *CborHandle) newDecDriver(d *Decoder) decDriver {
- return &cborDecDriver{d: d, h: h, r: d.r, br: d.bytes}
+ return &cborDecDriver{d: d, h: h, r: d.r(), br: d.bytes}
}
func (e *cborEncDriver) reset() {
- e.w = e.e.w
+ e.w = e.e.w()
}
func (d *cborDecDriver) reset() {
- d.r, d.br = d.d.r, d.d.bytes
+ d.r, d.br = d.d.r(), d.d.bytes
d.bd, d.bdRead = 0, false
}
diff --git a/vendor/github.com/ugorji/go/codec/decode.go b/vendor/github.com/ugorji/go/codec/decode.go
index 4caa2595..f9772369 100644
--- a/vendor/github.com/ugorji/go/codec/decode.go
+++ b/vendor/github.com/ugorji/go/codec/decode.go
@@ -24,7 +24,7 @@ const (
decDefMaxDepth = 1024 // maximum depth
decDefSliceCap = 8
decDefChanCap = 64 // should be large, as cap cannot be expanded
- decScratchByteArrayLen = cacheLineSize // + (8 * 2) // - (8 * 1)
+ decScratchByteArrayLen = cacheLineSize // - 5 // + (8 * 2) // - (8 * 1)
)
var (
@@ -96,10 +96,6 @@ type decDriver interface {
// kInterface will extract the detached byte slice if it has to pass it outside its realm.
DecodeNaked()
- // Deprecated: use DecodeInt64 and DecodeUint64 instead
- // DecodeInt(bitsize uint8) (i int64)
- // DecodeUint(bitsize uint8) (ui uint64)
-
DecodeInt64() (i int64)
DecodeUint64() (ui uint64)
@@ -125,17 +121,20 @@ type decDriver interface {
DecodeTime() (t time.Time)
ReadArrayStart() int
- ReadArrayElem()
ReadArrayEnd()
ReadMapStart() int
- ReadMapElemKey()
- ReadMapElemValue()
ReadMapEnd()
reset()
uncacheRead()
}
+type decDriverContainerTracker interface {
+ ReadArrayElem()
+ ReadMapElemKey()
+ ReadMapElemValue()
+}
+
type decodeError struct {
codecError
pos int
@@ -148,14 +147,15 @@ func (d decodeError) Error() string {
type decDriverNoopContainerReader struct{}
func (x decDriverNoopContainerReader) ReadArrayStart() (v int) { return }
-func (x decDriverNoopContainerReader) ReadArrayElem() {}
func (x decDriverNoopContainerReader) ReadArrayEnd() {}
func (x decDriverNoopContainerReader) ReadMapStart() (v int) { return }
-func (x decDriverNoopContainerReader) ReadMapElemKey() {}
-func (x decDriverNoopContainerReader) ReadMapElemValue() {}
func (x decDriverNoopContainerReader) ReadMapEnd() {}
func (x decDriverNoopContainerReader) CheckBreak() (v bool) { return }
+// func (x decDriverNoopContainerReader) ReadArrayElem() {}
+// func (x decDriverNoopContainerReader) ReadMapElemKey() {}
+// func (x decDriverNoopContainerReader) ReadMapElemValue() {}
+
// func (x decNoSeparator) uncacheRead() {}
// DecodeOptions captures configuration options during decode.
@@ -257,6 +257,10 @@ type DecodeOptions struct {
// If true, we will delete the mapping of the key.
// Else, just set the mapping to the zero value of the type.
DeleteOnNilMapValue bool
+
+ // RawToString controls how raw bytes in a stream are decoded into a nil interface{}.
+ // By default, they are decoded as []byte, but can be decoded as string (if configured).
+ RawToString bool
}
// ------------------------------------------------
@@ -322,8 +326,8 @@ type ioDecReader struct {
rr io.Reader
br io.ByteScanner
- x [scratchByteArrayLen]byte // for: get struct field name, swallow valueTypeBytes, etc
- _ [1]uint64 // padding
+ x [scratchByteArrayLen + 8]byte // for: get struct field name, swallow valueTypeBytes, etc
+ // _ [1]uint64 // padding
}
func (z *ioDecReader) reset(r io.Reader) {
@@ -545,6 +549,7 @@ func (z *ioDecReader) unreadn1() {
type bufioDecReader struct {
ioDecReaderCommon
+ _ uint64 // padding (cache-aligned)
c uint // cursor
buf []byte
@@ -553,21 +558,31 @@ type bufioDecReader struct {
// err error
- _ [2]uint64 // padding
+ // Extensions can call Decode() within a current Decode() call.
+ // We need to know when the top level Decode() call returns,
+ // so we can decide whether to Release() or not.
+ calls uint16 // what depth in mustDecode are we in now.
+
+ _ [6]uint8 // padding
}
func (z *bufioDecReader) reset(r io.Reader, bufsize int) {
z.ioDecReaderCommon.reset(r)
z.c = 0
+ z.calls = 0
if cap(z.buf) >= bufsize {
z.buf = z.buf[:0]
} else {
- z.bytesBufPooler.end() // potentially return old one to pool
z.buf = z.bytesBufPooler.get(bufsize)[:0]
// z.buf = make([]byte, 0, bufsize)
}
}
+func (z *bufioDecReader) release() {
+ z.buf = nil
+ z.bytesBufPooler.end()
+}
+
func (z *bufioDecReader) readb(p []byte) {
var n = uint(copy(p, z.buf[z.c:]))
z.n += n
@@ -1391,7 +1406,6 @@ func decStructFieldKey(dd decDriver, keyType valueType, b *[decScratchByteArrayL
func (d *Decoder) kStruct(f *codecFnInfo, rv reflect.Value) {
fti := f.ti
dd := d.d
- elemsep := d.esep
sfn := structFieldNode{v: rv, update: true}
ctyp := dd.ContainerType()
var mf MissingFielder
@@ -1401,24 +1415,19 @@ func (d *Decoder) kStruct(f *codecFnInfo, rv reflect.Value) {
mf = rv2i(rv.Addr()).(MissingFielder)
}
if ctyp == valueTypeMap {
- containerLen := dd.ReadMapStart()
+ containerLen := d.mapStart()
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return
}
- d.depthIncr()
tisfi := fti.sfiSort
hasLen := containerLen >= 0
var rvkencname []byte
for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if elemsep {
- dd.ReadMapElemKey()
- }
+ d.mapElemKey()
rvkencname = decStructFieldKey(dd, fti.keyType, &d.b)
- if elemsep {
- dd.ReadMapElemValue()
- }
+ d.mapElemValue()
if k := fti.indexForEncName(rvkencname); k > -1 {
si := tisfi[k]
if dd.TryDecodeAsNil() {
@@ -1445,15 +1454,13 @@ func (d *Decoder) kStruct(f *codecFnInfo, rv reflect.Value) {
}
// keepAlive4StringView(rvkencnameB) // not needed, as reference is outside loop
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
} else if ctyp == valueTypeArray {
- containerLen := dd.ReadArrayStart()
+ containerLen := d.arrayStart()
if containerLen == 0 {
- dd.ReadArrayEnd()
+ d.arrayEnd()
return
}
- d.depthIncr()
// Not much gain from doing it two ways for array.
// Arrays are not used as much for structs.
hasLen := containerLen >= 0
@@ -1466,9 +1473,7 @@ func (d *Decoder) kStruct(f *codecFnInfo, rv reflect.Value) {
checkbreak = true
break
}
- if elemsep {
- dd.ReadArrayElem()
- }
+ d.arrayElem()
if dd.TryDecodeAsNil() {
si.setToZeroValue(rv)
} else {
@@ -1481,14 +1486,11 @@ func (d *Decoder) kStruct(f *codecFnInfo, rv reflect.Value) {
if (hasLen && j == containerLen) || (!hasLen && dd.CheckBreak()) {
break
}
- if elemsep {
- dd.ReadArrayElem()
- }
+ d.arrayElem()
d.structFieldNotFound(j, "")
}
}
- dd.ReadArrayEnd()
- d.depthDecr()
+ d.arrayEnd()
} else {
d.errorstr(errstrOnlyMapOrArrayCanDecodeIntoStruct)
return
@@ -1498,17 +1500,18 @@ func (d *Decoder) kStruct(f *codecFnInfo, rv reflect.Value) {
func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) {
// A slice can be set from a map or array in stream.
// This way, the order can be kept (as order is lost with map).
- ti := f.ti
- if f.seq == seqTypeChan && ti.chandir&uint8(reflect.SendDir) == 0 {
+
+ frt := f.ti.rt
+ if f.seq == seqTypeChan && f.ti.chandir&uint8(reflect.SendDir) == 0 {
d.errorf("receive-only channel cannot be decoded")
}
dd := d.d
- rtelem0 := ti.elem
+ rtelem0 := f.ti.elem
ctyp := dd.ContainerType()
if ctyp == valueTypeBytes || ctyp == valueTypeString {
// you can only decode bytes or string in the stream into a slice or array of bytes
- if !(ti.rtid == uint8SliceTypId || rtelem0.Kind() == reflect.Uint8) {
- d.errorf("bytes/string in stream must decode into slice/array of bytes, not %v", ti.rt)
+ if !(f.ti.rtid == uint8SliceTypId || rtelem0.Kind() == reflect.Uint8) {
+ d.errorf("bytes/string in stream must decode into slice/array of bytes, not %v", frt)
}
if f.seq == seqTypeChan {
bs2 := dd.DecodeBytes(nil, true)
@@ -1544,13 +1547,13 @@ func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) {
if rv.CanSet() {
if f.seq == seqTypeSlice {
if rv.IsNil() {
- rv.Set(reflect.MakeSlice(ti.rt, 0, 0))
+ rv.Set(reflect.MakeSlice(frt, 0, 0))
} else {
rv.SetLen(0)
}
} else if f.seq == seqTypeChan {
if rv.IsNil() {
- rv.Set(reflect.MakeChan(ti.rt, 0))
+ rv.Set(reflect.MakeChan(frt, 0))
}
}
}
@@ -1558,8 +1561,6 @@ func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) {
return
}
- d.depthIncr()
-
rtelem0Size := int(rtelem0.Size())
rtElem0Kind := rtelem0.Kind()
rtelem0Mut := !isImmutableKind(rtElem0Kind)
@@ -1589,7 +1590,7 @@ func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) {
rv.SetLen(rvlen)
}
} else if rvCanset {
- rv = reflect.MakeSlice(ti.rt, rvlen, rvlen)
+ rv = reflect.MakeSlice(frt, rvlen, rvlen)
rvcap = rvlen
rvChanged = true
} else {
@@ -1628,10 +1629,10 @@ func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) {
}
if rvCanset {
if f.seq == seqTypeSlice {
- rv = reflect.MakeSlice(ti.rt, rvlen, rvlen)
+ rv = reflect.MakeSlice(frt, rvlen, rvlen)
rvChanged = true
} else { // chan
- rv = reflect.MakeChan(ti.rt, rvlen)
+ rv = reflect.MakeChan(frt, rvlen)
rvChanged = true
}
} else {
@@ -1665,7 +1666,7 @@ func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) {
var rvcap2 int
var rvErrmsg2 string
rv9, rvcap2, rvChanged, rvErrmsg2 =
- expandSliceRV(rv, ti.rt, rvCanset, rtelem0Size, 1, rvlen, rvcap)
+ expandSliceRV(rv, frt, rvCanset, rtelem0Size, 1, rvlen, rvcap)
if rvErrmsg2 != "" {
d.errorf(rvErrmsg2)
}
@@ -1711,7 +1712,7 @@ func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) {
rvlen = j
} else if j == 0 && rv.IsNil() {
if rvCanset {
- rv = reflect.MakeSlice(ti.rt, 0, 0)
+ rv = reflect.MakeSlice(frt, 0, 0)
rvChanged = true
} // else { d.errorf("kSlice: cannot change non-settable slice") }
}
@@ -1722,7 +1723,6 @@ func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) {
rv0.Set(rv)
}
- d.depthDecr()
}
// func (d *Decoder) kArray(f *codecFnInfo, rv reflect.Value) {
@@ -1732,8 +1732,7 @@ func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) {
func (d *Decoder) kMap(f *codecFnInfo, rv reflect.Value) {
dd := d.d
- containerLen := dd.ReadMapStart()
- elemsep := d.esep
+ containerLen := d.mapStart()
ti := f.ti
if rv.IsNil() {
rvlen := decInferLen(containerLen, d.h.MaxInitLen, int(ti.key.Size()+ti.elem.Size()))
@@ -1741,12 +1740,10 @@ func (d *Decoder) kMap(f *codecFnInfo, rv reflect.Value) {
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return
}
- d.depthIncr()
-
ktype, vtype := ti.key, ti.elem
ktypeId := rt2id(ktype)
vtypeKind := vtype.Kind()
@@ -1790,9 +1787,7 @@ func (d *Decoder) kMap(f *codecFnInfo, rv reflect.Value) {
rvkp = reflect.New(ktype)
rvk = rvkp.Elem()
}
- if elemsep {
- dd.ReadMapElemKey()
- }
+ d.mapElemKey()
// if false && dd.TryDecodeAsNil() { // nil cannot be a map key, so disregard this block
// // Previously, if a nil key, we just ignored the mapped value and continued.
// // However, that makes the result of encoding and then decoding map[intf]intf{nil:nil}
@@ -1821,9 +1816,7 @@ func (d *Decoder) kMap(f *codecFnInfo, rv reflect.Value) {
}
}
- if elemsep {
- dd.ReadMapElemValue()
- }
+ d.mapElemValue()
// Brittle, but OK per TryDecodeAsNil() contract.
// i.e. TryDecodeAsNil never shares slices with other decDriver procedures
@@ -1888,9 +1881,8 @@ func (d *Decoder) kMap(f *codecFnInfo, rv reflect.Value) {
// }
}
- dd.ReadMapEnd()
+ d.mapEnd()
- d.depthDecr()
}
// decNaked is used to keep track of the primitives decoded.
@@ -1928,7 +1920,7 @@ type decNaked struct {
// state
v valueType
- _ [6]bool // padding
+ // _ [6]bool // padding
// ru, ri, rf, rl, rs, rb, rt reflect.Value // mapping to the primitives above
//
@@ -1985,21 +1977,20 @@ type decNaked struct {
// --------------
type decReaderSwitch struct {
- rb bytesDecReader
- // ---- cpu cache line boundary?
- ri *ioDecReader
- bi *bufioDecReader
-
+ esep bool // has elem separators
mtr, str bool // whether maptype or slicetype are known types
be bool // is binary encoding
js bool // is json handle
jsms bool // is json handle, and MapKeyAsString
- esep bool // has elem separators
// typ entryType
bytes bool // is bytes reader
bufio bool // is this a bufioDecReader?
+
+ rb bytesDecReader
+ ri *ioDecReader
+ bi *bufioDecReader
}
// numread, track and stopTrack are always inlined, as they just check int fields, etc.
@@ -2270,17 +2261,18 @@ type Decoder struct {
d decDriver
- // NOTE: Decoder shouldn't call it's read methods,
+ // NOTE: Decoder shouldn't call its read methods,
// as the handler MAY need to do some coordination.
- r *decReaderSwitch
+ // r *decReaderSwitch
// bi *bufioDecReader
// cache the mapTypeId and sliceTypeId for faster comparisons
mtid uintptr
stid uintptr
- hh Handle
- h *BasicHandle
+ jdec *jsonDecDriver
+ h *BasicHandle
+ hh Handle
// ---- cpu cache line boundary?
decReaderSwitch
@@ -2289,22 +2281,20 @@ type Decoder struct {
n decNaked
// cr containerStateRecv
- err error
- depth int16
- maxdepth int16
-
- // Extensions can call Decode() within a current Decode() call.
- // We need to know when the top level Decode() call returns,
- // so we can decide whether to Release() or not.
- calls uint16 // what depth in mustDecode are we in now.
-
- _ [2]uint8 // padding
+ // _ [4]uint8 // padding
is map[string]string // used for interning strings
+ err error
+
// ---- cpu cache line boundary?
- b [decScratchByteArrayLen]byte // scratch buffer, used by Decoder and xxxEncDrivers
+ // ---- writable fields during execution --- *try* to keep in sep cache line
+ maxdepth int16
+ depth int16
+ c containerState
+ _ [3]byte // padding
+ b [decScratchByteArrayLen]byte // scratch buffer, used by Decoder and xxxEncDrivers
// padding - false sharing help // modify 232 if Decoder struct changes.
// _ [cacheLineSize - 232%cacheLineSize]byte
@@ -2337,12 +2327,13 @@ func newDecoder(h Handle) *Decoder {
runtime.SetFinalizer(d, (*Decoder).finalize)
// xdebugf(">>>> new(Decoder) with finalizer")
}
- d.r = &d.decReaderSwitch
+ // d.r = &d.decReaderSwitch
d.hh = h
d.be = h.isBinary()
// NOTE: do not initialize d.n here. It is lazily initialized in d.naked()
var jh *JsonHandle
jh, d.js = h.(*JsonHandle)
+ d.jdec = nil
if d.js {
d.jsms = jh.MapKeyAsString
}
@@ -2351,15 +2342,21 @@ func newDecoder(h Handle) *Decoder {
d.is = make(map[string]string, 32)
}
d.d = h.newDecDriver(d)
+ if d.js {
+ d.jdec = d.d.(*jsonDecDriver)
+ }
// d.cr, _ = d.d.(containerStateRecv)
return d
}
+func (d *Decoder) r() *decReaderSwitch {
+ return &d.decReaderSwitch
+}
+
func (d *Decoder) resetCommon() {
// d.r = &d.decReaderSwitch
d.d.reset()
d.err = nil
- d.calls = 0
d.depth = 0
d.maxdepth = d.h.MaxDepth
if d.maxdepth <= 0 {
@@ -2500,7 +2497,9 @@ func (d *Decoder) Decode(v interface{}) (err error) {
defer func() {
if x := recover(); x != nil {
panicValToErr(d, x, &d.err)
- err = d.err
+ if d.err != err {
+ err = d.err
+ }
}
}()
}
@@ -2523,16 +2522,21 @@ func (d *Decoder) MustDecode(v interface{}) {
// This provides insight to the code location that triggered the error.
func (d *Decoder) mustDecode(v interface{}) {
// TODO: Top-level: ensure that v is a pointer and not nil.
- d.calls++
if d.d.TryDecodeAsNil() {
setZero(v)
- } else {
+ return
+ }
+ if d.bi == nil {
d.decode(v)
+ return
}
- // xprintf(">>>>>>>> >>>>>>>> num decFns: %v\n", d.cf.sn)
- d.calls--
- if !d.h.ExplicitRelease && d.calls == 0 {
- d.Release()
+
+ d.bi.calls++
+ d.decode(v)
+ // xprintf.(">>>>>>>> >>>>>>>> num decFns: %v\n", d.cf.sn)
+ d.bi.calls--
+ if !d.h.ExplicitRelease && d.bi.calls == 0 {
+ d.bi.release()
}
}
@@ -2558,12 +2562,8 @@ func (d *Decoder) finalize() {
//
// By default, Release() is automatically called unless the option ExplicitRelease is set.
func (d *Decoder) Release() {
- if useFinalizers && removeFinalizerOnRelease {
- runtime.SetFinalizer(d, nil)
- }
- if d.bi != nil && d.bi.bytesBufPooler.pool != nil {
- d.bi.buf = nil
- d.bi.bytesBufPooler.end()
+ if d.bi != nil {
+ d.bi.release()
}
// d.decNakedPooler.end()
}
@@ -2580,37 +2580,26 @@ func (d *Decoder) swallow() {
if dd.TryDecodeAsNil() {
return
}
- elemsep := d.esep
switch dd.ContainerType() {
case valueTypeMap:
- containerLen := dd.ReadMapStart()
- d.depthIncr()
+ containerLen := d.mapStart()
hasLen := containerLen >= 0
for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
// if clenGtEqualZero {if j >= containerLen {break} } else if dd.CheckBreak() {break}
- if elemsep {
- dd.ReadMapElemKey()
- }
+ d.mapElemKey()
d.swallow()
- if elemsep {
- dd.ReadMapElemValue()
- }
+ d.mapElemValue()
d.swallow()
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
case valueTypeArray:
- containerLen := dd.ReadArrayStart()
- d.depthIncr()
+ containerLen := d.arrayStart()
hasLen := containerLen >= 0
for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if elemsep {
- dd.ReadArrayElem()
- }
+ d.arrayElem()
d.swallow()
}
- dd.ReadArrayEnd()
- d.depthDecr()
+ d.arrayEnd()
case valueTypeBytes:
dd.DecodeBytes(d.b[:], true)
case valueTypeString:
@@ -2722,11 +2711,7 @@ func (d *Decoder) decode(iv interface{}) {
case *uint64:
*v = d.d.DecodeUint64()
case *float32:
- f64 := d.d.DecodeFloat64()
- if chkOvf.Float32(f64) {
- d.errorf("float32 overflow: %v", f64)
- }
- *v = float32(f64)
+ *v = float32(d.decodeFloat32())
case *float64:
*v = d.d.DecodeFloat64()
case *[]uint8:
@@ -2887,9 +2872,9 @@ func (d *Decoder) string(v []byte) (s string) {
// nextValueBytes returns the next value in the stream as a set of bytes.
func (d *Decoder) nextValueBytes() (bs []byte) {
d.d.uncacheRead()
- d.r.track()
+ d.r().track()
d.swallow()
- bs = d.r.stopTrack()
+ bs = d.r().stopTrack()
return
}
@@ -2903,12 +2888,76 @@ func (d *Decoder) rawBytes() []byte {
}
func (d *Decoder) wrapErr(v interface{}, err *error) {
- *err = decodeError{codecError: codecError{name: d.hh.Name(), err: v}, pos: int(d.r.numread())}
+ *err = decodeError{codecError: codecError{name: d.hh.Name(), err: v}, pos: int(d.r().numread())}
}
// NumBytesRead returns the number of bytes read
func (d *Decoder) NumBytesRead() int {
- return int(d.r.numread())
+ return int(d.r().numread())
+}
+
+// decodeFloat32 will delegate to an appropriate DecodeFloat32 implementation (if exists),
+// else if will call DecodeFloat64 and ensure the value doesn't overflow.
+//
+// Note that we return float64 to reduce unnecessary conversions
+func (d *Decoder) decodeFloat32() float64 {
+ if d.js {
+ return d.jdec.DecodeFloat32() // custom implementation for 32-bit
+ }
+ return chkOvf.Float32V(d.d.DecodeFloat64())
+}
+
+// ---- container tracking
+// Note: We update the .c after calling the callback.
+// This way, the callback can know what the last status was.
+
+func (d *Decoder) mapStart() (v int) {
+ v = d.d.ReadMapStart()
+ d.depthIncr()
+ d.c = containerMapStart
+ return
+}
+
+func (d *Decoder) mapElemKey() {
+ if d.js {
+ d.jdec.ReadMapElemKey()
+ }
+ d.c = containerMapKey
+}
+
+func (d *Decoder) mapElemValue() {
+ if d.js {
+ d.jdec.ReadMapElemValue()
+ }
+ d.c = containerMapValue
+}
+
+func (d *Decoder) mapEnd() {
+ d.d.ReadMapEnd()
+ d.depthDecr()
+ d.c = containerMapEnd
+ d.c = 0
+}
+
+func (d *Decoder) arrayStart() (v int) {
+ v = d.d.ReadArrayStart()
+ d.depthIncr()
+ d.c = containerArrayStart
+ return
+}
+
+func (d *Decoder) arrayElem() {
+ if d.js {
+ d.jdec.ReadArrayElem()
+ }
+ d.c = containerArrayElem
+}
+
+func (d *Decoder) arrayEnd() {
+ d.d.ReadArrayEnd()
+ d.depthDecr()
+ d.c = containerArrayEnd
+ d.c = 0
}
// --------------------------------------------------
@@ -2916,43 +2965,41 @@ func (d *Decoder) NumBytesRead() int {
// decSliceHelper assists when decoding into a slice, from a map or an array in the stream.
// A slice can be set from a map or array in stream. This supports the MapBySlice interface.
type decSliceHelper struct {
- d *Decoder
- // ct valueType
+ d *Decoder
+ ct valueType
array bool
}
func (d *Decoder) decSliceHelperStart() (x decSliceHelper, clen int) {
- dd := d.d
- ctyp := dd.ContainerType()
- switch ctyp {
+ x.ct = d.d.ContainerType()
+ x.d = d
+ switch x.ct {
case valueTypeArray:
x.array = true
- clen = dd.ReadArrayStart()
+ clen = d.arrayStart()
case valueTypeMap:
- clen = dd.ReadMapStart() * 2
+ clen = d.mapStart() * 2
default:
- d.errorf("only encoded map or array can be decoded into a slice (%d)", ctyp)
+ d.errorf("only encoded map or array can be decoded into a slice (%d)", x.ct)
}
- // x.ct = ctyp
- x.d = d
return
}
func (x decSliceHelper) End() {
if x.array {
- x.d.d.ReadArrayEnd()
+ x.d.arrayEnd()
} else {
- x.d.d.ReadMapEnd()
+ x.d.mapEnd()
}
}
func (x decSliceHelper) ElemContainerState(index int) {
if x.array {
- x.d.d.ReadArrayElem()
+ x.d.arrayElem()
} else if index%2 == 0 {
- x.d.d.ReadMapElemKey()
+ x.d.mapElemKey()
} else {
- x.d.d.ReadMapElemValue()
+ x.d.mapElemValue()
}
}
@@ -3086,3 +3133,13 @@ func decReadFull(r io.Reader, bs []byte) (n uint, err error) {
// if n != len(bs) && err == io.EOF { err = io.ErrUnexpectedEOF }
return
}
+
+func decNakedReadRawBytes(dr decDriver, d *Decoder, n *decNaked, rawToString bool) {
+ if rawToString {
+ n.v = valueTypeString
+ n.s = string(dr.DecodeBytes(d.b[:], true))
+ } else {
+ n.v = valueTypeBytes
+ n.l = dr.DecodeBytes(nil, false)
+ }
+}
diff --git a/vendor/github.com/ugorji/go/codec/0doc.go b/vendor/github.com/ugorji/go/codec/doc.go
similarity index 86%
rename from vendor/github.com/ugorji/go/codec/0doc.go
rename to vendor/github.com/ugorji/go/codec/doc.go
index 9c8ce86f..8d04cc18 100644
--- a/vendor/github.com/ugorji/go/codec/0doc.go
+++ b/vendor/github.com/ugorji/go/codec/doc.go
@@ -14,15 +14,11 @@ Supported Serialization formats are:
- json: http://json.org http://tools.ietf.org/html/rfc7159
- simple:
-To install:
-
- go get github.com/ugorji/go/codec
-
-This package will carefully use 'unsafe' for performance reasons in specific places.
+This package will carefully use 'package unsafe' for performance reasons in specific places.
You can build without unsafe use by passing the safe or appengine tag
-i.e. 'go install -tags=safe ...'. Note that unsafe is only supported for the last 3
-go sdk versions e.g. current go release is go 1.9, so we support unsafe use only from
-go 1.7+ . This is because supporting unsafe requires knowledge of implementation details.
+i.e. 'go install -tags=safe ...'. Note that unsafe is only supported for the last 4
+go releases e.g. current go release is go 1.12, so we support unsafe use only from
+go 1.9+ . This is because supporting unsafe requires knowledge of implementation details.
For detailed usage information, read the primer at http://ugorji.net/blog/go-codec-primer .
@@ -109,7 +105,7 @@ We determine how to encode or decode by walking this decision tree
- is there an extension registered for the type?
- is format binary, and is type a encoding.BinaryMarshaler and BinaryUnmarshaler?
- is format specifically json, and is type a encoding/json.Marshaler and Unmarshaler?
- - is format text-based, and type an encoding.TextMarshaler?
+ - is format text-based, and type an encoding.TextMarshaler and TextUnmarshaler?
- else we use a pair of functions based on the "kind" of the type e.g. map, slice, int64, etc
This symmetry is important to reduce chances of issues happening because the
@@ -206,8 +202,35 @@ You can run the tag 'safe' to run tests or build in safe mode. e.g.
Running Benchmarks
+ cd bench
+ go test -bench . -benchmem -benchtime 1s
+
Please see http://github.com/ugorji/go-codec-bench .
+Managing Binary Size
+
+This package adds some size to any binary that depends on it.
+This is because we include an auto-generated file: `fast-path.generated.go`
+to help with performance when encoding/decoding slices and maps of
+built in numeric, boolean, string and interface{} types.
+
+Prior to 2019-05-16, this package could add about 11MB to the size of your binaries.
+We have now trimmed that in half, and the package contributes about 5.5MB.
+
+You can override this by building (or running tests and benchmarks)
+with the tag: `notfastpath`.
+
+ go install -tags notfastpath
+ go build -tags notfastpath
+ go test -tags notfastpath
+
+With the tag `notfastpath`, we trim that size to about 2.9MB.
+
+Be aware that, at least in our representative microbenchmarks for cbor (for example),
+passing `notfastpath` tag causes up to 33% increase in decoding and
+50% increase in encoding speeds.
+YMMV.
+
Caveats
Struct fields matching the following are ignored during encoding and decoding
diff --git a/vendor/github.com/ugorji/go/codec/encode.go b/vendor/github.com/ugorji/go/codec/encode.go
index 6647c674..0a55dda8 100644
--- a/vendor/github.com/ugorji/go/codec/encode.go
+++ b/vendor/github.com/ugorji/go/codec/encode.go
@@ -12,7 +12,6 @@ import (
"runtime"
"sort"
"strconv"
- "sync"
"time"
)
@@ -31,6 +30,7 @@ var errEncoderNotInitialized = errors.New("Encoder not initialized")
type encWriter interface {
writeb([]byte)
writestr(string)
+ writeqstr(string) // write string wrapped in quotes ie "..."
writen1(byte)
writen2(byte, byte)
end()
@@ -49,29 +49,27 @@ type encDriver interface {
// encodeExtPreamble(xtag byte, length int)
EncodeRawExt(re *RawExt, e *Encoder)
EncodeExt(v interface{}, xtag uint64, ext Ext, e *Encoder)
- // Deprecated: try to use EncodeStringEnc instead
- EncodeString(c charEncoding, v string)
- // c cannot be cRAW
- EncodeStringEnc(c charEncoding, v string)
+ EncodeStringEnc(c charEncoding, v string) // c cannot be cRAW
// EncodeSymbol(v string)
- // Deprecated: try to use EncodeStringBytesRaw instead
- EncodeStringBytes(c charEncoding, v []byte)
EncodeStringBytesRaw(v []byte)
EncodeTime(time.Time)
//encBignum(f *big.Int)
//encStringRunes(c charEncoding, v []rune)
WriteArrayStart(length int)
- WriteArrayElem()
WriteArrayEnd()
WriteMapStart(length int)
- WriteMapElemKey()
- WriteMapElemValue()
WriteMapEnd()
reset()
atEndOfEncode()
}
+type encDriverContainerTracker interface {
+ WriteArrayElem()
+ WriteMapElemKey()
+ WriteMapElemValue()
+}
+
type encDriverAsis interface {
EncodeAsis(v []byte)
}
@@ -87,26 +85,27 @@ func (e encodeError) Error() string {
type encDriverNoopContainerWriter struct{}
func (encDriverNoopContainerWriter) WriteArrayStart(length int) {}
-func (encDriverNoopContainerWriter) WriteArrayElem() {}
func (encDriverNoopContainerWriter) WriteArrayEnd() {}
func (encDriverNoopContainerWriter) WriteMapStart(length int) {}
-func (encDriverNoopContainerWriter) WriteMapElemKey() {}
-func (encDriverNoopContainerWriter) WriteMapElemValue() {}
func (encDriverNoopContainerWriter) WriteMapEnd() {}
func (encDriverNoopContainerWriter) atEndOfEncode() {}
-type encDriverTrackContainerWriter struct {
- c containerState
-}
+// func (encDriverNoopContainerWriter) WriteArrayElem() {}
+// func (encDriverNoopContainerWriter) WriteMapElemKey() {}
+// func (encDriverNoopContainerWriter) WriteMapElemValue() {}
+
+// type encDriverTrackContainerWriter struct {
+// c containerState
+// }
-func (e *encDriverTrackContainerWriter) WriteArrayStart(length int) { e.c = containerArrayStart }
-func (e *encDriverTrackContainerWriter) WriteArrayElem() { e.c = containerArrayElem }
-func (e *encDriverTrackContainerWriter) WriteArrayEnd() { e.c = containerArrayEnd }
-func (e *encDriverTrackContainerWriter) WriteMapStart(length int) { e.c = containerMapStart }
-func (e *encDriverTrackContainerWriter) WriteMapElemKey() { e.c = containerMapKey }
-func (e *encDriverTrackContainerWriter) WriteMapElemValue() { e.c = containerMapValue }
-func (e *encDriverTrackContainerWriter) WriteMapEnd() { e.c = containerMapEnd }
-func (e *encDriverTrackContainerWriter) atEndOfEncode() {}
+// func (e *encDriverTrackContainerWriter) WriteArrayStart(length int) { e.c = containerArrayStart }
+// func (e *encDriverTrackContainerWriter) WriteArrayElem() { e.c = containerArrayElem }
+// func (e *encDriverTrackContainerWriter) WriteArrayEnd() { e.c = containerArrayEnd }
+// func (e *encDriverTrackContainerWriter) WriteMapStart(length int) { e.c = containerMapStart }
+// func (e *encDriverTrackContainerWriter) WriteMapElemKey() { e.c = containerMapKey }
+// func (e *encDriverTrackContainerWriter) WriteMapElemValue() { e.c = containerMapValue }
+// func (e *encDriverTrackContainerWriter) WriteMapEnd() { e.c = containerMapEnd }
+// func (e *encDriverTrackContainerWriter) atEndOfEncode() {}
// type ioEncWriterWriter interface {
// WriteByte(c byte) error
@@ -170,6 +169,19 @@ type EncodeOptions struct {
// If unset, we error out.
Raw bool
+ // StringToRaw controls how strings are encoded.
+ //
+ // As a go string is just an (immutable) sequence of bytes,
+ // it can be encoded either as raw bytes or as a UTF string.
+ //
+ // By default, strings are encoded as UTF-8.
+ // but can be treated as []byte during an encode.
+ //
+ // Note that things which we know (by definition) to be UTF-8
+ // are ALWAYS encoded as UTF-8 strings.
+ // These include encoding.TextMarshaler, time.Format calls, struct field names, etc.
+ StringToRaw bool
+
// // AsSymbols defines what should be encoded as symbols.
// //
// // Encoding as symbols can reduce the encoded size significantly.
@@ -239,6 +251,10 @@ func (z *ioEncWriter) writestr(s string) {
}
}
+func (z *ioEncWriter) writeqstr(s string) {
+ writestr("\"" + s + "\"")
+}
+
func (z *ioEncWriter) writen1(b byte) {
if err := z.bw.WriteByte(b); err != nil {
panic(err)
@@ -277,13 +293,28 @@ func (z *ioEncWriter) end() {
// bufioEncWriter
type bufioEncWriter struct {
+ w io.Writer
+
buf []byte
- w io.Writer
- n int
+ n int
+
+ // Extensions can call Encode() within a current Encode() call.
+ // We need to know when the top level Encode() call returns,
+ // so we can decide whether to Release() or not.
+ calls uint16 // what depth in mustDecode are we in now.
+
+ sz int // buf size
+ // _ uint64 // padding (cache-aligned)
+
+ // ---- cache line
+
+ // write-most fields below
+
+ // less used fields
bytesBufPooler
- _ [3]uint64 // padding
+ b [40]byte // scratch buffer and padding (cache-aligned)
// a int
// b [4]byte
// err
@@ -292,29 +323,41 @@ type bufioEncWriter struct {
func (z *bufioEncWriter) reset(w io.Writer, bufsize int) {
z.w = w
z.n = 0
+ z.calls = 0
if bufsize <= 0 {
bufsize = defEncByteBufSize
}
+ z.sz = bufsize
if cap(z.buf) >= bufsize {
z.buf = z.buf[:cap(z.buf)]
+ } else if bufsize <= len(z.b) {
+ z.buf = z.b[:]
} else {
- z.bytesBufPooler.end() // potentially return old one to pool
z.buf = z.bytesBufPooler.get(bufsize)
// z.buf = make([]byte, bufsize)
}
}
+func (z *bufioEncWriter) release() {
+ z.buf = nil
+ z.bytesBufPooler.end()
+}
+
//go:noinline - flush only called intermittently
-func (z *bufioEncWriter) flush() {
+func (z *bufioEncWriter) flushErr() (err error) {
n, err := z.w.Write(z.buf[:z.n])
z.n -= n
if z.n > 0 && err == nil {
err = io.ErrShortWrite
}
- if err != nil {
- if n > 0 && z.n > 0 {
- copy(z.buf, z.buf[n:z.n+n])
- }
+ if n > 0 && z.n > 0 {
+ copy(z.buf, z.buf[n:z.n+n])
+ }
+ return err
+}
+
+func (z *bufioEncWriter) flush() {
+ if err := z.flushErr(); err != nil {
panic(err)
}
}
@@ -344,6 +387,29 @@ LOOP:
z.n += copy(z.buf[z.n:], s)
}
+func (z *bufioEncWriter) writeqstr(s string) {
+ // z.writen1('"')
+ // z.writestr(s)
+ // z.writen1('"')
+
+ if z.n+len(s)+2 > len(z.buf) {
+ z.flush()
+ }
+ z.buf[z.n] = '"'
+ z.n++
+LOOP:
+ a := len(z.buf) - z.n
+ if len(s)+1 > a {
+ z.n += copy(z.buf[z.n:], s[:a])
+ s = s[a:]
+ z.flush()
+ goto LOOP
+ }
+ z.n += copy(z.buf[z.n:], s)
+ z.buf[z.n] = '"'
+ z.n++
+}
+
func (z *bufioEncWriter) writen1(b1 byte) {
if 1 > len(z.buf)-z.n {
z.flush()
@@ -361,10 +427,11 @@ func (z *bufioEncWriter) writen2(b1, b2 byte) {
z.n += 2
}
-func (z *bufioEncWriter) end() {
+func (z *bufioEncWriter) endErr() (err error) {
if z.n > 0 {
- z.flush()
+ err = z.flushErr()
}
+ return
}
// ---------------------------------------------
@@ -381,14 +448,24 @@ func (z *bytesEncAppender) writeb(s []byte) {
func (z *bytesEncAppender) writestr(s string) {
z.b = append(z.b, s...)
}
+func (z *bytesEncAppender) writeqstr(s string) {
+ // z.writen1('"')
+ // z.writestr(s)
+ // z.writen1('"')
+ z.b = append(append(append(z.b, '"'), s...), '"')
+ // z.b = append(z.b, '"')
+ // z.b = append(z.b, s...)
+ // z.b = append(z.b, '"')
+}
func (z *bytesEncAppender) writen1(b1 byte) {
z.b = append(z.b, b1)
}
func (z *bytesEncAppender) writen2(b1, b2 byte) {
z.b = append(z.b, b1, b2)
}
-func (z *bytesEncAppender) end() {
+func (z *bytesEncAppender) endErr() error {
*(z.out) = z.b
+ return nil
}
func (z *bytesEncAppender) reset(in []byte, out *[]byte) {
z.b = in[:0]
@@ -437,97 +514,30 @@ func (e *Encoder) kErr(f *codecFnInfo, rv reflect.Value) {
}
func (e *Encoder) kSlice(f *codecFnInfo, rv reflect.Value) {
- ti := f.ti
- ee := e.e
// array may be non-addressable, so we have to manage with care
// (don't call rv.Bytes, rv.Slice, etc).
// E.g. type struct S{B [2]byte};
// Encode(S{}) will bomb on "panic: slice of unaddressable array".
if f.seq != seqTypeArray {
if rv.IsNil() {
- ee.EncodeNil()
+ e.e.EncodeNil()
return
}
// If in this method, then there was no extension function defined.
// So it's okay to treat as []byte.
- if ti.rtid == uint8SliceTypId {
- ee.EncodeStringBytesRaw(rv.Bytes())
+ if f.ti.rtid == uint8SliceTypId {
+ e.e.EncodeStringBytesRaw(rv.Bytes())
return
}
}
- if f.seq == seqTypeChan && ti.chandir&uint8(reflect.RecvDir) == 0 {
+ if f.seq == seqTypeChan && f.ti.chandir&uint8(reflect.RecvDir) == 0 {
e.errorf("send-only channel cannot be encoded")
}
- elemsep := e.esep
- rtelem := ti.elem
- rtelemIsByte := uint8TypId == rt2id(rtelem) // NOT rtelem.Kind() == reflect.Uint8
- var l int
+ mbs := f.ti.mbs
+ rtelem := f.ti.elem
// if a slice, array or chan of bytes, treat specially
- if rtelemIsByte {
- switch f.seq {
- case seqTypeSlice:
- ee.EncodeStringBytesRaw(rv.Bytes())
- case seqTypeArray:
- l = rv.Len()
- if rv.CanAddr() {
- ee.EncodeStringBytesRaw(rv.Slice(0, l).Bytes())
- } else {
- var bs []byte
- if l <= cap(e.b) {
- bs = e.b[:l]
- } else {
- bs = make([]byte, l)
- }
- reflect.Copy(reflect.ValueOf(bs), rv)
- ee.EncodeStringBytesRaw(bs)
- }
- case seqTypeChan:
- // do not use range, so that the number of elements encoded
- // does not change, and encoding does not hang waiting on someone to close chan.
- // for b := range rv2i(rv).(<-chan byte) { bs = append(bs, b) }
- // ch := rv2i(rv).(<-chan byte) // fix error - that this is a chan byte, not a <-chan byte.
-
- if rv.IsNil() {
- ee.EncodeNil()
- break
- }
- bs := e.b[:0]
- irv := rv2i(rv)
- ch, ok := irv.(<-chan byte)
- if !ok {
- ch = irv.(chan byte)
- }
-
- L1:
- switch timeout := e.h.ChanRecvTimeout; {
- case timeout == 0: // only consume available
- for {
- select {
- case b := <-ch:
- bs = append(bs, b)
- default:
- break L1
- }
- }
- case timeout > 0: // consume until timeout
- tt := time.NewTimer(timeout)
- for {
- select {
- case b := <-ch:
- bs = append(bs, b)
- case <-tt.C:
- // close(tt.C)
- break L1
- }
- }
- default: // consume until close
- for b := range ch {
- bs = append(bs, b)
- }
- }
-
- ee.EncodeStringBytesRaw(bs)
- }
+ if !mbs && uint8TypId == rt2id(rtelem) { // NOT rtelem.Kind() == reflect.Uint8
+ e.kSliceBytes(rv, f.seq)
return
}
@@ -563,15 +573,15 @@ func (e *Encoder) kSlice(f *codecFnInfo, rv reflect.Value) {
rv = rvcs // TODO: ensure this doesn't mess up anywhere that rv of kind chan is expected
}
- l = rv.Len()
- if ti.mbs {
+ var l = rv.Len()
+ if mbs {
if l%2 == 1 {
e.errorf("mapBySlice requires even slice length, but got %v", l)
return
}
- ee.WriteMapStart(l / 2)
+ e.mapStart(l / 2)
} else {
- ee.WriteArrayStart(l)
+ e.arrayStart(l)
}
if l > 0 {
@@ -586,115 +596,122 @@ func (e *Encoder) kSlice(f *codecFnInfo, rv reflect.Value) {
fn = e.h.fn(rtelem, true, true)
}
for j := 0; j < l; j++ {
- if elemsep {
- if ti.mbs {
- if j%2 == 0 {
- ee.WriteMapElemKey()
- } else {
- ee.WriteMapElemValue()
- }
+ if mbs {
+ if j%2 == 0 {
+ e.mapElemKey()
} else {
- ee.WriteArrayElem()
+ e.mapElemValue()
}
+ } else {
+ e.arrayElem()
}
e.encodeValue(rv.Index(j), fn, true)
}
}
- if ti.mbs {
- ee.WriteMapEnd()
+ if mbs {
+ e.mapEnd()
} else {
- ee.WriteArrayEnd()
+ e.arrayEnd()
}
}
-func (e *Encoder) kStructNoOmitempty(f *codecFnInfo, rv reflect.Value) {
- fti := f.ti
- tisfi := fti.sfiSrc
- toMap := !(fti.toArray || e.h.StructToArray)
- if toMap {
- tisfi = fti.sfiSort
- }
-
- ee := e.e
-
- sfn := structFieldNode{v: rv, update: false}
- if toMap {
- ee.WriteMapStart(len(tisfi))
- if e.esep {
- for _, si := range tisfi {
- ee.WriteMapElemKey()
- // ee.EncodeStringEnc(cUTF8, si.encName)
- e.kStructFieldKey(fti.keyType, si)
- ee.WriteMapElemValue()
- e.encodeValue(sfn.field(si), nil, true)
- }
+func (e *Encoder) kSliceBytes(rv reflect.Value, seq seqType) {
+ // xdebugf("kSliceBytes: seq: %d, rvType: %v", seq, rv.Type())
+ switch seq {
+ case seqTypeSlice:
+ e.e.EncodeStringBytesRaw(rv.Bytes())
+ case seqTypeArray:
+ var l = rv.Len()
+ if rv.CanAddr() {
+ e.e.EncodeStringBytesRaw(rv.Slice(0, l).Bytes())
} else {
- for _, si := range tisfi {
- // ee.EncodeStringEnc(cUTF8, si.encName)
- e.kStructFieldKey(fti.keyType, si)
- e.encodeValue(sfn.field(si), nil, true)
+ var bs []byte
+ if l <= cap(e.b) {
+ bs = e.b[:l]
+ } else {
+ bs = make([]byte, l)
}
+ reflect.Copy(reflect.ValueOf(bs), rv)
+ e.e.EncodeStringBytesRaw(bs)
}
- ee.WriteMapEnd()
- } else {
- ee.WriteArrayStart(len(tisfi))
- if e.esep {
- for _, si := range tisfi {
- ee.WriteArrayElem()
- e.encodeValue(sfn.field(si), nil, true)
+ case seqTypeChan:
+ // do not use range, so that the number of elements encoded
+ // does not change, and encoding does not hang waiting on someone to close chan.
+ // for b := range rv2i(rv).(<-chan byte) { bs = append(bs, b) }
+ // ch := rv2i(rv).(<-chan byte) // fix error - that this is a chan byte, not a <-chan byte.
+
+ if rv.IsNil() {
+ e.e.EncodeNil()
+ break
+ }
+ bs := e.b[:0]
+ irv := rv2i(rv)
+ ch, ok := irv.(<-chan byte)
+ if !ok {
+ ch = irv.(chan byte)
+ }
+
+ L1:
+ switch timeout := e.h.ChanRecvTimeout; {
+ case timeout == 0: // only consume available
+ for {
+ select {
+ case b := <-ch:
+ bs = append(bs, b)
+ default:
+ break L1
+ }
}
- } else {
- for _, si := range tisfi {
- e.encodeValue(sfn.field(si), nil, true)
+ case timeout > 0: // consume until timeout
+ tt := time.NewTimer(timeout)
+ for {
+ select {
+ case b := <-ch:
+ bs = append(bs, b)
+ case <-tt.C:
+ // close(tt.C)
+ break L1
+ }
+ }
+ default: // consume until close
+ for b := range ch {
+ bs = append(bs, b)
}
}
- ee.WriteArrayEnd()
+
+ e.e.EncodeStringBytesRaw(bs)
}
}
-func (e *Encoder) kStructFieldKey(keyType valueType, s *structFieldInfo) {
- var m must
- // use if-else-if, not switch (which compiles to binary-search)
- // since keyType is typically valueTypeString, branch prediction is pretty good.
- if keyType == valueTypeString {
- if e.js && s.encNameAsciiAlphaNum { // keyType == valueTypeString
- e.w.writen1('"')
- e.w.writestr(s.encName)
- e.w.writen1('"')
- } else { // keyType == valueTypeString
- e.e.EncodeStringEnc(cUTF8, s.encName)
+func (e *Encoder) kStructNoOmitempty(f *codecFnInfo, rv reflect.Value) {
+ sfn := structFieldNode{v: rv, update: false}
+ if f.ti.toArray || e.h.StructToArray { // toArray
+ e.arrayStart(len(f.ti.sfiSrc))
+ for _, si := range f.ti.sfiSrc {
+ e.arrayElem()
+ e.encodeValue(sfn.field(si), nil, true)
}
- } else if keyType == valueTypeInt {
- e.e.EncodeInt(m.Int(strconv.ParseInt(s.encName, 10, 64)))
- } else if keyType == valueTypeUint {
- e.e.EncodeUint(m.Uint(strconv.ParseUint(s.encName, 10, 64)))
- } else if keyType == valueTypeFloat {
- e.e.EncodeFloat64(m.Float(strconv.ParseFloat(s.encName, 64)))
+ e.arrayEnd()
+ } else {
+ e.mapStart(len(f.ti.sfiSort))
+ for _, si := range f.ti.sfiSort {
+ e.mapElemKey()
+ e.kStructFieldKey(f.ti.keyType, si.encNameAsciiAlphaNum, si.encName)
+ e.mapElemValue()
+ e.encodeValue(sfn.field(si), nil, true)
+ }
+ e.mapEnd()
}
}
-func (e *Encoder) kStructFieldKeyName(keyType valueType, encName string) {
- var m must
- // use if-else-if, not switch (which compiles to binary-search)
- // since keyType is typically valueTypeString, branch prediction is pretty good.
- if keyType == valueTypeString {
- e.e.EncodeStringEnc(cUTF8, encName)
- } else if keyType == valueTypeInt {
- e.e.EncodeInt(m.Int(strconv.ParseInt(encName, 10, 64)))
- } else if keyType == valueTypeUint {
- e.e.EncodeUint(m.Uint(strconv.ParseUint(encName, 10, 64)))
- } else if keyType == valueTypeFloat {
- e.e.EncodeFloat64(m.Float(strconv.ParseFloat(encName, 64)))
- }
+func (e *Encoder) kStructFieldKey(keyType valueType, encNameAsciiAlphaNum bool, encName string) {
+ encStructFieldKey(encName, e.e, e.w(), keyType, encNameAsciiAlphaNum, e.js)
}
func (e *Encoder) kStruct(f *codecFnInfo, rv reflect.Value) {
- fti := f.ti
- elemsep := e.esep
- tisfi := fti.sfiSrc
var newlen int
- toMap := !(fti.toArray || e.h.StructToArray)
+ toMap := !(f.ti.toArray || e.h.StructToArray)
var mf map[string]interface{}
if f.ti.mf {
mf = rv2i(rv).(MissingFielder).CodecMissingFields()
@@ -712,12 +729,7 @@ func (e *Encoder) kStruct(f *codecFnInfo, rv reflect.Value) {
toMap = true
newlen += len(mf)
}
- // if toMap, use the sorted array. If toArray, use unsorted array (to match sequence in struct)
- if toMap {
- tisfi = fti.sfiSort
- }
- newlen += len(tisfi)
- ee := e.e
+ newlen += len(f.ti.sfiSrc)
// Use sync.Pool to reduce allocating slices unnecessarily.
// The cost of sync.Pool is less than the cost of new allocation.
@@ -731,133 +743,97 @@ func (e *Encoder) kStruct(f *codecFnInfo, rv reflect.Value) {
// The cost is that of locking sometimes, but sync.Pool is efficient
// enough to reduce thread contention.
- var spool *sync.Pool
- var poolv interface{}
- var fkvs []sfiRv
// fmt.Printf(">>>>>>>>>>>>>> encode.kStruct: newlen: %d\n", newlen)
- if newlen < 0 { // bounds-check-elimination
- // cannot happen // here for bounds-check-elimination
- } else if newlen <= 8 {
- spool, poolv = pool.sfiRv8()
- fkvs = poolv.(*[8]sfiRv)[:newlen]
- } else if newlen <= 16 {
- spool, poolv = pool.sfiRv16()
- fkvs = poolv.(*[16]sfiRv)[:newlen]
- } else if newlen <= 32 {
- spool, poolv = pool.sfiRv32()
- fkvs = poolv.(*[32]sfiRv)[:newlen]
- } else if newlen <= 64 {
- spool, poolv = pool.sfiRv64()
- fkvs = poolv.(*[64]sfiRv)[:newlen]
- } else if newlen <= 128 {
- spool, poolv = pool.sfiRv128()
- fkvs = poolv.(*[128]sfiRv)[:newlen]
- } else {
- fkvs = make([]sfiRv, newlen)
- }
+ var spool sfiRvPooler
+ var fkvs = spool.get(newlen)
- var kv sfiRv
recur := e.h.RecursiveEmptyCheck
sfn := structFieldNode{v: rv, update: false}
- newlen = 0
- for _, si := range tisfi {
- // kv.r = si.field(rv, false)
- kv.r = sfn.field(si)
- if toMap {
+
+ var kv sfiRv
+ var j int
+ if toMap {
+ newlen = 0
+ for _, si := range f.ti.sfiSort { // use sorted array
+ // kv.r = si.field(rv, false)
+ kv.r = sfn.field(si)
if si.omitEmpty() && isEmptyValue(kv.r, e.h.TypeInfos, recur, recur) {
continue
}
kv.v = si // si.encName
- } else {
- // use the zero value.
- // if a reference or struct, set to nil (so you do not output too much)
- if si.omitEmpty() && isEmptyValue(kv.r, e.h.TypeInfos, recur, recur) {
- switch kv.r.Kind() {
- case reflect.Struct, reflect.Interface, reflect.Ptr, reflect.Array, reflect.Map, reflect.Slice:
- kv.r = reflect.Value{} //encode as nil
- }
- }
- }
- fkvs[newlen] = kv
- newlen++
- }
- fkvs = fkvs[:newlen]
-
- var mflen int
- for k, v := range mf {
- if k == "" {
- delete(mf, k)
- continue
+ fkvs[newlen] = kv
+ newlen++
}
- if fti.infoFieldOmitempty && isEmptyValue(reflect.ValueOf(v), e.h.TypeInfos, recur, recur) {
- delete(mf, k)
- continue
- }
- mflen++
- }
-
- var j int
- if toMap {
- ee.WriteMapStart(newlen + mflen)
- if elemsep {
- for j = 0; j < len(fkvs); j++ {
- kv = fkvs[j]
- ee.WriteMapElemKey()
- // ee.EncodeStringEnc(cUTF8, kv.v)
- e.kStructFieldKey(fti.keyType, kv.v)
- ee.WriteMapElemValue()
- e.encodeValue(kv.r, nil, true)
+ var mflen int
+ for k, v := range mf {
+ if k == "" {
+ delete(mf, k)
+ continue
}
- } else {
- for j = 0; j < len(fkvs); j++ {
- kv = fkvs[j]
- // ee.EncodeStringEnc(cUTF8, kv.v)
- e.kStructFieldKey(fti.keyType, kv.v)
- e.encodeValue(kv.r, nil, true)
+ if f.ti.infoFieldOmitempty && isEmptyValue(reflect.ValueOf(v), e.h.TypeInfos, recur, recur) {
+ delete(mf, k)
+ continue
}
+ mflen++
+ }
+ // encode it all
+ e.mapStart(newlen + mflen)
+ for j = 0; j < newlen; j++ {
+ kv = fkvs[j]
+ e.mapElemKey()
+ e.kStructFieldKey(f.ti.keyType, kv.v.encNameAsciiAlphaNum, kv.v.encName)
+ e.mapElemValue()
+ e.encodeValue(kv.r, nil, true)
}
// now, add the others
for k, v := range mf {
- ee.WriteMapElemKey()
- e.kStructFieldKeyName(fti.keyType, k)
- ee.WriteMapElemValue()
+ e.mapElemKey()
+ e.kStructFieldKey(f.ti.keyType, false, k)
+ e.mapElemValue()
e.encode(v)
}
- ee.WriteMapEnd()
+ e.mapEnd()
} else {
- ee.WriteArrayStart(newlen)
- if elemsep {
- for j = 0; j < len(fkvs); j++ {
- ee.WriteArrayElem()
- e.encodeValue(fkvs[j].r, nil, true)
- }
- } else {
- for j = 0; j < len(fkvs); j++ {
- e.encodeValue(fkvs[j].r, nil, true)
+ newlen = len(f.ti.sfiSrc)
+ // kv.v = nil
+ for i, si := range f.ti.sfiSrc { // use unsorted array (to match sequence in struct)
+ // kv.r = si.field(rv, false)
+ kv.r = sfn.field(si)
+ // use the zero value.
+ // if a reference or struct, set to nil (so you do not output too much)
+ if si.omitEmpty() && isEmptyValue(kv.r, e.h.TypeInfos, recur, recur) {
+ switch kv.r.Kind() {
+ case reflect.Struct, reflect.Interface, reflect.Ptr, reflect.Array, reflect.Map, reflect.Slice:
+ kv.r = reflect.Value{} //encode as nil
+ }
}
+ fkvs[i] = kv
}
- ee.WriteArrayEnd()
+ // encode it all
+ e.arrayStart(newlen)
+ for j = 0; j < newlen; j++ {
+ e.arrayElem()
+ e.encodeValue(fkvs[j].r, nil, true)
+ }
+ e.arrayEnd()
}
// do not use defer. Instead, use explicit pool return at end of function.
// defer has a cost we are trying to avoid.
// If there is a panic and these slices are not returned, it is ok.
- if spool != nil {
- spool.Put(poolv)
- }
+ spool.end()
}
func (e *Encoder) kMap(f *codecFnInfo, rv reflect.Value) {
- ee := e.e
if rv.IsNil() {
- ee.EncodeNil()
+ e.e.EncodeNil()
return
}
l := rv.Len()
- ee.WriteMapStart(l)
+ e.mapStart(l)
if l == 0 {
- ee.WriteMapEnd()
+ e.mapEnd()
return
}
// var asSymbols bool
@@ -869,12 +845,8 @@ func (e *Encoder) kMap(f *codecFnInfo, rv reflect.Value) {
// encoding type, because preEncodeValue may break it down to
// a concrete type and kInterface will bomb.
var keyFn, valFn *codecFn
- ti := f.ti
- rtkey0 := ti.key
- rtkey := rtkey0
- rtval0 := ti.elem
- rtval := rtval0
- // rtkeyid := rt2id(rtkey0)
+ rtval := f.ti.elem
+ // rtkeyid := rt2id(f.ti.key)
for rtval.Kind() == reflect.Ptr {
rtval = rtval.Elem()
}
@@ -884,12 +856,13 @@ func (e *Encoder) kMap(f *codecFnInfo, rv reflect.Value) {
mks := rv.MapKeys()
if e.h.Canonical {
- e.kMapCanonical(rtkey, rv, mks, valFn)
- ee.WriteMapEnd()
+ e.kMapCanonical(f.ti.key, rv, mks, valFn)
+ e.mapEnd()
return
}
- var keyTypeIsString = stringTypId == rt2id(rtkey0) // rtkeyid
+ rtkey := f.ti.key
+ var keyTypeIsString = stringTypId == rt2id(rtkey) // rtkeyid
if !keyTypeIsString {
for rtkey.Kind() == reflect.Ptr {
rtkey = rtkey.Elem()
@@ -902,26 +875,23 @@ func (e *Encoder) kMap(f *codecFnInfo, rv reflect.Value) {
// for j, lmks := 0, len(mks); j < lmks; j++ {
for j := range mks {
- if e.esep {
- ee.WriteMapElemKey()
- }
+ e.mapElemKey()
if keyTypeIsString {
- ee.EncodeStringEnc(cUTF8, mks[j].String())
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(mks[j].String()))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, mks[j].String())
+ }
} else {
e.encodeValue(mks[j], keyFn, true)
}
- if e.esep {
- ee.WriteMapElemValue()
- }
+ e.mapElemValue()
e.encodeValue(rv.MapIndex(mks[j]), valFn, true)
-
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
func (e *Encoder) kMapCanonical(rtkey reflect.Type, rv reflect.Value, mks []reflect.Value, valFn *codecFn) {
- ee := e.e
- elemsep := e.esep
// we previously did out-of-band if an extension was registered.
// This is not necessary, as the natural kind is sufficient for ordering.
@@ -935,13 +905,9 @@ func (e *Encoder) kMapCanonical(rtkey reflect.Type, rv reflect.Value, mks []refl
}
sort.Sort(boolRvSlice(mksv))
for i := range mksv {
- if elemsep {
- ee.WriteMapElemKey()
- }
- ee.EncodeBool(mksv[i].v)
- if elemsep {
- ee.WriteMapElemValue()
- }
+ e.mapElemKey()
+ e.e.EncodeBool(mksv[i].v)
+ e.mapElemValue()
e.encodeValue(rv.MapIndex(mksv[i].r), valFn, true)
}
case reflect.String:
@@ -953,85 +919,69 @@ func (e *Encoder) kMapCanonical(rtkey reflect.Type, rv reflect.Value, mks []refl
}
sort.Sort(stringRvSlice(mksv))
for i := range mksv {
- if elemsep {
- ee.WriteMapElemKey()
- }
- ee.EncodeStringEnc(cUTF8, mksv[i].v)
- if elemsep {
- ee.WriteMapElemValue()
+ e.mapElemKey()
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(mksv[i].v))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, mksv[i].v)
}
+ e.mapElemValue()
e.encodeValue(rv.MapIndex(mksv[i].r), valFn, true)
}
case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint, reflect.Uintptr:
- mksv := make([]uintRv, len(mks))
+ mksv := make([]uint64Rv, len(mks))
for i, k := range mks {
v := &mksv[i]
v.r = k
v.v = k.Uint()
}
- sort.Sort(uintRvSlice(mksv))
+ sort.Sort(uint64RvSlice(mksv))
for i := range mksv {
- if elemsep {
- ee.WriteMapElemKey()
- }
- ee.EncodeUint(mksv[i].v)
- if elemsep {
- ee.WriteMapElemValue()
- }
+ e.mapElemKey()
+ e.e.EncodeUint(mksv[i].v)
+ e.mapElemValue()
e.encodeValue(rv.MapIndex(mksv[i].r), valFn, true)
}
case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:
- mksv := make([]intRv, len(mks))
+ mksv := make([]int64Rv, len(mks))
for i, k := range mks {
v := &mksv[i]
v.r = k
v.v = k.Int()
}
- sort.Sort(intRvSlice(mksv))
+ sort.Sort(int64RvSlice(mksv))
for i := range mksv {
- if elemsep {
- ee.WriteMapElemKey()
- }
- ee.EncodeInt(mksv[i].v)
- if elemsep {
- ee.WriteMapElemValue()
- }
+ e.mapElemKey()
+ e.e.EncodeInt(mksv[i].v)
+ e.mapElemValue()
e.encodeValue(rv.MapIndex(mksv[i].r), valFn, true)
}
case reflect.Float32:
- mksv := make([]floatRv, len(mks))
+ mksv := make([]float64Rv, len(mks))
for i, k := range mks {
v := &mksv[i]
v.r = k
v.v = k.Float()
}
- sort.Sort(floatRvSlice(mksv))
+ sort.Sort(float64RvSlice(mksv))
for i := range mksv {
- if elemsep {
- ee.WriteMapElemKey()
- }
- ee.EncodeFloat32(float32(mksv[i].v))
- if elemsep {
- ee.WriteMapElemValue()
- }
+ e.mapElemKey()
+ e.e.EncodeFloat32(float32(mksv[i].v))
+ e.mapElemValue()
e.encodeValue(rv.MapIndex(mksv[i].r), valFn, true)
}
case reflect.Float64:
- mksv := make([]floatRv, len(mks))
+ mksv := make([]float64Rv, len(mks))
for i, k := range mks {
v := &mksv[i]
v.r = k
v.v = k.Float()
}
- sort.Sort(floatRvSlice(mksv))
+ sort.Sort(float64RvSlice(mksv))
for i := range mksv {
- if elemsep {
- ee.WriteMapElemKey()
- }
- ee.EncodeFloat64(mksv[i].v)
- if elemsep {
- ee.WriteMapElemValue()
- }
+ e.mapElemKey()
+ e.e.EncodeFloat64(mksv[i].v)
+ e.mapElemValue()
e.encodeValue(rv.MapIndex(mksv[i].r), valFn, true)
}
case reflect.Struct:
@@ -1044,13 +994,9 @@ func (e *Encoder) kMapCanonical(rtkey reflect.Type, rv reflect.Value, mks []refl
}
sort.Sort(timeRvSlice(mksv))
for i := range mksv {
- if elemsep {
- ee.WriteMapElemKey()
- }
- ee.EncodeTime(mksv[i].v)
- if elemsep {
- ee.WriteMapElemValue()
- }
+ e.mapElemKey()
+ e.e.EncodeTime(mksv[i].v)
+ e.mapElemValue()
e.encodeValue(rv.MapIndex(mksv[i].r), valFn, true)
}
break
@@ -1071,13 +1017,9 @@ func (e *Encoder) kMapCanonical(rtkey reflect.Type, rv reflect.Value, mks []refl
}
sort.Sort(bytesRvSlice(mksbv))
for j := range mksbv {
- if elemsep {
- ee.WriteMapElemKey()
- }
+ e.mapElemKey()
e.asis(mksbv[j].v)
- if elemsep {
- ee.WriteMapElemValue()
- }
+ e.mapElemValue()
e.encodeValue(rv.MapIndex(mksbv[j].r), valFn, true)
}
}
@@ -1086,18 +1028,20 @@ func (e *Encoder) kMapCanonical(rtkey reflect.Type, rv reflect.Value, mks []refl
// // --------------------------------------------------
type encWriterSwitch struct {
+ esep bool // whether it has elem separators
+ bytes bool // encoding to []byte
+ isas bool // whether e.as != nil
+ js bool // is json encoder?
+ be bool // is binary encoder?
+
+ c containerState
+ // _ [3]byte // padding
+ // _ [2]uint64 // padding
+ // _ uint64 // padding
// wi *ioEncWriter
wb bytesEncAppender
wf *bufioEncWriter
// typ entryType
- bytes bool // encoding to []byte
- esep bool // whether it has elem separators
- isas bool // whether e.as != nil
- js bool // is json encoder?
- be bool // is binary encoder?
- _ [2]byte // padding
- // _ [2]uint64 // padding
- // _ uint64 // padding
}
func (z *encWriterSwitch) writeb(s []byte) {
@@ -1107,6 +1051,13 @@ func (z *encWriterSwitch) writeb(s []byte) {
z.wf.writeb(s)
}
}
+func (z *encWriterSwitch) writeqstr(s string) {
+ if z.bytes {
+ z.wb.writeqstr(s)
+ } else {
+ z.wf.writeqstr(s)
+ }
+}
func (z *encWriterSwitch) writestr(s string) {
if z.bytes {
z.wb.writestr(s)
@@ -1128,11 +1079,16 @@ func (z *encWriterSwitch) writen2(b1, b2 byte) {
z.wf.writen2(b1, b2)
}
}
-func (z *encWriterSwitch) end() {
+func (z *encWriterSwitch) endErr() error {
if z.bytes {
- z.wb.end()
- } else {
- z.wf.end()
+ return z.wb.endErr()
+ }
+ return z.wf.endErr()
+}
+
+func (z *encWriterSwitch) end() {
+ if err := z.endErr(); err != nil {
+ panic(err)
}
}
@@ -1244,28 +1200,26 @@ type Encoder struct {
// NOTE: Encoder shouldn't call it's write methods,
// as the handler MAY need to do some coordination.
- w *encWriterSwitch
+ // w *encWriterSwitch
// bw *bufio.Writer
as encDriverAsis
- err error
+ jenc *jsonEncDriver
+ h *BasicHandle
+ hh Handle
- h *BasicHandle
- hh Handle
- // ---- cpu cache line boundary? + 3
+ // ---- cpu cache line boundary
encWriterSwitch
- ci set
-
- // Extensions can call Encode() within a current Encode() call.
- // We need to know when the top level Encode() call returns,
- // so we can decide whether to Release() or not.
- calls uint16 // what depth in mustEncode are we in now.
-
- b [(5 * 8) - 2]byte // for encoding chan or (non-addressable) [N]byte
+ err error
+ // ---- cpu cache line boundary
// ---- writable fields during execution --- *try* to keep in sep cache line
+ ci set // holds set of addresses found during an encoding (if CheckCircularRef=true)
+ cidef [1]uintptr // default ci
+
+ b [(4 * 8)]byte // for encoding chan byte, (non-addressable) [N]byte, etc
// ---- cpu cache line boundary?
// b [scratchByteArrayLen]byte
@@ -1301,13 +1255,17 @@ func newEncoder(h Handle) *Encoder {
runtime.SetFinalizer(e, (*Encoder).finalize)
// xdebugf(">>>> new(Encoder) with finalizer")
}
- e.w = &e.encWriterSwitch
+ // e.w = &e.encWriterSwitch
e.hh = h
e.esep = h.hasElemSeparators()
return e
}
+func (e *Encoder) w() *encWriterSwitch {
+ return &e.encWriterSwitch
+}
+
func (e *Encoder) resetCommon() {
// e.w = &e.encWriterSwitch
if e.e == nil || e.hh.recreateEncDriver(e.e) {
@@ -1315,11 +1273,22 @@ func (e *Encoder) resetCommon() {
e.as, e.isas = e.e.(encDriverAsis)
// e.cr, _ = e.e.(containerStateRecv)
}
+
+ if e.ci == nil {
+ e.ci = (set)(e.cidef[:0])
+ } else {
+ e.ci = e.ci[:0]
+ }
+
e.be = e.hh.isBinary()
+ e.jenc = nil
_, e.js = e.hh.(*JsonHandle)
+ if e.js {
+ e.jenc = e.e.(interface{ getJsonEncDriver() *jsonEncDriver }).getJsonEncDriver()
+ }
e.e.reset()
+ e.c = 0
e.err = nil
- e.calls = 0
}
// Reset resets the Encoder with a new output stream.
@@ -1471,10 +1440,19 @@ func (e *Encoder) Encode(v interface{}) (err error) {
}
if recoverPanicToErr {
defer func() {
- e.w.end()
- if x := recover(); x != nil {
+ // if error occurred during encoding, return that error;
+ // else if error occurred on end'ing (i.e. during flush), return that error.
+ err = e.w().endErr()
+ x := recover()
+ if x == nil {
+ if e.err != err {
+ e.err = err
+ }
+ } else {
panicValToErr(e, x, &e.err)
- err = e.err
+ if e.err != err {
+ err = e.err
+ }
}
}()
}
@@ -1494,18 +1472,33 @@ func (e *Encoder) MustEncode(v interface{}) {
}
func (e *Encoder) mustEncode(v interface{}) {
- e.calls++
+ if e.wf == nil {
+ e.encode(v)
+ e.e.atEndOfEncode()
+ e.w().end()
+ return
+ }
+
+ if e.wf.buf == nil {
+ e.wf.buf = e.wf.bytesBufPooler.get(e.wf.sz)
+ }
+ e.wf.calls++
+
e.encode(v)
- e.e.atEndOfEncode()
- e.w.end()
- e.calls--
- if !e.h.ExplicitRelease && e.calls == 0 {
- e.Release()
+
+ e.wf.calls--
+
+ if e.wf.calls == 0 {
+ e.e.atEndOfEncode()
+ e.w().end()
+ if !e.h.ExplicitRelease {
+ e.wf.release()
+ }
}
}
// func (e *Encoder) deferred(err1 *error) {
-// e.w.end()
+// e.w().end()
// if recoverPanicToErr {
// if x := recover(); x != nil {
// panicValToErr(e, x, err1)
@@ -1525,12 +1518,8 @@ func (e *Encoder) finalize() {
// It is important to call Release() when done with an Encoder, so those resources
// are released instantly for use by subsequently created Encoders.
func (e *Encoder) Release() {
- if useFinalizers && removeFinalizerOnRelease {
- runtime.SetFinalizer(e, nil)
- }
if e.wf != nil {
- e.wf.buf = nil
- e.wf.bytesBufPooler.end()
+ e.wf.release()
}
}
@@ -1552,7 +1541,11 @@ func (e *Encoder) encode(iv interface{}) {
e.encodeValue(v, nil, true)
case string:
- e.e.EncodeStringEnc(cUTF8, v)
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(v))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, v)
+ }
case bool:
e.e.EncodeBool(v)
case int:
@@ -1590,7 +1583,11 @@ func (e *Encoder) encode(iv interface{}) {
e.rawBytes(*v)
case *string:
- e.e.EncodeStringEnc(cUTF8, *v)
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(*v))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, *v)
+ }
case *bool:
e.e.EncodeBool(*v)
case *int:
@@ -1709,7 +1706,7 @@ TOP:
// } else if asis {
// e.asis(bs)
// } else {
-// e.e.EncodeStringBytes(c, bs)
+// e.e.EncodeStringBytesRaw(bs)
// }
// }
@@ -1750,7 +1747,7 @@ func (e *Encoder) asis(v []byte) {
if e.isas {
e.as.EncodeAsis(v)
} else {
- e.w.writeb(v)
+ e.w().writeb(v)
}
}
@@ -1765,3 +1762,91 @@ func (e *Encoder) rawBytes(vv Raw) {
func (e *Encoder) wrapErr(v interface{}, err *error) {
*err = encodeError{codecError{name: e.hh.Name(), err: v}}
}
+
+// ---- container tracker methods
+// Note: We update the .c after calling the callback.
+// This way, the callback can know what the last status was.
+
+func (e *Encoder) mapStart(length int) {
+ e.e.WriteMapStart(length)
+ e.c = containerMapStart
+}
+
+func (e *Encoder) mapElemKey() {
+ if e.js {
+ e.jenc.WriteMapElemKey()
+ }
+ e.c = containerMapKey
+}
+
+func (e *Encoder) mapElemValue() {
+ if e.js {
+ e.jenc.WriteMapElemValue()
+ }
+ e.c = containerMapValue
+}
+
+func (e *Encoder) mapEnd() {
+ e.e.WriteMapEnd()
+ e.c = containerMapEnd
+ e.c = 0
+}
+
+func (e *Encoder) arrayStart(length int) {
+ e.e.WriteArrayStart(length)
+ e.c = containerArrayStart
+}
+
+func (e *Encoder) arrayElem() {
+ if e.js {
+ e.jenc.WriteArrayElem()
+ }
+ e.c = containerArrayElem
+}
+
+func (e *Encoder) arrayEnd() {
+ e.e.WriteArrayEnd()
+ e.c = 0
+ e.c = containerArrayEnd
+}
+
+func encStructFieldKey(encName string, ee encDriver, w *encWriterSwitch,
+ keyType valueType, encNameAsciiAlphaNum bool, js bool) {
+ var m must
+ // use if-else-if, not switch (which compiles to binary-search)
+ // since keyType is typically valueTypeString, branch prediction is pretty good.
+ if keyType == valueTypeString {
+ if js && encNameAsciiAlphaNum { // keyType == valueTypeString
+ w.writeqstr(encName)
+ // ----
+ // w.writen1('"')
+ // w.writestr(encName)
+ // w.writen1('"')
+ // ----
+ // w.writestr(`"` + encName + `"`)
+ // ----
+ // // do concat myself, so it is faster than the generic string concat
+ // b := make([]byte, len(encName)+2)
+ // copy(b[1:], encName)
+ // b[0] = '"'
+ // b[len(b)-1] = '"'
+ // w.writeb(b)
+ } else { // keyType == valueTypeString
+ ee.EncodeStringEnc(cUTF8, encName)
+ }
+ } else if keyType == valueTypeInt {
+ ee.EncodeInt(m.Int(strconv.ParseInt(encName, 10, 64)))
+ } else if keyType == valueTypeUint {
+ ee.EncodeUint(m.Uint(strconv.ParseUint(encName, 10, 64)))
+ } else if keyType == valueTypeFloat {
+ ee.EncodeFloat64(m.Float(strconv.ParseFloat(encName, 64)))
+ }
+}
+
+// func encStringAsRawBytesMaybe(ee encDriver, s string, stringToRaw bool) {
+// if stringToRaw {
+// ee.EncodeStringBytesRaw(bytesView(s))
+// } else {
+// ee.EncodeStringEnc(cUTF8, s)
+// }
+// }
diff --git a/vendor/github.com/ugorji/go/codec/fast-path.generated.go b/vendor/github.com/ugorji/go/codec/fast-path.generated.go
index 45137afa..cb630d78 100644
--- a/vendor/github.com/ugorji/go/codec/fast-path.generated.go
+++ b/vendor/github.com/ugorji/go/codec/fast-path.generated.go
@@ -10,7 +10,7 @@ package codec
// Fast path functions try to create a fast path encode or decode implementation
// for common maps and slices.
//
-// We define the functions and register then in this single file
+// We define the functions and register them in this single file
// so as not to pollute the encode.go and decode.go, and create a dependency in there.
// This file can be omitted without causing a build failure.
//
@@ -18,9 +18,10 @@ package codec
// - Many calls bypass reflection altogether
//
// Currently support
-// - slice of all builtin types,
-// - map of all builtin types to string or interface value
-// - symmetrical maps of all builtin types (e.g. str-str, uint8-uint8)
+// - slice of all builtin types (numeric, bool, string, []byte)
+// - maps of builtin types to builtin or interface{} type, EXCEPT FOR
+// keys of type uintptr, int8/16/32, uint16/32, float32/64, bool, interface{}
+// AND values of type type int8/16/32, uint16/32
// This should provide adequate "typical" implementations.
//
// Note that fast track decode functions must handle values for which an address cannot be obtained.
@@ -50,7 +51,7 @@ type fastpathE struct {
decfn func(*Decoder, *codecFnInfo, reflect.Value)
}
-type fastpathA [271]fastpathE
+type fastpathA [88]fastpathE
func (x *fastpathA) index(rtid uintptr) int {
// use binary search to grab the index (adapted from sort/search.go)
@@ -96,6 +97,7 @@ func init() {
fn([]interface{}(nil), (*Encoder).fastpathEncSliceIntfR, (*Decoder).fastpathDecSliceIntfR)
fn([]string(nil), (*Encoder).fastpathEncSliceStringR, (*Decoder).fastpathDecSliceStringR)
+ fn([][]byte(nil), (*Encoder).fastpathEncSliceBytesR, (*Decoder).fastpathDecSliceBytesR)
fn([]float32(nil), (*Encoder).fastpathEncSliceFloat32R, (*Decoder).fastpathDecSliceFloat32R)
fn([]float64(nil), (*Encoder).fastpathEncSliceFloat64R, (*Decoder).fastpathDecSliceFloat64R)
fn([]uint(nil), (*Encoder).fastpathEncSliceUintR, (*Decoder).fastpathDecSliceUintR)
@@ -110,262 +112,78 @@ func init() {
fn([]int64(nil), (*Encoder).fastpathEncSliceInt64R, (*Decoder).fastpathDecSliceInt64R)
fn([]bool(nil), (*Encoder).fastpathEncSliceBoolR, (*Decoder).fastpathDecSliceBoolR)
- fn(map[interface{}]interface{}(nil), (*Encoder).fastpathEncMapIntfIntfR, (*Decoder).fastpathDecMapIntfIntfR)
- fn(map[interface{}]string(nil), (*Encoder).fastpathEncMapIntfStringR, (*Decoder).fastpathDecMapIntfStringR)
- fn(map[interface{}]uint(nil), (*Encoder).fastpathEncMapIntfUintR, (*Decoder).fastpathDecMapIntfUintR)
- fn(map[interface{}]uint8(nil), (*Encoder).fastpathEncMapIntfUint8R, (*Decoder).fastpathDecMapIntfUint8R)
- fn(map[interface{}]uint16(nil), (*Encoder).fastpathEncMapIntfUint16R, (*Decoder).fastpathDecMapIntfUint16R)
- fn(map[interface{}]uint32(nil), (*Encoder).fastpathEncMapIntfUint32R, (*Decoder).fastpathDecMapIntfUint32R)
- fn(map[interface{}]uint64(nil), (*Encoder).fastpathEncMapIntfUint64R, (*Decoder).fastpathDecMapIntfUint64R)
- fn(map[interface{}]uintptr(nil), (*Encoder).fastpathEncMapIntfUintptrR, (*Decoder).fastpathDecMapIntfUintptrR)
- fn(map[interface{}]int(nil), (*Encoder).fastpathEncMapIntfIntR, (*Decoder).fastpathDecMapIntfIntR)
- fn(map[interface{}]int8(nil), (*Encoder).fastpathEncMapIntfInt8R, (*Decoder).fastpathDecMapIntfInt8R)
- fn(map[interface{}]int16(nil), (*Encoder).fastpathEncMapIntfInt16R, (*Decoder).fastpathDecMapIntfInt16R)
- fn(map[interface{}]int32(nil), (*Encoder).fastpathEncMapIntfInt32R, (*Decoder).fastpathDecMapIntfInt32R)
- fn(map[interface{}]int64(nil), (*Encoder).fastpathEncMapIntfInt64R, (*Decoder).fastpathDecMapIntfInt64R)
- fn(map[interface{}]float32(nil), (*Encoder).fastpathEncMapIntfFloat32R, (*Decoder).fastpathDecMapIntfFloat32R)
- fn(map[interface{}]float64(nil), (*Encoder).fastpathEncMapIntfFloat64R, (*Decoder).fastpathDecMapIntfFloat64R)
- fn(map[interface{}]bool(nil), (*Encoder).fastpathEncMapIntfBoolR, (*Decoder).fastpathDecMapIntfBoolR)
fn(map[string]interface{}(nil), (*Encoder).fastpathEncMapStringIntfR, (*Decoder).fastpathDecMapStringIntfR)
fn(map[string]string(nil), (*Encoder).fastpathEncMapStringStringR, (*Decoder).fastpathDecMapStringStringR)
+ fn(map[string][]byte(nil), (*Encoder).fastpathEncMapStringBytesR, (*Decoder).fastpathDecMapStringBytesR)
fn(map[string]uint(nil), (*Encoder).fastpathEncMapStringUintR, (*Decoder).fastpathDecMapStringUintR)
fn(map[string]uint8(nil), (*Encoder).fastpathEncMapStringUint8R, (*Decoder).fastpathDecMapStringUint8R)
- fn(map[string]uint16(nil), (*Encoder).fastpathEncMapStringUint16R, (*Decoder).fastpathDecMapStringUint16R)
- fn(map[string]uint32(nil), (*Encoder).fastpathEncMapStringUint32R, (*Decoder).fastpathDecMapStringUint32R)
fn(map[string]uint64(nil), (*Encoder).fastpathEncMapStringUint64R, (*Decoder).fastpathDecMapStringUint64R)
fn(map[string]uintptr(nil), (*Encoder).fastpathEncMapStringUintptrR, (*Decoder).fastpathDecMapStringUintptrR)
fn(map[string]int(nil), (*Encoder).fastpathEncMapStringIntR, (*Decoder).fastpathDecMapStringIntR)
- fn(map[string]int8(nil), (*Encoder).fastpathEncMapStringInt8R, (*Decoder).fastpathDecMapStringInt8R)
- fn(map[string]int16(nil), (*Encoder).fastpathEncMapStringInt16R, (*Decoder).fastpathDecMapStringInt16R)
- fn(map[string]int32(nil), (*Encoder).fastpathEncMapStringInt32R, (*Decoder).fastpathDecMapStringInt32R)
fn(map[string]int64(nil), (*Encoder).fastpathEncMapStringInt64R, (*Decoder).fastpathDecMapStringInt64R)
fn(map[string]float32(nil), (*Encoder).fastpathEncMapStringFloat32R, (*Decoder).fastpathDecMapStringFloat32R)
fn(map[string]float64(nil), (*Encoder).fastpathEncMapStringFloat64R, (*Decoder).fastpathDecMapStringFloat64R)
fn(map[string]bool(nil), (*Encoder).fastpathEncMapStringBoolR, (*Decoder).fastpathDecMapStringBoolR)
- fn(map[float32]interface{}(nil), (*Encoder).fastpathEncMapFloat32IntfR, (*Decoder).fastpathDecMapFloat32IntfR)
- fn(map[float32]string(nil), (*Encoder).fastpathEncMapFloat32StringR, (*Decoder).fastpathDecMapFloat32StringR)
- fn(map[float32]uint(nil), (*Encoder).fastpathEncMapFloat32UintR, (*Decoder).fastpathDecMapFloat32UintR)
- fn(map[float32]uint8(nil), (*Encoder).fastpathEncMapFloat32Uint8R, (*Decoder).fastpathDecMapFloat32Uint8R)
- fn(map[float32]uint16(nil), (*Encoder).fastpathEncMapFloat32Uint16R, (*Decoder).fastpathDecMapFloat32Uint16R)
- fn(map[float32]uint32(nil), (*Encoder).fastpathEncMapFloat32Uint32R, (*Decoder).fastpathDecMapFloat32Uint32R)
- fn(map[float32]uint64(nil), (*Encoder).fastpathEncMapFloat32Uint64R, (*Decoder).fastpathDecMapFloat32Uint64R)
- fn(map[float32]uintptr(nil), (*Encoder).fastpathEncMapFloat32UintptrR, (*Decoder).fastpathDecMapFloat32UintptrR)
- fn(map[float32]int(nil), (*Encoder).fastpathEncMapFloat32IntR, (*Decoder).fastpathDecMapFloat32IntR)
- fn(map[float32]int8(nil), (*Encoder).fastpathEncMapFloat32Int8R, (*Decoder).fastpathDecMapFloat32Int8R)
- fn(map[float32]int16(nil), (*Encoder).fastpathEncMapFloat32Int16R, (*Decoder).fastpathDecMapFloat32Int16R)
- fn(map[float32]int32(nil), (*Encoder).fastpathEncMapFloat32Int32R, (*Decoder).fastpathDecMapFloat32Int32R)
- fn(map[float32]int64(nil), (*Encoder).fastpathEncMapFloat32Int64R, (*Decoder).fastpathDecMapFloat32Int64R)
- fn(map[float32]float32(nil), (*Encoder).fastpathEncMapFloat32Float32R, (*Decoder).fastpathDecMapFloat32Float32R)
- fn(map[float32]float64(nil), (*Encoder).fastpathEncMapFloat32Float64R, (*Decoder).fastpathDecMapFloat32Float64R)
- fn(map[float32]bool(nil), (*Encoder).fastpathEncMapFloat32BoolR, (*Decoder).fastpathDecMapFloat32BoolR)
- fn(map[float64]interface{}(nil), (*Encoder).fastpathEncMapFloat64IntfR, (*Decoder).fastpathDecMapFloat64IntfR)
- fn(map[float64]string(nil), (*Encoder).fastpathEncMapFloat64StringR, (*Decoder).fastpathDecMapFloat64StringR)
- fn(map[float64]uint(nil), (*Encoder).fastpathEncMapFloat64UintR, (*Decoder).fastpathDecMapFloat64UintR)
- fn(map[float64]uint8(nil), (*Encoder).fastpathEncMapFloat64Uint8R, (*Decoder).fastpathDecMapFloat64Uint8R)
- fn(map[float64]uint16(nil), (*Encoder).fastpathEncMapFloat64Uint16R, (*Decoder).fastpathDecMapFloat64Uint16R)
- fn(map[float64]uint32(nil), (*Encoder).fastpathEncMapFloat64Uint32R, (*Decoder).fastpathDecMapFloat64Uint32R)
- fn(map[float64]uint64(nil), (*Encoder).fastpathEncMapFloat64Uint64R, (*Decoder).fastpathDecMapFloat64Uint64R)
- fn(map[float64]uintptr(nil), (*Encoder).fastpathEncMapFloat64UintptrR, (*Decoder).fastpathDecMapFloat64UintptrR)
- fn(map[float64]int(nil), (*Encoder).fastpathEncMapFloat64IntR, (*Decoder).fastpathDecMapFloat64IntR)
- fn(map[float64]int8(nil), (*Encoder).fastpathEncMapFloat64Int8R, (*Decoder).fastpathDecMapFloat64Int8R)
- fn(map[float64]int16(nil), (*Encoder).fastpathEncMapFloat64Int16R, (*Decoder).fastpathDecMapFloat64Int16R)
- fn(map[float64]int32(nil), (*Encoder).fastpathEncMapFloat64Int32R, (*Decoder).fastpathDecMapFloat64Int32R)
- fn(map[float64]int64(nil), (*Encoder).fastpathEncMapFloat64Int64R, (*Decoder).fastpathDecMapFloat64Int64R)
- fn(map[float64]float32(nil), (*Encoder).fastpathEncMapFloat64Float32R, (*Decoder).fastpathDecMapFloat64Float32R)
- fn(map[float64]float64(nil), (*Encoder).fastpathEncMapFloat64Float64R, (*Decoder).fastpathDecMapFloat64Float64R)
- fn(map[float64]bool(nil), (*Encoder).fastpathEncMapFloat64BoolR, (*Decoder).fastpathDecMapFloat64BoolR)
fn(map[uint]interface{}(nil), (*Encoder).fastpathEncMapUintIntfR, (*Decoder).fastpathDecMapUintIntfR)
fn(map[uint]string(nil), (*Encoder).fastpathEncMapUintStringR, (*Decoder).fastpathDecMapUintStringR)
+ fn(map[uint][]byte(nil), (*Encoder).fastpathEncMapUintBytesR, (*Decoder).fastpathDecMapUintBytesR)
fn(map[uint]uint(nil), (*Encoder).fastpathEncMapUintUintR, (*Decoder).fastpathDecMapUintUintR)
fn(map[uint]uint8(nil), (*Encoder).fastpathEncMapUintUint8R, (*Decoder).fastpathDecMapUintUint8R)
- fn(map[uint]uint16(nil), (*Encoder).fastpathEncMapUintUint16R, (*Decoder).fastpathDecMapUintUint16R)
- fn(map[uint]uint32(nil), (*Encoder).fastpathEncMapUintUint32R, (*Decoder).fastpathDecMapUintUint32R)
fn(map[uint]uint64(nil), (*Encoder).fastpathEncMapUintUint64R, (*Decoder).fastpathDecMapUintUint64R)
fn(map[uint]uintptr(nil), (*Encoder).fastpathEncMapUintUintptrR, (*Decoder).fastpathDecMapUintUintptrR)
fn(map[uint]int(nil), (*Encoder).fastpathEncMapUintIntR, (*Decoder).fastpathDecMapUintIntR)
- fn(map[uint]int8(nil), (*Encoder).fastpathEncMapUintInt8R, (*Decoder).fastpathDecMapUintInt8R)
- fn(map[uint]int16(nil), (*Encoder).fastpathEncMapUintInt16R, (*Decoder).fastpathDecMapUintInt16R)
- fn(map[uint]int32(nil), (*Encoder).fastpathEncMapUintInt32R, (*Decoder).fastpathDecMapUintInt32R)
fn(map[uint]int64(nil), (*Encoder).fastpathEncMapUintInt64R, (*Decoder).fastpathDecMapUintInt64R)
fn(map[uint]float32(nil), (*Encoder).fastpathEncMapUintFloat32R, (*Decoder).fastpathDecMapUintFloat32R)
fn(map[uint]float64(nil), (*Encoder).fastpathEncMapUintFloat64R, (*Decoder).fastpathDecMapUintFloat64R)
fn(map[uint]bool(nil), (*Encoder).fastpathEncMapUintBoolR, (*Decoder).fastpathDecMapUintBoolR)
fn(map[uint8]interface{}(nil), (*Encoder).fastpathEncMapUint8IntfR, (*Decoder).fastpathDecMapUint8IntfR)
fn(map[uint8]string(nil), (*Encoder).fastpathEncMapUint8StringR, (*Decoder).fastpathDecMapUint8StringR)
+ fn(map[uint8][]byte(nil), (*Encoder).fastpathEncMapUint8BytesR, (*Decoder).fastpathDecMapUint8BytesR)
fn(map[uint8]uint(nil), (*Encoder).fastpathEncMapUint8UintR, (*Decoder).fastpathDecMapUint8UintR)
fn(map[uint8]uint8(nil), (*Encoder).fastpathEncMapUint8Uint8R, (*Decoder).fastpathDecMapUint8Uint8R)
- fn(map[uint8]uint16(nil), (*Encoder).fastpathEncMapUint8Uint16R, (*Decoder).fastpathDecMapUint8Uint16R)
- fn(map[uint8]uint32(nil), (*Encoder).fastpathEncMapUint8Uint32R, (*Decoder).fastpathDecMapUint8Uint32R)
fn(map[uint8]uint64(nil), (*Encoder).fastpathEncMapUint8Uint64R, (*Decoder).fastpathDecMapUint8Uint64R)
fn(map[uint8]uintptr(nil), (*Encoder).fastpathEncMapUint8UintptrR, (*Decoder).fastpathDecMapUint8UintptrR)
fn(map[uint8]int(nil), (*Encoder).fastpathEncMapUint8IntR, (*Decoder).fastpathDecMapUint8IntR)
- fn(map[uint8]int8(nil), (*Encoder).fastpathEncMapUint8Int8R, (*Decoder).fastpathDecMapUint8Int8R)
- fn(map[uint8]int16(nil), (*Encoder).fastpathEncMapUint8Int16R, (*Decoder).fastpathDecMapUint8Int16R)
- fn(map[uint8]int32(nil), (*Encoder).fastpathEncMapUint8Int32R, (*Decoder).fastpathDecMapUint8Int32R)
fn(map[uint8]int64(nil), (*Encoder).fastpathEncMapUint8Int64R, (*Decoder).fastpathDecMapUint8Int64R)
fn(map[uint8]float32(nil), (*Encoder).fastpathEncMapUint8Float32R, (*Decoder).fastpathDecMapUint8Float32R)
fn(map[uint8]float64(nil), (*Encoder).fastpathEncMapUint8Float64R, (*Decoder).fastpathDecMapUint8Float64R)
fn(map[uint8]bool(nil), (*Encoder).fastpathEncMapUint8BoolR, (*Decoder).fastpathDecMapUint8BoolR)
- fn(map[uint16]interface{}(nil), (*Encoder).fastpathEncMapUint16IntfR, (*Decoder).fastpathDecMapUint16IntfR)
- fn(map[uint16]string(nil), (*Encoder).fastpathEncMapUint16StringR, (*Decoder).fastpathDecMapUint16StringR)
- fn(map[uint16]uint(nil), (*Encoder).fastpathEncMapUint16UintR, (*Decoder).fastpathDecMapUint16UintR)
- fn(map[uint16]uint8(nil), (*Encoder).fastpathEncMapUint16Uint8R, (*Decoder).fastpathDecMapUint16Uint8R)
- fn(map[uint16]uint16(nil), (*Encoder).fastpathEncMapUint16Uint16R, (*Decoder).fastpathDecMapUint16Uint16R)
- fn(map[uint16]uint32(nil), (*Encoder).fastpathEncMapUint16Uint32R, (*Decoder).fastpathDecMapUint16Uint32R)
- fn(map[uint16]uint64(nil), (*Encoder).fastpathEncMapUint16Uint64R, (*Decoder).fastpathDecMapUint16Uint64R)
- fn(map[uint16]uintptr(nil), (*Encoder).fastpathEncMapUint16UintptrR, (*Decoder).fastpathDecMapUint16UintptrR)
- fn(map[uint16]int(nil), (*Encoder).fastpathEncMapUint16IntR, (*Decoder).fastpathDecMapUint16IntR)
- fn(map[uint16]int8(nil), (*Encoder).fastpathEncMapUint16Int8R, (*Decoder).fastpathDecMapUint16Int8R)
- fn(map[uint16]int16(nil), (*Encoder).fastpathEncMapUint16Int16R, (*Decoder).fastpathDecMapUint16Int16R)
- fn(map[uint16]int32(nil), (*Encoder).fastpathEncMapUint16Int32R, (*Decoder).fastpathDecMapUint16Int32R)
- fn(map[uint16]int64(nil), (*Encoder).fastpathEncMapUint16Int64R, (*Decoder).fastpathDecMapUint16Int64R)
- fn(map[uint16]float32(nil), (*Encoder).fastpathEncMapUint16Float32R, (*Decoder).fastpathDecMapUint16Float32R)
- fn(map[uint16]float64(nil), (*Encoder).fastpathEncMapUint16Float64R, (*Decoder).fastpathDecMapUint16Float64R)
- fn(map[uint16]bool(nil), (*Encoder).fastpathEncMapUint16BoolR, (*Decoder).fastpathDecMapUint16BoolR)
- fn(map[uint32]interface{}(nil), (*Encoder).fastpathEncMapUint32IntfR, (*Decoder).fastpathDecMapUint32IntfR)
- fn(map[uint32]string(nil), (*Encoder).fastpathEncMapUint32StringR, (*Decoder).fastpathDecMapUint32StringR)
- fn(map[uint32]uint(nil), (*Encoder).fastpathEncMapUint32UintR, (*Decoder).fastpathDecMapUint32UintR)
- fn(map[uint32]uint8(nil), (*Encoder).fastpathEncMapUint32Uint8R, (*Decoder).fastpathDecMapUint32Uint8R)
- fn(map[uint32]uint16(nil), (*Encoder).fastpathEncMapUint32Uint16R, (*Decoder).fastpathDecMapUint32Uint16R)
- fn(map[uint32]uint32(nil), (*Encoder).fastpathEncMapUint32Uint32R, (*Decoder).fastpathDecMapUint32Uint32R)
- fn(map[uint32]uint64(nil), (*Encoder).fastpathEncMapUint32Uint64R, (*Decoder).fastpathDecMapUint32Uint64R)
- fn(map[uint32]uintptr(nil), (*Encoder).fastpathEncMapUint32UintptrR, (*Decoder).fastpathDecMapUint32UintptrR)
- fn(map[uint32]int(nil), (*Encoder).fastpathEncMapUint32IntR, (*Decoder).fastpathDecMapUint32IntR)
- fn(map[uint32]int8(nil), (*Encoder).fastpathEncMapUint32Int8R, (*Decoder).fastpathDecMapUint32Int8R)
- fn(map[uint32]int16(nil), (*Encoder).fastpathEncMapUint32Int16R, (*Decoder).fastpathDecMapUint32Int16R)
- fn(map[uint32]int32(nil), (*Encoder).fastpathEncMapUint32Int32R, (*Decoder).fastpathDecMapUint32Int32R)
- fn(map[uint32]int64(nil), (*Encoder).fastpathEncMapUint32Int64R, (*Decoder).fastpathDecMapUint32Int64R)
- fn(map[uint32]float32(nil), (*Encoder).fastpathEncMapUint32Float32R, (*Decoder).fastpathDecMapUint32Float32R)
- fn(map[uint32]float64(nil), (*Encoder).fastpathEncMapUint32Float64R, (*Decoder).fastpathDecMapUint32Float64R)
- fn(map[uint32]bool(nil), (*Encoder).fastpathEncMapUint32BoolR, (*Decoder).fastpathDecMapUint32BoolR)
fn(map[uint64]interface{}(nil), (*Encoder).fastpathEncMapUint64IntfR, (*Decoder).fastpathDecMapUint64IntfR)
fn(map[uint64]string(nil), (*Encoder).fastpathEncMapUint64StringR, (*Decoder).fastpathDecMapUint64StringR)
+ fn(map[uint64][]byte(nil), (*Encoder).fastpathEncMapUint64BytesR, (*Decoder).fastpathDecMapUint64BytesR)
fn(map[uint64]uint(nil), (*Encoder).fastpathEncMapUint64UintR, (*Decoder).fastpathDecMapUint64UintR)
fn(map[uint64]uint8(nil), (*Encoder).fastpathEncMapUint64Uint8R, (*Decoder).fastpathDecMapUint64Uint8R)
- fn(map[uint64]uint16(nil), (*Encoder).fastpathEncMapUint64Uint16R, (*Decoder).fastpathDecMapUint64Uint16R)
- fn(map[uint64]uint32(nil), (*Encoder).fastpathEncMapUint64Uint32R, (*Decoder).fastpathDecMapUint64Uint32R)
fn(map[uint64]uint64(nil), (*Encoder).fastpathEncMapUint64Uint64R, (*Decoder).fastpathDecMapUint64Uint64R)
fn(map[uint64]uintptr(nil), (*Encoder).fastpathEncMapUint64UintptrR, (*Decoder).fastpathDecMapUint64UintptrR)
fn(map[uint64]int(nil), (*Encoder).fastpathEncMapUint64IntR, (*Decoder).fastpathDecMapUint64IntR)
- fn(map[uint64]int8(nil), (*Encoder).fastpathEncMapUint64Int8R, (*Decoder).fastpathDecMapUint64Int8R)
- fn(map[uint64]int16(nil), (*Encoder).fastpathEncMapUint64Int16R, (*Decoder).fastpathDecMapUint64Int16R)
- fn(map[uint64]int32(nil), (*Encoder).fastpathEncMapUint64Int32R, (*Decoder).fastpathDecMapUint64Int32R)
fn(map[uint64]int64(nil), (*Encoder).fastpathEncMapUint64Int64R, (*Decoder).fastpathDecMapUint64Int64R)
fn(map[uint64]float32(nil), (*Encoder).fastpathEncMapUint64Float32R, (*Decoder).fastpathDecMapUint64Float32R)
fn(map[uint64]float64(nil), (*Encoder).fastpathEncMapUint64Float64R, (*Decoder).fastpathDecMapUint64Float64R)
fn(map[uint64]bool(nil), (*Encoder).fastpathEncMapUint64BoolR, (*Decoder).fastpathDecMapUint64BoolR)
- fn(map[uintptr]interface{}(nil), (*Encoder).fastpathEncMapUintptrIntfR, (*Decoder).fastpathDecMapUintptrIntfR)
- fn(map[uintptr]string(nil), (*Encoder).fastpathEncMapUintptrStringR, (*Decoder).fastpathDecMapUintptrStringR)
- fn(map[uintptr]uint(nil), (*Encoder).fastpathEncMapUintptrUintR, (*Decoder).fastpathDecMapUintptrUintR)
- fn(map[uintptr]uint8(nil), (*Encoder).fastpathEncMapUintptrUint8R, (*Decoder).fastpathDecMapUintptrUint8R)
- fn(map[uintptr]uint16(nil), (*Encoder).fastpathEncMapUintptrUint16R, (*Decoder).fastpathDecMapUintptrUint16R)
- fn(map[uintptr]uint32(nil), (*Encoder).fastpathEncMapUintptrUint32R, (*Decoder).fastpathDecMapUintptrUint32R)
- fn(map[uintptr]uint64(nil), (*Encoder).fastpathEncMapUintptrUint64R, (*Decoder).fastpathDecMapUintptrUint64R)
- fn(map[uintptr]uintptr(nil), (*Encoder).fastpathEncMapUintptrUintptrR, (*Decoder).fastpathDecMapUintptrUintptrR)
- fn(map[uintptr]int(nil), (*Encoder).fastpathEncMapUintptrIntR, (*Decoder).fastpathDecMapUintptrIntR)
- fn(map[uintptr]int8(nil), (*Encoder).fastpathEncMapUintptrInt8R, (*Decoder).fastpathDecMapUintptrInt8R)
- fn(map[uintptr]int16(nil), (*Encoder).fastpathEncMapUintptrInt16R, (*Decoder).fastpathDecMapUintptrInt16R)
- fn(map[uintptr]int32(nil), (*Encoder).fastpathEncMapUintptrInt32R, (*Decoder).fastpathDecMapUintptrInt32R)
- fn(map[uintptr]int64(nil), (*Encoder).fastpathEncMapUintptrInt64R, (*Decoder).fastpathDecMapUintptrInt64R)
- fn(map[uintptr]float32(nil), (*Encoder).fastpathEncMapUintptrFloat32R, (*Decoder).fastpathDecMapUintptrFloat32R)
- fn(map[uintptr]float64(nil), (*Encoder).fastpathEncMapUintptrFloat64R, (*Decoder).fastpathDecMapUintptrFloat64R)
- fn(map[uintptr]bool(nil), (*Encoder).fastpathEncMapUintptrBoolR, (*Decoder).fastpathDecMapUintptrBoolR)
fn(map[int]interface{}(nil), (*Encoder).fastpathEncMapIntIntfR, (*Decoder).fastpathDecMapIntIntfR)
fn(map[int]string(nil), (*Encoder).fastpathEncMapIntStringR, (*Decoder).fastpathDecMapIntStringR)
+ fn(map[int][]byte(nil), (*Encoder).fastpathEncMapIntBytesR, (*Decoder).fastpathDecMapIntBytesR)
fn(map[int]uint(nil), (*Encoder).fastpathEncMapIntUintR, (*Decoder).fastpathDecMapIntUintR)
fn(map[int]uint8(nil), (*Encoder).fastpathEncMapIntUint8R, (*Decoder).fastpathDecMapIntUint8R)
- fn(map[int]uint16(nil), (*Encoder).fastpathEncMapIntUint16R, (*Decoder).fastpathDecMapIntUint16R)
- fn(map[int]uint32(nil), (*Encoder).fastpathEncMapIntUint32R, (*Decoder).fastpathDecMapIntUint32R)
fn(map[int]uint64(nil), (*Encoder).fastpathEncMapIntUint64R, (*Decoder).fastpathDecMapIntUint64R)
fn(map[int]uintptr(nil), (*Encoder).fastpathEncMapIntUintptrR, (*Decoder).fastpathDecMapIntUintptrR)
fn(map[int]int(nil), (*Encoder).fastpathEncMapIntIntR, (*Decoder).fastpathDecMapIntIntR)
- fn(map[int]int8(nil), (*Encoder).fastpathEncMapIntInt8R, (*Decoder).fastpathDecMapIntInt8R)
- fn(map[int]int16(nil), (*Encoder).fastpathEncMapIntInt16R, (*Decoder).fastpathDecMapIntInt16R)
- fn(map[int]int32(nil), (*Encoder).fastpathEncMapIntInt32R, (*Decoder).fastpathDecMapIntInt32R)
fn(map[int]int64(nil), (*Encoder).fastpathEncMapIntInt64R, (*Decoder).fastpathDecMapIntInt64R)
fn(map[int]float32(nil), (*Encoder).fastpathEncMapIntFloat32R, (*Decoder).fastpathDecMapIntFloat32R)
fn(map[int]float64(nil), (*Encoder).fastpathEncMapIntFloat64R, (*Decoder).fastpathDecMapIntFloat64R)
fn(map[int]bool(nil), (*Encoder).fastpathEncMapIntBoolR, (*Decoder).fastpathDecMapIntBoolR)
- fn(map[int8]interface{}(nil), (*Encoder).fastpathEncMapInt8IntfR, (*Decoder).fastpathDecMapInt8IntfR)
- fn(map[int8]string(nil), (*Encoder).fastpathEncMapInt8StringR, (*Decoder).fastpathDecMapInt8StringR)
- fn(map[int8]uint(nil), (*Encoder).fastpathEncMapInt8UintR, (*Decoder).fastpathDecMapInt8UintR)
- fn(map[int8]uint8(nil), (*Encoder).fastpathEncMapInt8Uint8R, (*Decoder).fastpathDecMapInt8Uint8R)
- fn(map[int8]uint16(nil), (*Encoder).fastpathEncMapInt8Uint16R, (*Decoder).fastpathDecMapInt8Uint16R)
- fn(map[int8]uint32(nil), (*Encoder).fastpathEncMapInt8Uint32R, (*Decoder).fastpathDecMapInt8Uint32R)
- fn(map[int8]uint64(nil), (*Encoder).fastpathEncMapInt8Uint64R, (*Decoder).fastpathDecMapInt8Uint64R)
- fn(map[int8]uintptr(nil), (*Encoder).fastpathEncMapInt8UintptrR, (*Decoder).fastpathDecMapInt8UintptrR)
- fn(map[int8]int(nil), (*Encoder).fastpathEncMapInt8IntR, (*Decoder).fastpathDecMapInt8IntR)
- fn(map[int8]int8(nil), (*Encoder).fastpathEncMapInt8Int8R, (*Decoder).fastpathDecMapInt8Int8R)
- fn(map[int8]int16(nil), (*Encoder).fastpathEncMapInt8Int16R, (*Decoder).fastpathDecMapInt8Int16R)
- fn(map[int8]int32(nil), (*Encoder).fastpathEncMapInt8Int32R, (*Decoder).fastpathDecMapInt8Int32R)
- fn(map[int8]int64(nil), (*Encoder).fastpathEncMapInt8Int64R, (*Decoder).fastpathDecMapInt8Int64R)
- fn(map[int8]float32(nil), (*Encoder).fastpathEncMapInt8Float32R, (*Decoder).fastpathDecMapInt8Float32R)
- fn(map[int8]float64(nil), (*Encoder).fastpathEncMapInt8Float64R, (*Decoder).fastpathDecMapInt8Float64R)
- fn(map[int8]bool(nil), (*Encoder).fastpathEncMapInt8BoolR, (*Decoder).fastpathDecMapInt8BoolR)
- fn(map[int16]interface{}(nil), (*Encoder).fastpathEncMapInt16IntfR, (*Decoder).fastpathDecMapInt16IntfR)
- fn(map[int16]string(nil), (*Encoder).fastpathEncMapInt16StringR, (*Decoder).fastpathDecMapInt16StringR)
- fn(map[int16]uint(nil), (*Encoder).fastpathEncMapInt16UintR, (*Decoder).fastpathDecMapInt16UintR)
- fn(map[int16]uint8(nil), (*Encoder).fastpathEncMapInt16Uint8R, (*Decoder).fastpathDecMapInt16Uint8R)
- fn(map[int16]uint16(nil), (*Encoder).fastpathEncMapInt16Uint16R, (*Decoder).fastpathDecMapInt16Uint16R)
- fn(map[int16]uint32(nil), (*Encoder).fastpathEncMapInt16Uint32R, (*Decoder).fastpathDecMapInt16Uint32R)
- fn(map[int16]uint64(nil), (*Encoder).fastpathEncMapInt16Uint64R, (*Decoder).fastpathDecMapInt16Uint64R)
- fn(map[int16]uintptr(nil), (*Encoder).fastpathEncMapInt16UintptrR, (*Decoder).fastpathDecMapInt16UintptrR)
- fn(map[int16]int(nil), (*Encoder).fastpathEncMapInt16IntR, (*Decoder).fastpathDecMapInt16IntR)
- fn(map[int16]int8(nil), (*Encoder).fastpathEncMapInt16Int8R, (*Decoder).fastpathDecMapInt16Int8R)
- fn(map[int16]int16(nil), (*Encoder).fastpathEncMapInt16Int16R, (*Decoder).fastpathDecMapInt16Int16R)
- fn(map[int16]int32(nil), (*Encoder).fastpathEncMapInt16Int32R, (*Decoder).fastpathDecMapInt16Int32R)
- fn(map[int16]int64(nil), (*Encoder).fastpathEncMapInt16Int64R, (*Decoder).fastpathDecMapInt16Int64R)
- fn(map[int16]float32(nil), (*Encoder).fastpathEncMapInt16Float32R, (*Decoder).fastpathDecMapInt16Float32R)
- fn(map[int16]float64(nil), (*Encoder).fastpathEncMapInt16Float64R, (*Decoder).fastpathDecMapInt16Float64R)
- fn(map[int16]bool(nil), (*Encoder).fastpathEncMapInt16BoolR, (*Decoder).fastpathDecMapInt16BoolR)
- fn(map[int32]interface{}(nil), (*Encoder).fastpathEncMapInt32IntfR, (*Decoder).fastpathDecMapInt32IntfR)
- fn(map[int32]string(nil), (*Encoder).fastpathEncMapInt32StringR, (*Decoder).fastpathDecMapInt32StringR)
- fn(map[int32]uint(nil), (*Encoder).fastpathEncMapInt32UintR, (*Decoder).fastpathDecMapInt32UintR)
- fn(map[int32]uint8(nil), (*Encoder).fastpathEncMapInt32Uint8R, (*Decoder).fastpathDecMapInt32Uint8R)
- fn(map[int32]uint16(nil), (*Encoder).fastpathEncMapInt32Uint16R, (*Decoder).fastpathDecMapInt32Uint16R)
- fn(map[int32]uint32(nil), (*Encoder).fastpathEncMapInt32Uint32R, (*Decoder).fastpathDecMapInt32Uint32R)
- fn(map[int32]uint64(nil), (*Encoder).fastpathEncMapInt32Uint64R, (*Decoder).fastpathDecMapInt32Uint64R)
- fn(map[int32]uintptr(nil), (*Encoder).fastpathEncMapInt32UintptrR, (*Decoder).fastpathDecMapInt32UintptrR)
- fn(map[int32]int(nil), (*Encoder).fastpathEncMapInt32IntR, (*Decoder).fastpathDecMapInt32IntR)
- fn(map[int32]int8(nil), (*Encoder).fastpathEncMapInt32Int8R, (*Decoder).fastpathDecMapInt32Int8R)
- fn(map[int32]int16(nil), (*Encoder).fastpathEncMapInt32Int16R, (*Decoder).fastpathDecMapInt32Int16R)
- fn(map[int32]int32(nil), (*Encoder).fastpathEncMapInt32Int32R, (*Decoder).fastpathDecMapInt32Int32R)
- fn(map[int32]int64(nil), (*Encoder).fastpathEncMapInt32Int64R, (*Decoder).fastpathDecMapInt32Int64R)
- fn(map[int32]float32(nil), (*Encoder).fastpathEncMapInt32Float32R, (*Decoder).fastpathDecMapInt32Float32R)
- fn(map[int32]float64(nil), (*Encoder).fastpathEncMapInt32Float64R, (*Decoder).fastpathDecMapInt32Float64R)
- fn(map[int32]bool(nil), (*Encoder).fastpathEncMapInt32BoolR, (*Decoder).fastpathDecMapInt32BoolR)
fn(map[int64]interface{}(nil), (*Encoder).fastpathEncMapInt64IntfR, (*Decoder).fastpathDecMapInt64IntfR)
fn(map[int64]string(nil), (*Encoder).fastpathEncMapInt64StringR, (*Decoder).fastpathDecMapInt64StringR)
+ fn(map[int64][]byte(nil), (*Encoder).fastpathEncMapInt64BytesR, (*Decoder).fastpathDecMapInt64BytesR)
fn(map[int64]uint(nil), (*Encoder).fastpathEncMapInt64UintR, (*Decoder).fastpathDecMapInt64UintR)
fn(map[int64]uint8(nil), (*Encoder).fastpathEncMapInt64Uint8R, (*Decoder).fastpathDecMapInt64Uint8R)
- fn(map[int64]uint16(nil), (*Encoder).fastpathEncMapInt64Uint16R, (*Decoder).fastpathDecMapInt64Uint16R)
- fn(map[int64]uint32(nil), (*Encoder).fastpathEncMapInt64Uint32R, (*Decoder).fastpathDecMapInt64Uint32R)
fn(map[int64]uint64(nil), (*Encoder).fastpathEncMapInt64Uint64R, (*Decoder).fastpathDecMapInt64Uint64R)
fn(map[int64]uintptr(nil), (*Encoder).fastpathEncMapInt64UintptrR, (*Decoder).fastpathDecMapInt64UintptrR)
fn(map[int64]int(nil), (*Encoder).fastpathEncMapInt64IntR, (*Decoder).fastpathDecMapInt64IntR)
- fn(map[int64]int8(nil), (*Encoder).fastpathEncMapInt64Int8R, (*Decoder).fastpathDecMapInt64Int8R)
- fn(map[int64]int16(nil), (*Encoder).fastpathEncMapInt64Int16R, (*Decoder).fastpathDecMapInt64Int16R)
- fn(map[int64]int32(nil), (*Encoder).fastpathEncMapInt64Int32R, (*Decoder).fastpathDecMapInt64Int32R)
fn(map[int64]int64(nil), (*Encoder).fastpathEncMapInt64Int64R, (*Decoder).fastpathDecMapInt64Int64R)
fn(map[int64]float32(nil), (*Encoder).fastpathEncMapInt64Float32R, (*Decoder).fastpathDecMapInt64Float32R)
fn(map[int64]float64(nil), (*Encoder).fastpathEncMapInt64Float64R, (*Decoder).fastpathDecMapInt64Float64R)
fn(map[int64]bool(nil), (*Encoder).fastpathEncMapInt64BoolR, (*Decoder).fastpathDecMapInt64BoolR)
- fn(map[bool]interface{}(nil), (*Encoder).fastpathEncMapBoolIntfR, (*Decoder).fastpathDecMapBoolIntfR)
- fn(map[bool]string(nil), (*Encoder).fastpathEncMapBoolStringR, (*Decoder).fastpathDecMapBoolStringR)
- fn(map[bool]uint(nil), (*Encoder).fastpathEncMapBoolUintR, (*Decoder).fastpathDecMapBoolUintR)
- fn(map[bool]uint8(nil), (*Encoder).fastpathEncMapBoolUint8R, (*Decoder).fastpathDecMapBoolUint8R)
- fn(map[bool]uint16(nil), (*Encoder).fastpathEncMapBoolUint16R, (*Decoder).fastpathDecMapBoolUint16R)
- fn(map[bool]uint32(nil), (*Encoder).fastpathEncMapBoolUint32R, (*Decoder).fastpathDecMapBoolUint32R)
- fn(map[bool]uint64(nil), (*Encoder).fastpathEncMapBoolUint64R, (*Decoder).fastpathDecMapBoolUint64R)
- fn(map[bool]uintptr(nil), (*Encoder).fastpathEncMapBoolUintptrR, (*Decoder).fastpathDecMapBoolUintptrR)
- fn(map[bool]int(nil), (*Encoder).fastpathEncMapBoolIntR, (*Decoder).fastpathDecMapBoolIntR)
- fn(map[bool]int8(nil), (*Encoder).fastpathEncMapBoolInt8R, (*Decoder).fastpathDecMapBoolInt8R)
- fn(map[bool]int16(nil), (*Encoder).fastpathEncMapBoolInt16R, (*Decoder).fastpathDecMapBoolInt16R)
- fn(map[bool]int32(nil), (*Encoder).fastpathEncMapBoolInt32R, (*Decoder).fastpathDecMapBoolInt32R)
- fn(map[bool]int64(nil), (*Encoder).fastpathEncMapBoolInt64R, (*Decoder).fastpathDecMapBoolInt64R)
- fn(map[bool]float32(nil), (*Encoder).fastpathEncMapBoolFloat32R, (*Decoder).fastpathDecMapBoolFloat32R)
- fn(map[bool]float64(nil), (*Encoder).fastpathEncMapBoolFloat64R, (*Decoder).fastpathDecMapBoolFloat64R)
- fn(map[bool]bool(nil), (*Encoder).fastpathEncMapBoolBoolR, (*Decoder).fastpathDecMapBoolBoolR)
sort.Sort(fastpathAslice(fastpathAV[:]))
}
@@ -384,6 +202,10 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool {
fastpathTV.EncSliceStringV(v, e)
case *[]string:
fastpathTV.EncSliceStringV(*v, e)
+ case [][]byte:
+ fastpathTV.EncSliceBytesV(v, e)
+ case *[][]byte:
+ fastpathTV.EncSliceBytesV(*v, e)
case []float32:
fastpathTV.EncSliceFloat32V(v, e)
case *[]float32:
@@ -437,70 +259,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool {
case *[]bool:
fastpathTV.EncSliceBoolV(*v, e)
- case map[interface{}]interface{}:
- fastpathTV.EncMapIntfIntfV(v, e)
- case *map[interface{}]interface{}:
- fastpathTV.EncMapIntfIntfV(*v, e)
- case map[interface{}]string:
- fastpathTV.EncMapIntfStringV(v, e)
- case *map[interface{}]string:
- fastpathTV.EncMapIntfStringV(*v, e)
- case map[interface{}]uint:
- fastpathTV.EncMapIntfUintV(v, e)
- case *map[interface{}]uint:
- fastpathTV.EncMapIntfUintV(*v, e)
- case map[interface{}]uint8:
- fastpathTV.EncMapIntfUint8V(v, e)
- case *map[interface{}]uint8:
- fastpathTV.EncMapIntfUint8V(*v, e)
- case map[interface{}]uint16:
- fastpathTV.EncMapIntfUint16V(v, e)
- case *map[interface{}]uint16:
- fastpathTV.EncMapIntfUint16V(*v, e)
- case map[interface{}]uint32:
- fastpathTV.EncMapIntfUint32V(v, e)
- case *map[interface{}]uint32:
- fastpathTV.EncMapIntfUint32V(*v, e)
- case map[interface{}]uint64:
- fastpathTV.EncMapIntfUint64V(v, e)
- case *map[interface{}]uint64:
- fastpathTV.EncMapIntfUint64V(*v, e)
- case map[interface{}]uintptr:
- fastpathTV.EncMapIntfUintptrV(v, e)
- case *map[interface{}]uintptr:
- fastpathTV.EncMapIntfUintptrV(*v, e)
- case map[interface{}]int:
- fastpathTV.EncMapIntfIntV(v, e)
- case *map[interface{}]int:
- fastpathTV.EncMapIntfIntV(*v, e)
- case map[interface{}]int8:
- fastpathTV.EncMapIntfInt8V(v, e)
- case *map[interface{}]int8:
- fastpathTV.EncMapIntfInt8V(*v, e)
- case map[interface{}]int16:
- fastpathTV.EncMapIntfInt16V(v, e)
- case *map[interface{}]int16:
- fastpathTV.EncMapIntfInt16V(*v, e)
- case map[interface{}]int32:
- fastpathTV.EncMapIntfInt32V(v, e)
- case *map[interface{}]int32:
- fastpathTV.EncMapIntfInt32V(*v, e)
- case map[interface{}]int64:
- fastpathTV.EncMapIntfInt64V(v, e)
- case *map[interface{}]int64:
- fastpathTV.EncMapIntfInt64V(*v, e)
- case map[interface{}]float32:
- fastpathTV.EncMapIntfFloat32V(v, e)
- case *map[interface{}]float32:
- fastpathTV.EncMapIntfFloat32V(*v, e)
- case map[interface{}]float64:
- fastpathTV.EncMapIntfFloat64V(v, e)
- case *map[interface{}]float64:
- fastpathTV.EncMapIntfFloat64V(*v, e)
- case map[interface{}]bool:
- fastpathTV.EncMapIntfBoolV(v, e)
- case *map[interface{}]bool:
- fastpathTV.EncMapIntfBoolV(*v, e)
case map[string]interface{}:
fastpathTV.EncMapStringIntfV(v, e)
case *map[string]interface{}:
@@ -509,6 +267,10 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool {
fastpathTV.EncMapStringStringV(v, e)
case *map[string]string:
fastpathTV.EncMapStringStringV(*v, e)
+ case map[string][]byte:
+ fastpathTV.EncMapStringBytesV(v, e)
+ case *map[string][]byte:
+ fastpathTV.EncMapStringBytesV(*v, e)
case map[string]uint:
fastpathTV.EncMapStringUintV(v, e)
case *map[string]uint:
@@ -517,14 +279,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool {
fastpathTV.EncMapStringUint8V(v, e)
case *map[string]uint8:
fastpathTV.EncMapStringUint8V(*v, e)
- case map[string]uint16:
- fastpathTV.EncMapStringUint16V(v, e)
- case *map[string]uint16:
- fastpathTV.EncMapStringUint16V(*v, e)
- case map[string]uint32:
- fastpathTV.EncMapStringUint32V(v, e)
- case *map[string]uint32:
- fastpathTV.EncMapStringUint32V(*v, e)
case map[string]uint64:
fastpathTV.EncMapStringUint64V(v, e)
case *map[string]uint64:
@@ -537,18 +291,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool {
fastpathTV.EncMapStringIntV(v, e)
case *map[string]int:
fastpathTV.EncMapStringIntV(*v, e)
- case map[string]int8:
- fastpathTV.EncMapStringInt8V(v, e)
- case *map[string]int8:
- fastpathTV.EncMapStringInt8V(*v, e)
- case map[string]int16:
- fastpathTV.EncMapStringInt16V(v, e)
- case *map[string]int16:
- fastpathTV.EncMapStringInt16V(*v, e)
- case map[string]int32:
- fastpathTV.EncMapStringInt32V(v, e)
- case *map[string]int32:
- fastpathTV.EncMapStringInt32V(*v, e)
case map[string]int64:
fastpathTV.EncMapStringInt64V(v, e)
case *map[string]int64:
@@ -565,134 +307,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool {
fastpathTV.EncMapStringBoolV(v, e)
case *map[string]bool:
fastpathTV.EncMapStringBoolV(*v, e)
- case map[float32]interface{}:
- fastpathTV.EncMapFloat32IntfV(v, e)
- case *map[float32]interface{}:
- fastpathTV.EncMapFloat32IntfV(*v, e)
- case map[float32]string:
- fastpathTV.EncMapFloat32StringV(v, e)
- case *map[float32]string:
- fastpathTV.EncMapFloat32StringV(*v, e)
- case map[float32]uint:
- fastpathTV.EncMapFloat32UintV(v, e)
- case *map[float32]uint:
- fastpathTV.EncMapFloat32UintV(*v, e)
- case map[float32]uint8:
- fastpathTV.EncMapFloat32Uint8V(v, e)
- case *map[float32]uint8:
- fastpathTV.EncMapFloat32Uint8V(*v, e)
- case map[float32]uint16:
- fastpathTV.EncMapFloat32Uint16V(v, e)
- case *map[float32]uint16:
- fastpathTV.EncMapFloat32Uint16V(*v, e)
- case map[float32]uint32:
- fastpathTV.EncMapFloat32Uint32V(v, e)
- case *map[float32]uint32:
- fastpathTV.EncMapFloat32Uint32V(*v, e)
- case map[float32]uint64:
- fastpathTV.EncMapFloat32Uint64V(v, e)
- case *map[float32]uint64:
- fastpathTV.EncMapFloat32Uint64V(*v, e)
- case map[float32]uintptr:
- fastpathTV.EncMapFloat32UintptrV(v, e)
- case *map[float32]uintptr:
- fastpathTV.EncMapFloat32UintptrV(*v, e)
- case map[float32]int:
- fastpathTV.EncMapFloat32IntV(v, e)
- case *map[float32]int:
- fastpathTV.EncMapFloat32IntV(*v, e)
- case map[float32]int8:
- fastpathTV.EncMapFloat32Int8V(v, e)
- case *map[float32]int8:
- fastpathTV.EncMapFloat32Int8V(*v, e)
- case map[float32]int16:
- fastpathTV.EncMapFloat32Int16V(v, e)
- case *map[float32]int16:
- fastpathTV.EncMapFloat32Int16V(*v, e)
- case map[float32]int32:
- fastpathTV.EncMapFloat32Int32V(v, e)
- case *map[float32]int32:
- fastpathTV.EncMapFloat32Int32V(*v, e)
- case map[float32]int64:
- fastpathTV.EncMapFloat32Int64V(v, e)
- case *map[float32]int64:
- fastpathTV.EncMapFloat32Int64V(*v, e)
- case map[float32]float32:
- fastpathTV.EncMapFloat32Float32V(v, e)
- case *map[float32]float32:
- fastpathTV.EncMapFloat32Float32V(*v, e)
- case map[float32]float64:
- fastpathTV.EncMapFloat32Float64V(v, e)
- case *map[float32]float64:
- fastpathTV.EncMapFloat32Float64V(*v, e)
- case map[float32]bool:
- fastpathTV.EncMapFloat32BoolV(v, e)
- case *map[float32]bool:
- fastpathTV.EncMapFloat32BoolV(*v, e)
- case map[float64]interface{}:
- fastpathTV.EncMapFloat64IntfV(v, e)
- case *map[float64]interface{}:
- fastpathTV.EncMapFloat64IntfV(*v, e)
- case map[float64]string:
- fastpathTV.EncMapFloat64StringV(v, e)
- case *map[float64]string:
- fastpathTV.EncMapFloat64StringV(*v, e)
- case map[float64]uint:
- fastpathTV.EncMapFloat64UintV(v, e)
- case *map[float64]uint:
- fastpathTV.EncMapFloat64UintV(*v, e)
- case map[float64]uint8:
- fastpathTV.EncMapFloat64Uint8V(v, e)
- case *map[float64]uint8:
- fastpathTV.EncMapFloat64Uint8V(*v, e)
- case map[float64]uint16:
- fastpathTV.EncMapFloat64Uint16V(v, e)
- case *map[float64]uint16:
- fastpathTV.EncMapFloat64Uint16V(*v, e)
- case map[float64]uint32:
- fastpathTV.EncMapFloat64Uint32V(v, e)
- case *map[float64]uint32:
- fastpathTV.EncMapFloat64Uint32V(*v, e)
- case map[float64]uint64:
- fastpathTV.EncMapFloat64Uint64V(v, e)
- case *map[float64]uint64:
- fastpathTV.EncMapFloat64Uint64V(*v, e)
- case map[float64]uintptr:
- fastpathTV.EncMapFloat64UintptrV(v, e)
- case *map[float64]uintptr:
- fastpathTV.EncMapFloat64UintptrV(*v, e)
- case map[float64]int:
- fastpathTV.EncMapFloat64IntV(v, e)
- case *map[float64]int:
- fastpathTV.EncMapFloat64IntV(*v, e)
- case map[float64]int8:
- fastpathTV.EncMapFloat64Int8V(v, e)
- case *map[float64]int8:
- fastpathTV.EncMapFloat64Int8V(*v, e)
- case map[float64]int16:
- fastpathTV.EncMapFloat64Int16V(v, e)
- case *map[float64]int16:
- fastpathTV.EncMapFloat64Int16V(*v, e)
- case map[float64]int32:
- fastpathTV.EncMapFloat64Int32V(v, e)
- case *map[float64]int32:
- fastpathTV.EncMapFloat64Int32V(*v, e)
- case map[float64]int64:
- fastpathTV.EncMapFloat64Int64V(v, e)
- case *map[float64]int64:
- fastpathTV.EncMapFloat64Int64V(*v, e)
- case map[float64]float32:
- fastpathTV.EncMapFloat64Float32V(v, e)
- case *map[float64]float32:
- fastpathTV.EncMapFloat64Float32V(*v, e)
- case map[float64]float64:
- fastpathTV.EncMapFloat64Float64V(v, e)
- case *map[float64]float64:
- fastpathTV.EncMapFloat64Float64V(*v, e)
- case map[float64]bool:
- fastpathTV.EncMapFloat64BoolV(v, e)
- case *map[float64]bool:
- fastpathTV.EncMapFloat64BoolV(*v, e)
case map[uint]interface{}:
fastpathTV.EncMapUintIntfV(v, e)
case *map[uint]interface{}:
@@ -701,6 +315,10 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool {
fastpathTV.EncMapUintStringV(v, e)
case *map[uint]string:
fastpathTV.EncMapUintStringV(*v, e)
+ case map[uint][]byte:
+ fastpathTV.EncMapUintBytesV(v, e)
+ case *map[uint][]byte:
+ fastpathTV.EncMapUintBytesV(*v, e)
case map[uint]uint:
fastpathTV.EncMapUintUintV(v, e)
case *map[uint]uint:
@@ -709,14 +327,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool {
fastpathTV.EncMapUintUint8V(v, e)
case *map[uint]uint8:
fastpathTV.EncMapUintUint8V(*v, e)
- case map[uint]uint16:
- fastpathTV.EncMapUintUint16V(v, e)
- case *map[uint]uint16:
- fastpathTV.EncMapUintUint16V(*v, e)
- case map[uint]uint32:
- fastpathTV.EncMapUintUint32V(v, e)
- case *map[uint]uint32:
- fastpathTV.EncMapUintUint32V(*v, e)
case map[uint]uint64:
fastpathTV.EncMapUintUint64V(v, e)
case *map[uint]uint64:
@@ -729,18 +339,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool {
fastpathTV.EncMapUintIntV(v, e)
case *map[uint]int:
fastpathTV.EncMapUintIntV(*v, e)
- case map[uint]int8:
- fastpathTV.EncMapUintInt8V(v, e)
- case *map[uint]int8:
- fastpathTV.EncMapUintInt8V(*v, e)
- case map[uint]int16:
- fastpathTV.EncMapUintInt16V(v, e)
- case *map[uint]int16:
- fastpathTV.EncMapUintInt16V(*v, e)
- case map[uint]int32:
- fastpathTV.EncMapUintInt32V(v, e)
- case *map[uint]int32:
- fastpathTV.EncMapUintInt32V(*v, e)
case map[uint]int64:
fastpathTV.EncMapUintInt64V(v, e)
case *map[uint]int64:
@@ -765,6 +363,10 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool {
fastpathTV.EncMapUint8StringV(v, e)
case *map[uint8]string:
fastpathTV.EncMapUint8StringV(*v, e)
+ case map[uint8][]byte:
+ fastpathTV.EncMapUint8BytesV(v, e)
+ case *map[uint8][]byte:
+ fastpathTV.EncMapUint8BytesV(*v, e)
case map[uint8]uint:
fastpathTV.EncMapUint8UintV(v, e)
case *map[uint8]uint:
@@ -773,14 +375,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool {
fastpathTV.EncMapUint8Uint8V(v, e)
case *map[uint8]uint8:
fastpathTV.EncMapUint8Uint8V(*v, e)
- case map[uint8]uint16:
- fastpathTV.EncMapUint8Uint16V(v, e)
- case *map[uint8]uint16:
- fastpathTV.EncMapUint8Uint16V(*v, e)
- case map[uint8]uint32:
- fastpathTV.EncMapUint8Uint32V(v, e)
- case *map[uint8]uint32:
- fastpathTV.EncMapUint8Uint32V(*v, e)
case map[uint8]uint64:
fastpathTV.EncMapUint8Uint64V(v, e)
case *map[uint8]uint64:
@@ -793,18 +387,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool {
fastpathTV.EncMapUint8IntV(v, e)
case *map[uint8]int:
fastpathTV.EncMapUint8IntV(*v, e)
- case map[uint8]int8:
- fastpathTV.EncMapUint8Int8V(v, e)
- case *map[uint8]int8:
- fastpathTV.EncMapUint8Int8V(*v, e)
- case map[uint8]int16:
- fastpathTV.EncMapUint8Int16V(v, e)
- case *map[uint8]int16:
- fastpathTV.EncMapUint8Int16V(*v, e)
- case map[uint8]int32:
- fastpathTV.EncMapUint8Int32V(v, e)
- case *map[uint8]int32:
- fastpathTV.EncMapUint8Int32V(*v, e)
case map[uint8]int64:
fastpathTV.EncMapUint8Int64V(v, e)
case *map[uint8]int64:
@@ -821,134 +403,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool {
fastpathTV.EncMapUint8BoolV(v, e)
case *map[uint8]bool:
fastpathTV.EncMapUint8BoolV(*v, e)
- case map[uint16]interface{}:
- fastpathTV.EncMapUint16IntfV(v, e)
- case *map[uint16]interface{}:
- fastpathTV.EncMapUint16IntfV(*v, e)
- case map[uint16]string:
- fastpathTV.EncMapUint16StringV(v, e)
- case *map[uint16]string:
- fastpathTV.EncMapUint16StringV(*v, e)
- case map[uint16]uint:
- fastpathTV.EncMapUint16UintV(v, e)
- case *map[uint16]uint:
- fastpathTV.EncMapUint16UintV(*v, e)
- case map[uint16]uint8:
- fastpathTV.EncMapUint16Uint8V(v, e)
- case *map[uint16]uint8:
- fastpathTV.EncMapUint16Uint8V(*v, e)
- case map[uint16]uint16:
- fastpathTV.EncMapUint16Uint16V(v, e)
- case *map[uint16]uint16:
- fastpathTV.EncMapUint16Uint16V(*v, e)
- case map[uint16]uint32:
- fastpathTV.EncMapUint16Uint32V(v, e)
- case *map[uint16]uint32:
- fastpathTV.EncMapUint16Uint32V(*v, e)
- case map[uint16]uint64:
- fastpathTV.EncMapUint16Uint64V(v, e)
- case *map[uint16]uint64:
- fastpathTV.EncMapUint16Uint64V(*v, e)
- case map[uint16]uintptr:
- fastpathTV.EncMapUint16UintptrV(v, e)
- case *map[uint16]uintptr:
- fastpathTV.EncMapUint16UintptrV(*v, e)
- case map[uint16]int:
- fastpathTV.EncMapUint16IntV(v, e)
- case *map[uint16]int:
- fastpathTV.EncMapUint16IntV(*v, e)
- case map[uint16]int8:
- fastpathTV.EncMapUint16Int8V(v, e)
- case *map[uint16]int8:
- fastpathTV.EncMapUint16Int8V(*v, e)
- case map[uint16]int16:
- fastpathTV.EncMapUint16Int16V(v, e)
- case *map[uint16]int16:
- fastpathTV.EncMapUint16Int16V(*v, e)
- case map[uint16]int32:
- fastpathTV.EncMapUint16Int32V(v, e)
- case *map[uint16]int32:
- fastpathTV.EncMapUint16Int32V(*v, e)
- case map[uint16]int64:
- fastpathTV.EncMapUint16Int64V(v, e)
- case *map[uint16]int64:
- fastpathTV.EncMapUint16Int64V(*v, e)
- case map[uint16]float32:
- fastpathTV.EncMapUint16Float32V(v, e)
- case *map[uint16]float32:
- fastpathTV.EncMapUint16Float32V(*v, e)
- case map[uint16]float64:
- fastpathTV.EncMapUint16Float64V(v, e)
- case *map[uint16]float64:
- fastpathTV.EncMapUint16Float64V(*v, e)
- case map[uint16]bool:
- fastpathTV.EncMapUint16BoolV(v, e)
- case *map[uint16]bool:
- fastpathTV.EncMapUint16BoolV(*v, e)
- case map[uint32]interface{}:
- fastpathTV.EncMapUint32IntfV(v, e)
- case *map[uint32]interface{}:
- fastpathTV.EncMapUint32IntfV(*v, e)
- case map[uint32]string:
- fastpathTV.EncMapUint32StringV(v, e)
- case *map[uint32]string:
- fastpathTV.EncMapUint32StringV(*v, e)
- case map[uint32]uint:
- fastpathTV.EncMapUint32UintV(v, e)
- case *map[uint32]uint:
- fastpathTV.EncMapUint32UintV(*v, e)
- case map[uint32]uint8:
- fastpathTV.EncMapUint32Uint8V(v, e)
- case *map[uint32]uint8:
- fastpathTV.EncMapUint32Uint8V(*v, e)
- case map[uint32]uint16:
- fastpathTV.EncMapUint32Uint16V(v, e)
- case *map[uint32]uint16:
- fastpathTV.EncMapUint32Uint16V(*v, e)
- case map[uint32]uint32:
- fastpathTV.EncMapUint32Uint32V(v, e)
- case *map[uint32]uint32:
- fastpathTV.EncMapUint32Uint32V(*v, e)
- case map[uint32]uint64:
- fastpathTV.EncMapUint32Uint64V(v, e)
- case *map[uint32]uint64:
- fastpathTV.EncMapUint32Uint64V(*v, e)
- case map[uint32]uintptr:
- fastpathTV.EncMapUint32UintptrV(v, e)
- case *map[uint32]uintptr:
- fastpathTV.EncMapUint32UintptrV(*v, e)
- case map[uint32]int:
- fastpathTV.EncMapUint32IntV(v, e)
- case *map[uint32]int:
- fastpathTV.EncMapUint32IntV(*v, e)
- case map[uint32]int8:
- fastpathTV.EncMapUint32Int8V(v, e)
- case *map[uint32]int8:
- fastpathTV.EncMapUint32Int8V(*v, e)
- case map[uint32]int16:
- fastpathTV.EncMapUint32Int16V(v, e)
- case *map[uint32]int16:
- fastpathTV.EncMapUint32Int16V(*v, e)
- case map[uint32]int32:
- fastpathTV.EncMapUint32Int32V(v, e)
- case *map[uint32]int32:
- fastpathTV.EncMapUint32Int32V(*v, e)
- case map[uint32]int64:
- fastpathTV.EncMapUint32Int64V(v, e)
- case *map[uint32]int64:
- fastpathTV.EncMapUint32Int64V(*v, e)
- case map[uint32]float32:
- fastpathTV.EncMapUint32Float32V(v, e)
- case *map[uint32]float32:
- fastpathTV.EncMapUint32Float32V(*v, e)
- case map[uint32]float64:
- fastpathTV.EncMapUint32Float64V(v, e)
- case *map[uint32]float64:
- fastpathTV.EncMapUint32Float64V(*v, e)
- case map[uint32]bool:
- fastpathTV.EncMapUint32BoolV(v, e)
- case *map[uint32]bool:
- fastpathTV.EncMapUint32BoolV(*v, e)
case map[uint64]interface{}:
fastpathTV.EncMapUint64IntfV(v, e)
case *map[uint64]interface{}:
@@ -957,6 +411,10 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool {
fastpathTV.EncMapUint64StringV(v, e)
case *map[uint64]string:
fastpathTV.EncMapUint64StringV(*v, e)
+ case map[uint64][]byte:
+ fastpathTV.EncMapUint64BytesV(v, e)
+ case *map[uint64][]byte:
+ fastpathTV.EncMapUint64BytesV(*v, e)
case map[uint64]uint:
fastpathTV.EncMapUint64UintV(v, e)
case *map[uint64]uint:
@@ -965,14 +423,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool {
fastpathTV.EncMapUint64Uint8V(v, e)
case *map[uint64]uint8:
fastpathTV.EncMapUint64Uint8V(*v, e)
- case map[uint64]uint16:
- fastpathTV.EncMapUint64Uint16V(v, e)
- case *map[uint64]uint16:
- fastpathTV.EncMapUint64Uint16V(*v, e)
- case map[uint64]uint32:
- fastpathTV.EncMapUint64Uint32V(v, e)
- case *map[uint64]uint32:
- fastpathTV.EncMapUint64Uint32V(*v, e)
case map[uint64]uint64:
fastpathTV.EncMapUint64Uint64V(v, e)
case *map[uint64]uint64:
@@ -985,18 +435,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool {
fastpathTV.EncMapUint64IntV(v, e)
case *map[uint64]int:
fastpathTV.EncMapUint64IntV(*v, e)
- case map[uint64]int8:
- fastpathTV.EncMapUint64Int8V(v, e)
- case *map[uint64]int8:
- fastpathTV.EncMapUint64Int8V(*v, e)
- case map[uint64]int16:
- fastpathTV.EncMapUint64Int16V(v, e)
- case *map[uint64]int16:
- fastpathTV.EncMapUint64Int16V(*v, e)
- case map[uint64]int32:
- fastpathTV.EncMapUint64Int32V(v, e)
- case *map[uint64]int32:
- fastpathTV.EncMapUint64Int32V(*v, e)
case map[uint64]int64:
fastpathTV.EncMapUint64Int64V(v, e)
case *map[uint64]int64:
@@ -1013,70 +451,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool {
fastpathTV.EncMapUint64BoolV(v, e)
case *map[uint64]bool:
fastpathTV.EncMapUint64BoolV(*v, e)
- case map[uintptr]interface{}:
- fastpathTV.EncMapUintptrIntfV(v, e)
- case *map[uintptr]interface{}:
- fastpathTV.EncMapUintptrIntfV(*v, e)
- case map[uintptr]string:
- fastpathTV.EncMapUintptrStringV(v, e)
- case *map[uintptr]string:
- fastpathTV.EncMapUintptrStringV(*v, e)
- case map[uintptr]uint:
- fastpathTV.EncMapUintptrUintV(v, e)
- case *map[uintptr]uint:
- fastpathTV.EncMapUintptrUintV(*v, e)
- case map[uintptr]uint8:
- fastpathTV.EncMapUintptrUint8V(v, e)
- case *map[uintptr]uint8:
- fastpathTV.EncMapUintptrUint8V(*v, e)
- case map[uintptr]uint16:
- fastpathTV.EncMapUintptrUint16V(v, e)
- case *map[uintptr]uint16:
- fastpathTV.EncMapUintptrUint16V(*v, e)
- case map[uintptr]uint32:
- fastpathTV.EncMapUintptrUint32V(v, e)
- case *map[uintptr]uint32:
- fastpathTV.EncMapUintptrUint32V(*v, e)
- case map[uintptr]uint64:
- fastpathTV.EncMapUintptrUint64V(v, e)
- case *map[uintptr]uint64:
- fastpathTV.EncMapUintptrUint64V(*v, e)
- case map[uintptr]uintptr:
- fastpathTV.EncMapUintptrUintptrV(v, e)
- case *map[uintptr]uintptr:
- fastpathTV.EncMapUintptrUintptrV(*v, e)
- case map[uintptr]int:
- fastpathTV.EncMapUintptrIntV(v, e)
- case *map[uintptr]int:
- fastpathTV.EncMapUintptrIntV(*v, e)
- case map[uintptr]int8:
- fastpathTV.EncMapUintptrInt8V(v, e)
- case *map[uintptr]int8:
- fastpathTV.EncMapUintptrInt8V(*v, e)
- case map[uintptr]int16:
- fastpathTV.EncMapUintptrInt16V(v, e)
- case *map[uintptr]int16:
- fastpathTV.EncMapUintptrInt16V(*v, e)
- case map[uintptr]int32:
- fastpathTV.EncMapUintptrInt32V(v, e)
- case *map[uintptr]int32:
- fastpathTV.EncMapUintptrInt32V(*v, e)
- case map[uintptr]int64:
- fastpathTV.EncMapUintptrInt64V(v, e)
- case *map[uintptr]int64:
- fastpathTV.EncMapUintptrInt64V(*v, e)
- case map[uintptr]float32:
- fastpathTV.EncMapUintptrFloat32V(v, e)
- case *map[uintptr]float32:
- fastpathTV.EncMapUintptrFloat32V(*v, e)
- case map[uintptr]float64:
- fastpathTV.EncMapUintptrFloat64V(v, e)
- case *map[uintptr]float64:
- fastpathTV.EncMapUintptrFloat64V(*v, e)
- case map[uintptr]bool:
- fastpathTV.EncMapUintptrBoolV(v, e)
- case *map[uintptr]bool:
- fastpathTV.EncMapUintptrBoolV(*v, e)
case map[int]interface{}:
fastpathTV.EncMapIntIntfV(v, e)
case *map[int]interface{}:
@@ -1085,6 +459,10 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool {
fastpathTV.EncMapIntStringV(v, e)
case *map[int]string:
fastpathTV.EncMapIntStringV(*v, e)
+ case map[int][]byte:
+ fastpathTV.EncMapIntBytesV(v, e)
+ case *map[int][]byte:
+ fastpathTV.EncMapIntBytesV(*v, e)
case map[int]uint:
fastpathTV.EncMapIntUintV(v, e)
case *map[int]uint:
@@ -1093,14 +471,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool {
fastpathTV.EncMapIntUint8V(v, e)
case *map[int]uint8:
fastpathTV.EncMapIntUint8V(*v, e)
- case map[int]uint16:
- fastpathTV.EncMapIntUint16V(v, e)
- case *map[int]uint16:
- fastpathTV.EncMapIntUint16V(*v, e)
- case map[int]uint32:
- fastpathTV.EncMapIntUint32V(v, e)
- case *map[int]uint32:
- fastpathTV.EncMapIntUint32V(*v, e)
case map[int]uint64:
fastpathTV.EncMapIntUint64V(v, e)
case *map[int]uint64:
@@ -1113,18 +483,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool {
fastpathTV.EncMapIntIntV(v, e)
case *map[int]int:
fastpathTV.EncMapIntIntV(*v, e)
- case map[int]int8:
- fastpathTV.EncMapIntInt8V(v, e)
- case *map[int]int8:
- fastpathTV.EncMapIntInt8V(*v, e)
- case map[int]int16:
- fastpathTV.EncMapIntInt16V(v, e)
- case *map[int]int16:
- fastpathTV.EncMapIntInt16V(*v, e)
- case map[int]int32:
- fastpathTV.EncMapIntInt32V(v, e)
- case *map[int]int32:
- fastpathTV.EncMapIntInt32V(*v, e)
case map[int]int64:
fastpathTV.EncMapIntInt64V(v, e)
case *map[int]int64:
@@ -1141,198 +499,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool {
fastpathTV.EncMapIntBoolV(v, e)
case *map[int]bool:
fastpathTV.EncMapIntBoolV(*v, e)
- case map[int8]interface{}:
- fastpathTV.EncMapInt8IntfV(v, e)
- case *map[int8]interface{}:
- fastpathTV.EncMapInt8IntfV(*v, e)
- case map[int8]string:
- fastpathTV.EncMapInt8StringV(v, e)
- case *map[int8]string:
- fastpathTV.EncMapInt8StringV(*v, e)
- case map[int8]uint:
- fastpathTV.EncMapInt8UintV(v, e)
- case *map[int8]uint:
- fastpathTV.EncMapInt8UintV(*v, e)
- case map[int8]uint8:
- fastpathTV.EncMapInt8Uint8V(v, e)
- case *map[int8]uint8:
- fastpathTV.EncMapInt8Uint8V(*v, e)
- case map[int8]uint16:
- fastpathTV.EncMapInt8Uint16V(v, e)
- case *map[int8]uint16:
- fastpathTV.EncMapInt8Uint16V(*v, e)
- case map[int8]uint32:
- fastpathTV.EncMapInt8Uint32V(v, e)
- case *map[int8]uint32:
- fastpathTV.EncMapInt8Uint32V(*v, e)
- case map[int8]uint64:
- fastpathTV.EncMapInt8Uint64V(v, e)
- case *map[int8]uint64:
- fastpathTV.EncMapInt8Uint64V(*v, e)
- case map[int8]uintptr:
- fastpathTV.EncMapInt8UintptrV(v, e)
- case *map[int8]uintptr:
- fastpathTV.EncMapInt8UintptrV(*v, e)
- case map[int8]int:
- fastpathTV.EncMapInt8IntV(v, e)
- case *map[int8]int:
- fastpathTV.EncMapInt8IntV(*v, e)
- case map[int8]int8:
- fastpathTV.EncMapInt8Int8V(v, e)
- case *map[int8]int8:
- fastpathTV.EncMapInt8Int8V(*v, e)
- case map[int8]int16:
- fastpathTV.EncMapInt8Int16V(v, e)
- case *map[int8]int16:
- fastpathTV.EncMapInt8Int16V(*v, e)
- case map[int8]int32:
- fastpathTV.EncMapInt8Int32V(v, e)
- case *map[int8]int32:
- fastpathTV.EncMapInt8Int32V(*v, e)
- case map[int8]int64:
- fastpathTV.EncMapInt8Int64V(v, e)
- case *map[int8]int64:
- fastpathTV.EncMapInt8Int64V(*v, e)
- case map[int8]float32:
- fastpathTV.EncMapInt8Float32V(v, e)
- case *map[int8]float32:
- fastpathTV.EncMapInt8Float32V(*v, e)
- case map[int8]float64:
- fastpathTV.EncMapInt8Float64V(v, e)
- case *map[int8]float64:
- fastpathTV.EncMapInt8Float64V(*v, e)
- case map[int8]bool:
- fastpathTV.EncMapInt8BoolV(v, e)
- case *map[int8]bool:
- fastpathTV.EncMapInt8BoolV(*v, e)
- case map[int16]interface{}:
- fastpathTV.EncMapInt16IntfV(v, e)
- case *map[int16]interface{}:
- fastpathTV.EncMapInt16IntfV(*v, e)
- case map[int16]string:
- fastpathTV.EncMapInt16StringV(v, e)
- case *map[int16]string:
- fastpathTV.EncMapInt16StringV(*v, e)
- case map[int16]uint:
- fastpathTV.EncMapInt16UintV(v, e)
- case *map[int16]uint:
- fastpathTV.EncMapInt16UintV(*v, e)
- case map[int16]uint8:
- fastpathTV.EncMapInt16Uint8V(v, e)
- case *map[int16]uint8:
- fastpathTV.EncMapInt16Uint8V(*v, e)
- case map[int16]uint16:
- fastpathTV.EncMapInt16Uint16V(v, e)
- case *map[int16]uint16:
- fastpathTV.EncMapInt16Uint16V(*v, e)
- case map[int16]uint32:
- fastpathTV.EncMapInt16Uint32V(v, e)
- case *map[int16]uint32:
- fastpathTV.EncMapInt16Uint32V(*v, e)
- case map[int16]uint64:
- fastpathTV.EncMapInt16Uint64V(v, e)
- case *map[int16]uint64:
- fastpathTV.EncMapInt16Uint64V(*v, e)
- case map[int16]uintptr:
- fastpathTV.EncMapInt16UintptrV(v, e)
- case *map[int16]uintptr:
- fastpathTV.EncMapInt16UintptrV(*v, e)
- case map[int16]int:
- fastpathTV.EncMapInt16IntV(v, e)
- case *map[int16]int:
- fastpathTV.EncMapInt16IntV(*v, e)
- case map[int16]int8:
- fastpathTV.EncMapInt16Int8V(v, e)
- case *map[int16]int8:
- fastpathTV.EncMapInt16Int8V(*v, e)
- case map[int16]int16:
- fastpathTV.EncMapInt16Int16V(v, e)
- case *map[int16]int16:
- fastpathTV.EncMapInt16Int16V(*v, e)
- case map[int16]int32:
- fastpathTV.EncMapInt16Int32V(v, e)
- case *map[int16]int32:
- fastpathTV.EncMapInt16Int32V(*v, e)
- case map[int16]int64:
- fastpathTV.EncMapInt16Int64V(v, e)
- case *map[int16]int64:
- fastpathTV.EncMapInt16Int64V(*v, e)
- case map[int16]float32:
- fastpathTV.EncMapInt16Float32V(v, e)
- case *map[int16]float32:
- fastpathTV.EncMapInt16Float32V(*v, e)
- case map[int16]float64:
- fastpathTV.EncMapInt16Float64V(v, e)
- case *map[int16]float64:
- fastpathTV.EncMapInt16Float64V(*v, e)
- case map[int16]bool:
- fastpathTV.EncMapInt16BoolV(v, e)
- case *map[int16]bool:
- fastpathTV.EncMapInt16BoolV(*v, e)
- case map[int32]interface{}:
- fastpathTV.EncMapInt32IntfV(v, e)
- case *map[int32]interface{}:
- fastpathTV.EncMapInt32IntfV(*v, e)
- case map[int32]string:
- fastpathTV.EncMapInt32StringV(v, e)
- case *map[int32]string:
- fastpathTV.EncMapInt32StringV(*v, e)
- case map[int32]uint:
- fastpathTV.EncMapInt32UintV(v, e)
- case *map[int32]uint:
- fastpathTV.EncMapInt32UintV(*v, e)
- case map[int32]uint8:
- fastpathTV.EncMapInt32Uint8V(v, e)
- case *map[int32]uint8:
- fastpathTV.EncMapInt32Uint8V(*v, e)
- case map[int32]uint16:
- fastpathTV.EncMapInt32Uint16V(v, e)
- case *map[int32]uint16:
- fastpathTV.EncMapInt32Uint16V(*v, e)
- case map[int32]uint32:
- fastpathTV.EncMapInt32Uint32V(v, e)
- case *map[int32]uint32:
- fastpathTV.EncMapInt32Uint32V(*v, e)
- case map[int32]uint64:
- fastpathTV.EncMapInt32Uint64V(v, e)
- case *map[int32]uint64:
- fastpathTV.EncMapInt32Uint64V(*v, e)
- case map[int32]uintptr:
- fastpathTV.EncMapInt32UintptrV(v, e)
- case *map[int32]uintptr:
- fastpathTV.EncMapInt32UintptrV(*v, e)
- case map[int32]int:
- fastpathTV.EncMapInt32IntV(v, e)
- case *map[int32]int:
- fastpathTV.EncMapInt32IntV(*v, e)
- case map[int32]int8:
- fastpathTV.EncMapInt32Int8V(v, e)
- case *map[int32]int8:
- fastpathTV.EncMapInt32Int8V(*v, e)
- case map[int32]int16:
- fastpathTV.EncMapInt32Int16V(v, e)
- case *map[int32]int16:
- fastpathTV.EncMapInt32Int16V(*v, e)
- case map[int32]int32:
- fastpathTV.EncMapInt32Int32V(v, e)
- case *map[int32]int32:
- fastpathTV.EncMapInt32Int32V(*v, e)
- case map[int32]int64:
- fastpathTV.EncMapInt32Int64V(v, e)
- case *map[int32]int64:
- fastpathTV.EncMapInt32Int64V(*v, e)
- case map[int32]float32:
- fastpathTV.EncMapInt32Float32V(v, e)
- case *map[int32]float32:
- fastpathTV.EncMapInt32Float32V(*v, e)
- case map[int32]float64:
- fastpathTV.EncMapInt32Float64V(v, e)
- case *map[int32]float64:
- fastpathTV.EncMapInt32Float64V(*v, e)
- case map[int32]bool:
- fastpathTV.EncMapInt32BoolV(v, e)
- case *map[int32]bool:
- fastpathTV.EncMapInt32BoolV(*v, e)
case map[int64]interface{}:
fastpathTV.EncMapInt64IntfV(v, e)
case *map[int64]interface{}:
@@ -1341,6 +507,10 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool {
fastpathTV.EncMapInt64StringV(v, e)
case *map[int64]string:
fastpathTV.EncMapInt64StringV(*v, e)
+ case map[int64][]byte:
+ fastpathTV.EncMapInt64BytesV(v, e)
+ case *map[int64][]byte:
+ fastpathTV.EncMapInt64BytesV(*v, e)
case map[int64]uint:
fastpathTV.EncMapInt64UintV(v, e)
case *map[int64]uint:
@@ -1349,14 +519,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool {
fastpathTV.EncMapInt64Uint8V(v, e)
case *map[int64]uint8:
fastpathTV.EncMapInt64Uint8V(*v, e)
- case map[int64]uint16:
- fastpathTV.EncMapInt64Uint16V(v, e)
- case *map[int64]uint16:
- fastpathTV.EncMapInt64Uint16V(*v, e)
- case map[int64]uint32:
- fastpathTV.EncMapInt64Uint32V(v, e)
- case *map[int64]uint32:
- fastpathTV.EncMapInt64Uint32V(*v, e)
case map[int64]uint64:
fastpathTV.EncMapInt64Uint64V(v, e)
case *map[int64]uint64:
@@ -1369,18 +531,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool {
fastpathTV.EncMapInt64IntV(v, e)
case *map[int64]int:
fastpathTV.EncMapInt64IntV(*v, e)
- case map[int64]int8:
- fastpathTV.EncMapInt64Int8V(v, e)
- case *map[int64]int8:
- fastpathTV.EncMapInt64Int8V(*v, e)
- case map[int64]int16:
- fastpathTV.EncMapInt64Int16V(v, e)
- case *map[int64]int16:
- fastpathTV.EncMapInt64Int16V(*v, e)
- case map[int64]int32:
- fastpathTV.EncMapInt64Int32V(v, e)
- case *map[int64]int32:
- fastpathTV.EncMapInt64Int32V(*v, e)
case map[int64]int64:
fastpathTV.EncMapInt64Int64V(v, e)
case *map[int64]int64:
@@ -1397,70 +547,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool {
fastpathTV.EncMapInt64BoolV(v, e)
case *map[int64]bool:
fastpathTV.EncMapInt64BoolV(*v, e)
- case map[bool]interface{}:
- fastpathTV.EncMapBoolIntfV(v, e)
- case *map[bool]interface{}:
- fastpathTV.EncMapBoolIntfV(*v, e)
- case map[bool]string:
- fastpathTV.EncMapBoolStringV(v, e)
- case *map[bool]string:
- fastpathTV.EncMapBoolStringV(*v, e)
- case map[bool]uint:
- fastpathTV.EncMapBoolUintV(v, e)
- case *map[bool]uint:
- fastpathTV.EncMapBoolUintV(*v, e)
- case map[bool]uint8:
- fastpathTV.EncMapBoolUint8V(v, e)
- case *map[bool]uint8:
- fastpathTV.EncMapBoolUint8V(*v, e)
- case map[bool]uint16:
- fastpathTV.EncMapBoolUint16V(v, e)
- case *map[bool]uint16:
- fastpathTV.EncMapBoolUint16V(*v, e)
- case map[bool]uint32:
- fastpathTV.EncMapBoolUint32V(v, e)
- case *map[bool]uint32:
- fastpathTV.EncMapBoolUint32V(*v, e)
- case map[bool]uint64:
- fastpathTV.EncMapBoolUint64V(v, e)
- case *map[bool]uint64:
- fastpathTV.EncMapBoolUint64V(*v, e)
- case map[bool]uintptr:
- fastpathTV.EncMapBoolUintptrV(v, e)
- case *map[bool]uintptr:
- fastpathTV.EncMapBoolUintptrV(*v, e)
- case map[bool]int:
- fastpathTV.EncMapBoolIntV(v, e)
- case *map[bool]int:
- fastpathTV.EncMapBoolIntV(*v, e)
- case map[bool]int8:
- fastpathTV.EncMapBoolInt8V(v, e)
- case *map[bool]int8:
- fastpathTV.EncMapBoolInt8V(*v, e)
- case map[bool]int16:
- fastpathTV.EncMapBoolInt16V(v, e)
- case *map[bool]int16:
- fastpathTV.EncMapBoolInt16V(*v, e)
- case map[bool]int32:
- fastpathTV.EncMapBoolInt32V(v, e)
- case *map[bool]int32:
- fastpathTV.EncMapBoolInt32V(*v, e)
- case map[bool]int64:
- fastpathTV.EncMapBoolInt64V(v, e)
- case *map[bool]int64:
- fastpathTV.EncMapBoolInt64V(*v, e)
- case map[bool]float32:
- fastpathTV.EncMapBoolFloat32V(v, e)
- case *map[bool]float32:
- fastpathTV.EncMapBoolFloat32V(*v, e)
- case map[bool]float64:
- fastpathTV.EncMapBoolFloat64V(v, e)
- case *map[bool]float64:
- fastpathTV.EncMapBoolFloat64V(*v, e)
- case map[bool]bool:
- fastpathTV.EncMapBoolBoolV(v, e)
- case *map[bool]bool:
- fastpathTV.EncMapBoolBoolV(*v, e)
default:
_ = v // workaround https://github.com/golang/go/issues/12927 seen in go1.4
@@ -1478,47 +564,35 @@ func (e *Encoder) fastpathEncSliceIntfR(f *codecFnInfo, rv reflect.Value) {
fastpathTV.EncSliceIntfV(rv2i(rv).([]interface{}), e)
}
}
-func (_ fastpathT) EncSliceIntfV(v []interface{}, e *Encoder) {
+func (fastpathT) EncSliceIntfV(v []interface{}, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteArrayStart(len(v))
- if esep {
- for _, v2 := range v {
- ee.WriteArrayElem()
- e.encode(v2)
- }
- } else {
- for _, v2 := range v {
- e.encode(v2)
- }
+ e.arrayStart(len(v))
+ for j := range v {
+ e.arrayElem()
+ e.encode(v[j])
}
- ee.WriteArrayEnd()
+ e.arrayEnd()
}
-func (_ fastpathT) EncAsMapSliceIntfV(v []interface{}, e *Encoder) {
- ee, esep := e.e, e.hh.hasElemSeparators()
- if len(v)%2 == 1 {
+func (fastpathT) EncAsMapSliceIntfV(v []interface{}, e *Encoder) {
+ if v == nil {
+ e.e.EncodeNil()
+ } else if len(v)%2 == 1 {
e.errorf(fastpathMapBySliceErrMsg, len(v))
- return
- }
- ee.WriteMapStart(len(v) / 2)
- if esep {
- for j, v2 := range v {
+ } else {
+ e.mapStart(len(v) / 2)
+ for j := range v {
if j%2 == 0 {
- ee.WriteMapElemKey()
+ e.mapElemKey()
} else {
- ee.WriteMapElemValue()
+ e.mapElemValue()
}
- e.encode(v2)
- }
- } else {
- for _, v2 := range v {
- e.encode(v2)
+ e.encode(v[j])
}
+ e.mapEnd()
}
- ee.WriteMapEnd()
}
func (e *Encoder) fastpathEncSliceStringR(f *codecFnInfo, rv reflect.Value) {
@@ -1528,47 +602,81 @@ func (e *Encoder) fastpathEncSliceStringR(f *codecFnInfo, rv reflect.Value) {
fastpathTV.EncSliceStringV(rv2i(rv).([]string), e)
}
}
-func (_ fastpathT) EncSliceStringV(v []string, e *Encoder) {
+func (fastpathT) EncSliceStringV(v []string, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteArrayStart(len(v))
- if esep {
- for _, v2 := range v {
- ee.WriteArrayElem()
- ee.EncodeStringEnc(cUTF8, v2)
+ e.arrayStart(len(v))
+ for j := range v {
+ e.arrayElem()
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(v[j]))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, v[j])
}
+ }
+ e.arrayEnd()
+}
+func (fastpathT) EncAsMapSliceStringV(v []string, e *Encoder) {
+ if v == nil {
+ e.e.EncodeNil()
+ } else if len(v)%2 == 1 {
+ e.errorf(fastpathMapBySliceErrMsg, len(v))
} else {
- for _, v2 := range v {
- ee.EncodeStringEnc(cUTF8, v2)
+ e.mapStart(len(v) / 2)
+ for j := range v {
+ if j%2 == 0 {
+ e.mapElemKey()
+ } else {
+ e.mapElemValue()
+ }
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(v[j]))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, v[j])
+ }
}
+ e.mapEnd()
}
- ee.WriteArrayEnd()
}
-func (_ fastpathT) EncAsMapSliceStringV(v []string, e *Encoder) {
- ee, esep := e.e, e.hh.hasElemSeparators()
- if len(v)%2 == 1 {
- e.errorf(fastpathMapBySliceErrMsg, len(v))
+
+func (e *Encoder) fastpathEncSliceBytesR(f *codecFnInfo, rv reflect.Value) {
+ if f.ti.mbs {
+ fastpathTV.EncAsMapSliceBytesV(rv2i(rv).([][]byte), e)
+ } else {
+ fastpathTV.EncSliceBytesV(rv2i(rv).([][]byte), e)
+ }
+}
+func (fastpathT) EncSliceBytesV(v [][]byte, e *Encoder) {
+ if v == nil {
+ e.e.EncodeNil()
return
}
- ee.WriteMapStart(len(v) / 2)
- if esep {
- for j, v2 := range v {
+ e.arrayStart(len(v))
+ for j := range v {
+ e.arrayElem()
+ e.e.EncodeStringBytesRaw(v[j])
+ }
+ e.arrayEnd()
+}
+func (fastpathT) EncAsMapSliceBytesV(v [][]byte, e *Encoder) {
+ if v == nil {
+ e.e.EncodeNil()
+ } else if len(v)%2 == 1 {
+ e.errorf(fastpathMapBySliceErrMsg, len(v))
+ } else {
+ e.mapStart(len(v) / 2)
+ for j := range v {
if j%2 == 0 {
- ee.WriteMapElemKey()
+ e.mapElemKey()
} else {
- ee.WriteMapElemValue()
+ e.mapElemValue()
}
- ee.EncodeStringEnc(cUTF8, v2)
- }
- } else {
- for _, v2 := range v {
- ee.EncodeStringEnc(cUTF8, v2)
+ e.e.EncodeStringBytesRaw(v[j])
}
+ e.mapEnd()
}
- ee.WriteMapEnd()
}
func (e *Encoder) fastpathEncSliceFloat32R(f *codecFnInfo, rv reflect.Value) {
@@ -1578,47 +686,35 @@ func (e *Encoder) fastpathEncSliceFloat32R(f *codecFnInfo, rv reflect.Value) {
fastpathTV.EncSliceFloat32V(rv2i(rv).([]float32), e)
}
}
-func (_ fastpathT) EncSliceFloat32V(v []float32, e *Encoder) {
+func (fastpathT) EncSliceFloat32V(v []float32, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteArrayStart(len(v))
- if esep {
- for _, v2 := range v {
- ee.WriteArrayElem()
- ee.EncodeFloat32(v2)
- }
- } else {
- for _, v2 := range v {
- ee.EncodeFloat32(v2)
- }
+ e.arrayStart(len(v))
+ for j := range v {
+ e.arrayElem()
+ e.e.EncodeFloat32(v[j])
}
- ee.WriteArrayEnd()
+ e.arrayEnd()
}
-func (_ fastpathT) EncAsMapSliceFloat32V(v []float32, e *Encoder) {
- ee, esep := e.e, e.hh.hasElemSeparators()
- if len(v)%2 == 1 {
+func (fastpathT) EncAsMapSliceFloat32V(v []float32, e *Encoder) {
+ if v == nil {
+ e.e.EncodeNil()
+ } else if len(v)%2 == 1 {
e.errorf(fastpathMapBySliceErrMsg, len(v))
- return
- }
- ee.WriteMapStart(len(v) / 2)
- if esep {
- for j, v2 := range v {
+ } else {
+ e.mapStart(len(v) / 2)
+ for j := range v {
if j%2 == 0 {
- ee.WriteMapElemKey()
+ e.mapElemKey()
} else {
- ee.WriteMapElemValue()
+ e.mapElemValue()
}
- ee.EncodeFloat32(v2)
- }
- } else {
- for _, v2 := range v {
- ee.EncodeFloat32(v2)
+ e.e.EncodeFloat32(v[j])
}
+ e.mapEnd()
}
- ee.WriteMapEnd()
}
func (e *Encoder) fastpathEncSliceFloat64R(f *codecFnInfo, rv reflect.Value) {
@@ -1628,47 +724,35 @@ func (e *Encoder) fastpathEncSliceFloat64R(f *codecFnInfo, rv reflect.Value) {
fastpathTV.EncSliceFloat64V(rv2i(rv).([]float64), e)
}
}
-func (_ fastpathT) EncSliceFloat64V(v []float64, e *Encoder) {
+func (fastpathT) EncSliceFloat64V(v []float64, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteArrayStart(len(v))
- if esep {
- for _, v2 := range v {
- ee.WriteArrayElem()
- ee.EncodeFloat64(v2)
- }
- } else {
- for _, v2 := range v {
- ee.EncodeFloat64(v2)
- }
+ e.arrayStart(len(v))
+ for j := range v {
+ e.arrayElem()
+ e.e.EncodeFloat64(v[j])
}
- ee.WriteArrayEnd()
+ e.arrayEnd()
}
-func (_ fastpathT) EncAsMapSliceFloat64V(v []float64, e *Encoder) {
- ee, esep := e.e, e.hh.hasElemSeparators()
- if len(v)%2 == 1 {
+func (fastpathT) EncAsMapSliceFloat64V(v []float64, e *Encoder) {
+ if v == nil {
+ e.e.EncodeNil()
+ } else if len(v)%2 == 1 {
e.errorf(fastpathMapBySliceErrMsg, len(v))
- return
- }
- ee.WriteMapStart(len(v) / 2)
- if esep {
- for j, v2 := range v {
+ } else {
+ e.mapStart(len(v) / 2)
+ for j := range v {
if j%2 == 0 {
- ee.WriteMapElemKey()
+ e.mapElemKey()
} else {
- ee.WriteMapElemValue()
+ e.mapElemValue()
}
- ee.EncodeFloat64(v2)
- }
- } else {
- for _, v2 := range v {
- ee.EncodeFloat64(v2)
+ e.e.EncodeFloat64(v[j])
}
+ e.mapEnd()
}
- ee.WriteMapEnd()
}
func (e *Encoder) fastpathEncSliceUintR(f *codecFnInfo, rv reflect.Value) {
@@ -1678,47 +762,35 @@ func (e *Encoder) fastpathEncSliceUintR(f *codecFnInfo, rv reflect.Value) {
fastpathTV.EncSliceUintV(rv2i(rv).([]uint), e)
}
}
-func (_ fastpathT) EncSliceUintV(v []uint, e *Encoder) {
+func (fastpathT) EncSliceUintV(v []uint, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteArrayStart(len(v))
- if esep {
- for _, v2 := range v {
- ee.WriteArrayElem()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for _, v2 := range v {
- ee.EncodeUint(uint64(v2))
- }
+ e.arrayStart(len(v))
+ for j := range v {
+ e.arrayElem()
+ e.e.EncodeUint(uint64(v[j]))
}
- ee.WriteArrayEnd()
+ e.arrayEnd()
}
-func (_ fastpathT) EncAsMapSliceUintV(v []uint, e *Encoder) {
- ee, esep := e.e, e.hh.hasElemSeparators()
- if len(v)%2 == 1 {
+func (fastpathT) EncAsMapSliceUintV(v []uint, e *Encoder) {
+ if v == nil {
+ e.e.EncodeNil()
+ } else if len(v)%2 == 1 {
e.errorf(fastpathMapBySliceErrMsg, len(v))
- return
- }
- ee.WriteMapStart(len(v) / 2)
- if esep {
- for j, v2 := range v {
+ } else {
+ e.mapStart(len(v) / 2)
+ for j := range v {
if j%2 == 0 {
- ee.WriteMapElemKey()
+ e.mapElemKey()
} else {
- ee.WriteMapElemValue()
+ e.mapElemValue()
}
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for _, v2 := range v {
- ee.EncodeUint(uint64(v2))
+ e.e.EncodeUint(uint64(v[j]))
}
+ e.mapEnd()
}
- ee.WriteMapEnd()
}
func (e *Encoder) fastpathEncSliceUint8R(f *codecFnInfo, rv reflect.Value) {
@@ -1728,47 +800,35 @@ func (e *Encoder) fastpathEncSliceUint8R(f *codecFnInfo, rv reflect.Value) {
fastpathTV.EncSliceUint8V(rv2i(rv).([]uint8), e)
}
}
-func (_ fastpathT) EncSliceUint8V(v []uint8, e *Encoder) {
+func (fastpathT) EncSliceUint8V(v []uint8, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteArrayStart(len(v))
- if esep {
- for _, v2 := range v {
- ee.WriteArrayElem()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for _, v2 := range v {
- ee.EncodeUint(uint64(v2))
- }
+ e.arrayStart(len(v))
+ for j := range v {
+ e.arrayElem()
+ e.e.EncodeUint(uint64(v[j]))
}
- ee.WriteArrayEnd()
+ e.arrayEnd()
}
-func (_ fastpathT) EncAsMapSliceUint8V(v []uint8, e *Encoder) {
- ee, esep := e.e, e.hh.hasElemSeparators()
- if len(v)%2 == 1 {
+func (fastpathT) EncAsMapSliceUint8V(v []uint8, e *Encoder) {
+ if v == nil {
+ e.e.EncodeNil()
+ } else if len(v)%2 == 1 {
e.errorf(fastpathMapBySliceErrMsg, len(v))
- return
- }
- ee.WriteMapStart(len(v) / 2)
- if esep {
- for j, v2 := range v {
+ } else {
+ e.mapStart(len(v) / 2)
+ for j := range v {
if j%2 == 0 {
- ee.WriteMapElemKey()
+ e.mapElemKey()
} else {
- ee.WriteMapElemValue()
+ e.mapElemValue()
}
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for _, v2 := range v {
- ee.EncodeUint(uint64(v2))
+ e.e.EncodeUint(uint64(v[j]))
}
+ e.mapEnd()
}
- ee.WriteMapEnd()
}
func (e *Encoder) fastpathEncSliceUint16R(f *codecFnInfo, rv reflect.Value) {
@@ -1778,47 +838,35 @@ func (e *Encoder) fastpathEncSliceUint16R(f *codecFnInfo, rv reflect.Value) {
fastpathTV.EncSliceUint16V(rv2i(rv).([]uint16), e)
}
}
-func (_ fastpathT) EncSliceUint16V(v []uint16, e *Encoder) {
+func (fastpathT) EncSliceUint16V(v []uint16, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteArrayStart(len(v))
- if esep {
- for _, v2 := range v {
- ee.WriteArrayElem()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for _, v2 := range v {
- ee.EncodeUint(uint64(v2))
- }
+ e.arrayStart(len(v))
+ for j := range v {
+ e.arrayElem()
+ e.e.EncodeUint(uint64(v[j]))
}
- ee.WriteArrayEnd()
+ e.arrayEnd()
}
-func (_ fastpathT) EncAsMapSliceUint16V(v []uint16, e *Encoder) {
- ee, esep := e.e, e.hh.hasElemSeparators()
- if len(v)%2 == 1 {
+func (fastpathT) EncAsMapSliceUint16V(v []uint16, e *Encoder) {
+ if v == nil {
+ e.e.EncodeNil()
+ } else if len(v)%2 == 1 {
e.errorf(fastpathMapBySliceErrMsg, len(v))
- return
- }
- ee.WriteMapStart(len(v) / 2)
- if esep {
- for j, v2 := range v {
+ } else {
+ e.mapStart(len(v) / 2)
+ for j := range v {
if j%2 == 0 {
- ee.WriteMapElemKey()
+ e.mapElemKey()
} else {
- ee.WriteMapElemValue()
+ e.mapElemValue()
}
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for _, v2 := range v {
- ee.EncodeUint(uint64(v2))
+ e.e.EncodeUint(uint64(v[j]))
}
+ e.mapEnd()
}
- ee.WriteMapEnd()
}
func (e *Encoder) fastpathEncSliceUint32R(f *codecFnInfo, rv reflect.Value) {
@@ -1828,47 +876,35 @@ func (e *Encoder) fastpathEncSliceUint32R(f *codecFnInfo, rv reflect.Value) {
fastpathTV.EncSliceUint32V(rv2i(rv).([]uint32), e)
}
}
-func (_ fastpathT) EncSliceUint32V(v []uint32, e *Encoder) {
+func (fastpathT) EncSliceUint32V(v []uint32, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteArrayStart(len(v))
- if esep {
- for _, v2 := range v {
- ee.WriteArrayElem()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for _, v2 := range v {
- ee.EncodeUint(uint64(v2))
- }
+ e.arrayStart(len(v))
+ for j := range v {
+ e.arrayElem()
+ e.e.EncodeUint(uint64(v[j]))
}
- ee.WriteArrayEnd()
+ e.arrayEnd()
}
-func (_ fastpathT) EncAsMapSliceUint32V(v []uint32, e *Encoder) {
- ee, esep := e.e, e.hh.hasElemSeparators()
- if len(v)%2 == 1 {
+func (fastpathT) EncAsMapSliceUint32V(v []uint32, e *Encoder) {
+ if v == nil {
+ e.e.EncodeNil()
+ } else if len(v)%2 == 1 {
e.errorf(fastpathMapBySliceErrMsg, len(v))
- return
- }
- ee.WriteMapStart(len(v) / 2)
- if esep {
- for j, v2 := range v {
+ } else {
+ e.mapStart(len(v) / 2)
+ for j := range v {
if j%2 == 0 {
- ee.WriteMapElemKey()
+ e.mapElemKey()
} else {
- ee.WriteMapElemValue()
+ e.mapElemValue()
}
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for _, v2 := range v {
- ee.EncodeUint(uint64(v2))
+ e.e.EncodeUint(uint64(v[j]))
}
+ e.mapEnd()
}
- ee.WriteMapEnd()
}
func (e *Encoder) fastpathEncSliceUint64R(f *codecFnInfo, rv reflect.Value) {
@@ -1878,47 +914,35 @@ func (e *Encoder) fastpathEncSliceUint64R(f *codecFnInfo, rv reflect.Value) {
fastpathTV.EncSliceUint64V(rv2i(rv).([]uint64), e)
}
}
-func (_ fastpathT) EncSliceUint64V(v []uint64, e *Encoder) {
+func (fastpathT) EncSliceUint64V(v []uint64, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteArrayStart(len(v))
- if esep {
- for _, v2 := range v {
- ee.WriteArrayElem()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for _, v2 := range v {
- ee.EncodeUint(uint64(v2))
- }
+ e.arrayStart(len(v))
+ for j := range v {
+ e.arrayElem()
+ e.e.EncodeUint(v[j])
}
- ee.WriteArrayEnd()
+ e.arrayEnd()
}
-func (_ fastpathT) EncAsMapSliceUint64V(v []uint64, e *Encoder) {
- ee, esep := e.e, e.hh.hasElemSeparators()
- if len(v)%2 == 1 {
+func (fastpathT) EncAsMapSliceUint64V(v []uint64, e *Encoder) {
+ if v == nil {
+ e.e.EncodeNil()
+ } else if len(v)%2 == 1 {
e.errorf(fastpathMapBySliceErrMsg, len(v))
- return
- }
- ee.WriteMapStart(len(v) / 2)
- if esep {
- for j, v2 := range v {
+ } else {
+ e.mapStart(len(v) / 2)
+ for j := range v {
if j%2 == 0 {
- ee.WriteMapElemKey()
+ e.mapElemKey()
} else {
- ee.WriteMapElemValue()
+ e.mapElemValue()
}
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for _, v2 := range v {
- ee.EncodeUint(uint64(v2))
+ e.e.EncodeUint(v[j])
}
+ e.mapEnd()
}
- ee.WriteMapEnd()
}
func (e *Encoder) fastpathEncSliceUintptrR(f *codecFnInfo, rv reflect.Value) {
@@ -1928,47 +952,35 @@ func (e *Encoder) fastpathEncSliceUintptrR(f *codecFnInfo, rv reflect.Value) {
fastpathTV.EncSliceUintptrV(rv2i(rv).([]uintptr), e)
}
}
-func (_ fastpathT) EncSliceUintptrV(v []uintptr, e *Encoder) {
+func (fastpathT) EncSliceUintptrV(v []uintptr, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteArrayStart(len(v))
- if esep {
- for _, v2 := range v {
- ee.WriteArrayElem()
- e.encode(v2)
- }
- } else {
- for _, v2 := range v {
- e.encode(v2)
- }
+ e.arrayStart(len(v))
+ for j := range v {
+ e.arrayElem()
+ e.encode(v[j])
}
- ee.WriteArrayEnd()
+ e.arrayEnd()
}
-func (_ fastpathT) EncAsMapSliceUintptrV(v []uintptr, e *Encoder) {
- ee, esep := e.e, e.hh.hasElemSeparators()
- if len(v)%2 == 1 {
+func (fastpathT) EncAsMapSliceUintptrV(v []uintptr, e *Encoder) {
+ if v == nil {
+ e.e.EncodeNil()
+ } else if len(v)%2 == 1 {
e.errorf(fastpathMapBySliceErrMsg, len(v))
- return
- }
- ee.WriteMapStart(len(v) / 2)
- if esep {
- for j, v2 := range v {
+ } else {
+ e.mapStart(len(v) / 2)
+ for j := range v {
if j%2 == 0 {
- ee.WriteMapElemKey()
+ e.mapElemKey()
} else {
- ee.WriteMapElemValue()
+ e.mapElemValue()
}
- e.encode(v2)
- }
- } else {
- for _, v2 := range v {
- e.encode(v2)
+ e.encode(v[j])
}
+ e.mapEnd()
}
- ee.WriteMapEnd()
}
func (e *Encoder) fastpathEncSliceIntR(f *codecFnInfo, rv reflect.Value) {
@@ -1978,47 +990,35 @@ func (e *Encoder) fastpathEncSliceIntR(f *codecFnInfo, rv reflect.Value) {
fastpathTV.EncSliceIntV(rv2i(rv).([]int), e)
}
}
-func (_ fastpathT) EncSliceIntV(v []int, e *Encoder) {
+func (fastpathT) EncSliceIntV(v []int, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteArrayStart(len(v))
- if esep {
- for _, v2 := range v {
- ee.WriteArrayElem()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for _, v2 := range v {
- ee.EncodeInt(int64(v2))
- }
+ e.arrayStart(len(v))
+ for j := range v {
+ e.arrayElem()
+ e.e.EncodeInt(int64(v[j]))
}
- ee.WriteArrayEnd()
+ e.arrayEnd()
}
-func (_ fastpathT) EncAsMapSliceIntV(v []int, e *Encoder) {
- ee, esep := e.e, e.hh.hasElemSeparators()
- if len(v)%2 == 1 {
+func (fastpathT) EncAsMapSliceIntV(v []int, e *Encoder) {
+ if v == nil {
+ e.e.EncodeNil()
+ } else if len(v)%2 == 1 {
e.errorf(fastpathMapBySliceErrMsg, len(v))
- return
- }
- ee.WriteMapStart(len(v) / 2)
- if esep {
- for j, v2 := range v {
+ } else {
+ e.mapStart(len(v) / 2)
+ for j := range v {
if j%2 == 0 {
- ee.WriteMapElemKey()
+ e.mapElemKey()
} else {
- ee.WriteMapElemValue()
+ e.mapElemValue()
}
- ee.EncodeInt(int64(v2))
- }
- } else {
- for _, v2 := range v {
- ee.EncodeInt(int64(v2))
+ e.e.EncodeInt(int64(v[j]))
}
+ e.mapEnd()
}
- ee.WriteMapEnd()
}
func (e *Encoder) fastpathEncSliceInt8R(f *codecFnInfo, rv reflect.Value) {
@@ -2028,47 +1028,35 @@ func (e *Encoder) fastpathEncSliceInt8R(f *codecFnInfo, rv reflect.Value) {
fastpathTV.EncSliceInt8V(rv2i(rv).([]int8), e)
}
}
-func (_ fastpathT) EncSliceInt8V(v []int8, e *Encoder) {
+func (fastpathT) EncSliceInt8V(v []int8, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteArrayStart(len(v))
- if esep {
- for _, v2 := range v {
- ee.WriteArrayElem()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for _, v2 := range v {
- ee.EncodeInt(int64(v2))
- }
+ e.arrayStart(len(v))
+ for j := range v {
+ e.arrayElem()
+ e.e.EncodeInt(int64(v[j]))
}
- ee.WriteArrayEnd()
+ e.arrayEnd()
}
-func (_ fastpathT) EncAsMapSliceInt8V(v []int8, e *Encoder) {
- ee, esep := e.e, e.hh.hasElemSeparators()
- if len(v)%2 == 1 {
+func (fastpathT) EncAsMapSliceInt8V(v []int8, e *Encoder) {
+ if v == nil {
+ e.e.EncodeNil()
+ } else if len(v)%2 == 1 {
e.errorf(fastpathMapBySliceErrMsg, len(v))
- return
- }
- ee.WriteMapStart(len(v) / 2)
- if esep {
- for j, v2 := range v {
+ } else {
+ e.mapStart(len(v) / 2)
+ for j := range v {
if j%2 == 0 {
- ee.WriteMapElemKey()
+ e.mapElemKey()
} else {
- ee.WriteMapElemValue()
+ e.mapElemValue()
}
- ee.EncodeInt(int64(v2))
- }
- } else {
- for _, v2 := range v {
- ee.EncodeInt(int64(v2))
+ e.e.EncodeInt(int64(v[j]))
}
+ e.mapEnd()
}
- ee.WriteMapEnd()
}
func (e *Encoder) fastpathEncSliceInt16R(f *codecFnInfo, rv reflect.Value) {
@@ -2078,47 +1066,35 @@ func (e *Encoder) fastpathEncSliceInt16R(f *codecFnInfo, rv reflect.Value) {
fastpathTV.EncSliceInt16V(rv2i(rv).([]int16), e)
}
}
-func (_ fastpathT) EncSliceInt16V(v []int16, e *Encoder) {
+func (fastpathT) EncSliceInt16V(v []int16, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteArrayStart(len(v))
- if esep {
- for _, v2 := range v {
- ee.WriteArrayElem()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for _, v2 := range v {
- ee.EncodeInt(int64(v2))
- }
+ e.arrayStart(len(v))
+ for j := range v {
+ e.arrayElem()
+ e.e.EncodeInt(int64(v[j]))
}
- ee.WriteArrayEnd()
+ e.arrayEnd()
}
-func (_ fastpathT) EncAsMapSliceInt16V(v []int16, e *Encoder) {
- ee, esep := e.e, e.hh.hasElemSeparators()
- if len(v)%2 == 1 {
+func (fastpathT) EncAsMapSliceInt16V(v []int16, e *Encoder) {
+ if v == nil {
+ e.e.EncodeNil()
+ } else if len(v)%2 == 1 {
e.errorf(fastpathMapBySliceErrMsg, len(v))
- return
- }
- ee.WriteMapStart(len(v) / 2)
- if esep {
- for j, v2 := range v {
+ } else {
+ e.mapStart(len(v) / 2)
+ for j := range v {
if j%2 == 0 {
- ee.WriteMapElemKey()
+ e.mapElemKey()
} else {
- ee.WriteMapElemValue()
+ e.mapElemValue()
}
- ee.EncodeInt(int64(v2))
- }
- } else {
- for _, v2 := range v {
- ee.EncodeInt(int64(v2))
+ e.e.EncodeInt(int64(v[j]))
}
+ e.mapEnd()
}
- ee.WriteMapEnd()
}
func (e *Encoder) fastpathEncSliceInt32R(f *codecFnInfo, rv reflect.Value) {
@@ -2128,47 +1104,35 @@ func (e *Encoder) fastpathEncSliceInt32R(f *codecFnInfo, rv reflect.Value) {
fastpathTV.EncSliceInt32V(rv2i(rv).([]int32), e)
}
}
-func (_ fastpathT) EncSliceInt32V(v []int32, e *Encoder) {
+func (fastpathT) EncSliceInt32V(v []int32, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteArrayStart(len(v))
- if esep {
- for _, v2 := range v {
- ee.WriteArrayElem()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for _, v2 := range v {
- ee.EncodeInt(int64(v2))
- }
+ e.arrayStart(len(v))
+ for j := range v {
+ e.arrayElem()
+ e.e.EncodeInt(int64(v[j]))
}
- ee.WriteArrayEnd()
+ e.arrayEnd()
}
-func (_ fastpathT) EncAsMapSliceInt32V(v []int32, e *Encoder) {
- ee, esep := e.e, e.hh.hasElemSeparators()
- if len(v)%2 == 1 {
+func (fastpathT) EncAsMapSliceInt32V(v []int32, e *Encoder) {
+ if v == nil {
+ e.e.EncodeNil()
+ } else if len(v)%2 == 1 {
e.errorf(fastpathMapBySliceErrMsg, len(v))
- return
- }
- ee.WriteMapStart(len(v) / 2)
- if esep {
- for j, v2 := range v {
+ } else {
+ e.mapStart(len(v) / 2)
+ for j := range v {
if j%2 == 0 {
- ee.WriteMapElemKey()
+ e.mapElemKey()
} else {
- ee.WriteMapElemValue()
+ e.mapElemValue()
}
- ee.EncodeInt(int64(v2))
- }
- } else {
- for _, v2 := range v {
- ee.EncodeInt(int64(v2))
+ e.e.EncodeInt(int64(v[j]))
}
+ e.mapEnd()
}
- ee.WriteMapEnd()
}
func (e *Encoder) fastpathEncSliceInt64R(f *codecFnInfo, rv reflect.Value) {
@@ -2178,47 +1142,35 @@ func (e *Encoder) fastpathEncSliceInt64R(f *codecFnInfo, rv reflect.Value) {
fastpathTV.EncSliceInt64V(rv2i(rv).([]int64), e)
}
}
-func (_ fastpathT) EncSliceInt64V(v []int64, e *Encoder) {
+func (fastpathT) EncSliceInt64V(v []int64, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteArrayStart(len(v))
- if esep {
- for _, v2 := range v {
- ee.WriteArrayElem()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for _, v2 := range v {
- ee.EncodeInt(int64(v2))
- }
+ e.arrayStart(len(v))
+ for j := range v {
+ e.arrayElem()
+ e.e.EncodeInt(v[j])
}
- ee.WriteArrayEnd()
+ e.arrayEnd()
}
-func (_ fastpathT) EncAsMapSliceInt64V(v []int64, e *Encoder) {
- ee, esep := e.e, e.hh.hasElemSeparators()
- if len(v)%2 == 1 {
+func (fastpathT) EncAsMapSliceInt64V(v []int64, e *Encoder) {
+ if v == nil {
+ e.e.EncodeNil()
+ } else if len(v)%2 == 1 {
e.errorf(fastpathMapBySliceErrMsg, len(v))
- return
- }
- ee.WriteMapStart(len(v) / 2)
- if esep {
- for j, v2 := range v {
+ } else {
+ e.mapStart(len(v) / 2)
+ for j := range v {
if j%2 == 0 {
- ee.WriteMapElemKey()
+ e.mapElemKey()
} else {
- ee.WriteMapElemValue()
+ e.mapElemValue()
}
- ee.EncodeInt(int64(v2))
- }
- } else {
- for _, v2 := range v {
- ee.EncodeInt(int64(v2))
+ e.e.EncodeInt(v[j])
}
+ e.mapEnd()
}
- ee.WriteMapEnd()
}
func (e *Encoder) fastpathEncSliceBoolR(f *codecFnInfo, rv reflect.Value) {
@@ -2228,28659 +1180,5366 @@ func (e *Encoder) fastpathEncSliceBoolR(f *codecFnInfo, rv reflect.Value) {
fastpathTV.EncSliceBoolV(rv2i(rv).([]bool), e)
}
}
-func (_ fastpathT) EncSliceBoolV(v []bool, e *Encoder) {
+func (fastpathT) EncSliceBoolV(v []bool, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteArrayStart(len(v))
- if esep {
- for _, v2 := range v {
- ee.WriteArrayElem()
- ee.EncodeBool(v2)
- }
- } else {
- for _, v2 := range v {
- ee.EncodeBool(v2)
- }
+ e.arrayStart(len(v))
+ for j := range v {
+ e.arrayElem()
+ e.e.EncodeBool(v[j])
}
- ee.WriteArrayEnd()
+ e.arrayEnd()
}
-func (_ fastpathT) EncAsMapSliceBoolV(v []bool, e *Encoder) {
- ee, esep := e.e, e.hh.hasElemSeparators()
- if len(v)%2 == 1 {
+func (fastpathT) EncAsMapSliceBoolV(v []bool, e *Encoder) {
+ if v == nil {
+ e.e.EncodeNil()
+ } else if len(v)%2 == 1 {
e.errorf(fastpathMapBySliceErrMsg, len(v))
- return
- }
- ee.WriteMapStart(len(v) / 2)
- if esep {
- for j, v2 := range v {
+ } else {
+ e.mapStart(len(v) / 2)
+ for j := range v {
if j%2 == 0 {
- ee.WriteMapElemKey()
+ e.mapElemKey()
} else {
- ee.WriteMapElemValue()
+ e.mapElemValue()
}
- ee.EncodeBool(v2)
- }
- } else {
- for _, v2 := range v {
- ee.EncodeBool(v2)
+ e.e.EncodeBool(v[j])
}
+ e.mapEnd()
}
- ee.WriteMapEnd()
}
-func (e *Encoder) fastpathEncMapIntfIntfR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapIntfIntfV(rv2i(rv).(map[interface{}]interface{}), e)
+func (e *Encoder) fastpathEncMapStringIntfR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapStringIntfV(rv2i(rv).(map[string]interface{}), e)
}
-func (_ fastpathT) EncMapIntfIntfV(v map[interface{}]interface{}, e *Encoder) {
+func (fastpathT) EncMapStringIntfV(v map[string]interface{}, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l uint
- var vp *bytesI
- for k2 := range v {
- l = uint(len(mksv))
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
+ v2 := make([]string, len(v))
+ var i uint
+ for k := range v {
+ v2[i] = k
i++
}
- sort.Sort(bytesISlice(v2))
- if esep {
- for j := range v2 {
- ee.WriteMapElemKey()
- e.asis(v2[j].v)
- ee.WriteMapElemValue()
- e.encode(v[v2[j].i])
- }
- } else {
- for j := range v2 {
- e.asis(v2[j].v)
- e.encode(v[v2[j].i])
+ sort.Sort(stringSlice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(k2))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, k2)
}
+ e.mapElemValue()
+ e.encode(v[k2])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- e.encode(k2)
- ee.WriteMapElemValue()
- e.encode(v2)
- }
- } else {
- for k2, v2 := range v {
- e.encode(k2)
- e.encode(v2)
+ for k2, v2 := range v {
+ e.mapElemKey()
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(k2))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, k2)
}
+ e.mapElemValue()
+ e.encode(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapIntfStringR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapIntfStringV(rv2i(rv).(map[interface{}]string), e)
+func (e *Encoder) fastpathEncMapStringStringR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapStringStringV(rv2i(rv).(map[string]string), e)
}
-func (_ fastpathT) EncMapIntfStringV(v map[interface{}]string, e *Encoder) {
+func (fastpathT) EncMapStringStringV(v map[string]string, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l uint
- var vp *bytesI
- for k2 := range v {
- l = uint(len(mksv))
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
+ v2 := make([]string, len(v))
+ var i uint
+ for k := range v {
+ v2[i] = k
i++
}
- sort.Sort(bytesISlice(v2))
- if esep {
- for j := range v2 {
- ee.WriteMapElemKey()
- e.asis(v2[j].v)
- ee.WriteMapElemValue()
- e.encode(v[v2[j].i])
+ sort.Sort(stringSlice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(k2))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, k2)
}
- } else {
- for j := range v2 {
- e.asis(v2[j].v)
- e.encode(v[v2[j].i])
+ e.mapElemValue()
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(v[k2]))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, v[k2])
}
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- e.encode(k2)
- ee.WriteMapElemValue()
- ee.EncodeStringEnc(cUTF8, v2)
+ for k2, v2 := range v {
+ e.mapElemKey()
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(k2))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, k2)
}
- } else {
- for k2, v2 := range v {
- e.encode(k2)
- ee.EncodeStringEnc(cUTF8, v2)
+ e.mapElemValue()
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(v2))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, v2)
}
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapIntfUintR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapIntfUintV(rv2i(rv).(map[interface{}]uint), e)
+func (e *Encoder) fastpathEncMapStringBytesR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapStringBytesV(rv2i(rv).(map[string][]byte), e)
}
-func (_ fastpathT) EncMapIntfUintV(v map[interface{}]uint, e *Encoder) {
+func (fastpathT) EncMapStringBytesV(v map[string][]byte, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l uint
- var vp *bytesI
- for k2 := range v {
- l = uint(len(mksv))
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
+ v2 := make([]string, len(v))
+ var i uint
+ for k := range v {
+ v2[i] = k
i++
}
- sort.Sort(bytesISlice(v2))
- if esep {
- for j := range v2 {
- ee.WriteMapElemKey()
- e.asis(v2[j].v)
- ee.WriteMapElemValue()
- e.encode(v[v2[j].i])
- }
- } else {
- for j := range v2 {
- e.asis(v2[j].v)
- e.encode(v[v2[j].i])
+ sort.Sort(stringSlice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(k2))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, k2)
}
+ e.mapElemValue()
+ e.e.EncodeStringBytesRaw(v[k2])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- e.encode(k2)
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- e.encode(k2)
- ee.EncodeUint(uint64(v2))
+ for k2, v2 := range v {
+ e.mapElemKey()
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(k2))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, k2)
}
+ e.mapElemValue()
+ e.e.EncodeStringBytesRaw(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapIntfUint8R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapIntfUint8V(rv2i(rv).(map[interface{}]uint8), e)
+func (e *Encoder) fastpathEncMapStringUintR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapStringUintV(rv2i(rv).(map[string]uint), e)
}
-func (_ fastpathT) EncMapIntfUint8V(v map[interface{}]uint8, e *Encoder) {
+func (fastpathT) EncMapStringUintV(v map[string]uint, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l uint
- var vp *bytesI
- for k2 := range v {
- l = uint(len(mksv))
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
+ v2 := make([]string, len(v))
+ var i uint
+ for k := range v {
+ v2[i] = k
i++
}
- sort.Sort(bytesISlice(v2))
- if esep {
- for j := range v2 {
- ee.WriteMapElemKey()
- e.asis(v2[j].v)
- ee.WriteMapElemValue()
- e.encode(v[v2[j].i])
- }
- } else {
- for j := range v2 {
- e.asis(v2[j].v)
- e.encode(v[v2[j].i])
+ sort.Sort(stringSlice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(k2))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, k2)
}
+ e.mapElemValue()
+ e.e.EncodeUint(uint64(v[k2]))
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- e.encode(k2)
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- e.encode(k2)
- ee.EncodeUint(uint64(v2))
+ for k2, v2 := range v {
+ e.mapElemKey()
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(k2))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, k2)
}
+ e.mapElemValue()
+ e.e.EncodeUint(uint64(v2))
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapIntfUint16R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapIntfUint16V(rv2i(rv).(map[interface{}]uint16), e)
+func (e *Encoder) fastpathEncMapStringUint8R(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapStringUint8V(rv2i(rv).(map[string]uint8), e)
}
-func (_ fastpathT) EncMapIntfUint16V(v map[interface{}]uint16, e *Encoder) {
+func (fastpathT) EncMapStringUint8V(v map[string]uint8, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l uint
- var vp *bytesI
- for k2 := range v {
- l = uint(len(mksv))
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
+ v2 := make([]string, len(v))
+ var i uint
+ for k := range v {
+ v2[i] = k
i++
}
- sort.Sort(bytesISlice(v2))
- if esep {
- for j := range v2 {
- ee.WriteMapElemKey()
- e.asis(v2[j].v)
- ee.WriteMapElemValue()
- e.encode(v[v2[j].i])
- }
- } else {
- for j := range v2 {
- e.asis(v2[j].v)
- e.encode(v[v2[j].i])
+ sort.Sort(stringSlice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(k2))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, k2)
}
+ e.mapElemValue()
+ e.e.EncodeUint(uint64(v[k2]))
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- e.encode(k2)
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- e.encode(k2)
- ee.EncodeUint(uint64(v2))
+ for k2, v2 := range v {
+ e.mapElemKey()
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(k2))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, k2)
}
+ e.mapElemValue()
+ e.e.EncodeUint(uint64(v2))
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapIntfUint32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapIntfUint32V(rv2i(rv).(map[interface{}]uint32), e)
+func (e *Encoder) fastpathEncMapStringUint64R(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapStringUint64V(rv2i(rv).(map[string]uint64), e)
}
-func (_ fastpathT) EncMapIntfUint32V(v map[interface{}]uint32, e *Encoder) {
+func (fastpathT) EncMapStringUint64V(v map[string]uint64, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l uint
- var vp *bytesI
- for k2 := range v {
- l = uint(len(mksv))
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
+ v2 := make([]string, len(v))
+ var i uint
+ for k := range v {
+ v2[i] = k
i++
}
- sort.Sort(bytesISlice(v2))
- if esep {
- for j := range v2 {
- ee.WriteMapElemKey()
- e.asis(v2[j].v)
- ee.WriteMapElemValue()
- e.encode(v[v2[j].i])
- }
- } else {
- for j := range v2 {
- e.asis(v2[j].v)
- e.encode(v[v2[j].i])
+ sort.Sort(stringSlice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(k2))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, k2)
}
+ e.mapElemValue()
+ e.e.EncodeUint(v[k2])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- e.encode(k2)
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- e.encode(k2)
- ee.EncodeUint(uint64(v2))
+ for k2, v2 := range v {
+ e.mapElemKey()
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(k2))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, k2)
}
+ e.mapElemValue()
+ e.e.EncodeUint(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapIntfUint64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapIntfUint64V(rv2i(rv).(map[interface{}]uint64), e)
+func (e *Encoder) fastpathEncMapStringUintptrR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapStringUintptrV(rv2i(rv).(map[string]uintptr), e)
}
-func (_ fastpathT) EncMapIntfUint64V(v map[interface{}]uint64, e *Encoder) {
+func (fastpathT) EncMapStringUintptrV(v map[string]uintptr, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l uint
- var vp *bytesI
- for k2 := range v {
- l = uint(len(mksv))
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
+ v2 := make([]string, len(v))
+ var i uint
+ for k := range v {
+ v2[i] = k
i++
}
- sort.Sort(bytesISlice(v2))
- if esep {
- for j := range v2 {
- ee.WriteMapElemKey()
- e.asis(v2[j].v)
- ee.WriteMapElemValue()
- e.encode(v[v2[j].i])
- }
- } else {
- for j := range v2 {
- e.asis(v2[j].v)
- e.encode(v[v2[j].i])
+ sort.Sort(stringSlice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(k2))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, k2)
}
+ e.mapElemValue()
+ e.encode(v[k2])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- e.encode(k2)
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- e.encode(k2)
- ee.EncodeUint(uint64(v2))
+ for k2, v2 := range v {
+ e.mapElemKey()
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(k2))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, k2)
}
+ e.mapElemValue()
+ e.encode(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapIntfUintptrR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapIntfUintptrV(rv2i(rv).(map[interface{}]uintptr), e)
+func (e *Encoder) fastpathEncMapStringIntR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapStringIntV(rv2i(rv).(map[string]int), e)
}
-func (_ fastpathT) EncMapIntfUintptrV(v map[interface{}]uintptr, e *Encoder) {
+func (fastpathT) EncMapStringIntV(v map[string]int, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l uint
- var vp *bytesI
- for k2 := range v {
- l = uint(len(mksv))
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
+ v2 := make([]string, len(v))
+ var i uint
+ for k := range v {
+ v2[i] = k
i++
}
- sort.Sort(bytesISlice(v2))
- if esep {
- for j := range v2 {
- ee.WriteMapElemKey()
- e.asis(v2[j].v)
- ee.WriteMapElemValue()
- e.encode(v[v2[j].i])
- }
- } else {
- for j := range v2 {
- e.asis(v2[j].v)
- e.encode(v[v2[j].i])
+ sort.Sort(stringSlice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(k2))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, k2)
}
+ e.mapElemValue()
+ e.e.EncodeInt(int64(v[k2]))
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- e.encode(k2)
- ee.WriteMapElemValue()
- e.encode(v2)
- }
- } else {
- for k2, v2 := range v {
- e.encode(k2)
- e.encode(v2)
+ for k2, v2 := range v {
+ e.mapElemKey()
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(k2))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, k2)
}
+ e.mapElemValue()
+ e.e.EncodeInt(int64(v2))
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapIntfIntR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapIntfIntV(rv2i(rv).(map[interface{}]int), e)
+func (e *Encoder) fastpathEncMapStringInt64R(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapStringInt64V(rv2i(rv).(map[string]int64), e)
}
-func (_ fastpathT) EncMapIntfIntV(v map[interface{}]int, e *Encoder) {
+func (fastpathT) EncMapStringInt64V(v map[string]int64, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l uint
- var vp *bytesI
- for k2 := range v {
- l = uint(len(mksv))
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
+ v2 := make([]string, len(v))
+ var i uint
+ for k := range v {
+ v2[i] = k
i++
}
- sort.Sort(bytesISlice(v2))
- if esep {
- for j := range v2 {
- ee.WriteMapElemKey()
- e.asis(v2[j].v)
- ee.WriteMapElemValue()
- e.encode(v[v2[j].i])
- }
- } else {
- for j := range v2 {
- e.asis(v2[j].v)
- e.encode(v[v2[j].i])
+ sort.Sort(stringSlice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(k2))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, k2)
}
+ e.mapElemValue()
+ e.e.EncodeInt(v[k2])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- e.encode(k2)
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- e.encode(k2)
- ee.EncodeInt(int64(v2))
+ for k2, v2 := range v {
+ e.mapElemKey()
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(k2))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, k2)
}
+ e.mapElemValue()
+ e.e.EncodeInt(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapIntfInt8R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapIntfInt8V(rv2i(rv).(map[interface{}]int8), e)
+func (e *Encoder) fastpathEncMapStringFloat32R(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapStringFloat32V(rv2i(rv).(map[string]float32), e)
}
-func (_ fastpathT) EncMapIntfInt8V(v map[interface{}]int8, e *Encoder) {
+func (fastpathT) EncMapStringFloat32V(v map[string]float32, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l uint
- var vp *bytesI
- for k2 := range v {
- l = uint(len(mksv))
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
+ v2 := make([]string, len(v))
+ var i uint
+ for k := range v {
+ v2[i] = k
i++
}
- sort.Sort(bytesISlice(v2))
- if esep {
- for j := range v2 {
- ee.WriteMapElemKey()
- e.asis(v2[j].v)
- ee.WriteMapElemValue()
- e.encode(v[v2[j].i])
- }
- } else {
- for j := range v2 {
- e.asis(v2[j].v)
- e.encode(v[v2[j].i])
+ sort.Sort(stringSlice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(k2))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, k2)
}
+ e.mapElemValue()
+ e.e.EncodeFloat32(v[k2])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- e.encode(k2)
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- e.encode(k2)
- ee.EncodeInt(int64(v2))
+ for k2, v2 := range v {
+ e.mapElemKey()
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(k2))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, k2)
}
+ e.mapElemValue()
+ e.e.EncodeFloat32(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapIntfInt16R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapIntfInt16V(rv2i(rv).(map[interface{}]int16), e)
+func (e *Encoder) fastpathEncMapStringFloat64R(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapStringFloat64V(rv2i(rv).(map[string]float64), e)
}
-func (_ fastpathT) EncMapIntfInt16V(v map[interface{}]int16, e *Encoder) {
+func (fastpathT) EncMapStringFloat64V(v map[string]float64, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l uint
- var vp *bytesI
- for k2 := range v {
- l = uint(len(mksv))
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
+ v2 := make([]string, len(v))
+ var i uint
+ for k := range v {
+ v2[i] = k
i++
}
- sort.Sort(bytesISlice(v2))
- if esep {
- for j := range v2 {
- ee.WriteMapElemKey()
- e.asis(v2[j].v)
- ee.WriteMapElemValue()
- e.encode(v[v2[j].i])
- }
- } else {
- for j := range v2 {
- e.asis(v2[j].v)
- e.encode(v[v2[j].i])
+ sort.Sort(stringSlice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(k2))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, k2)
}
+ e.mapElemValue()
+ e.e.EncodeFloat64(v[k2])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- e.encode(k2)
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- e.encode(k2)
- ee.EncodeInt(int64(v2))
+ for k2, v2 := range v {
+ e.mapElemKey()
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(k2))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, k2)
}
+ e.mapElemValue()
+ e.e.EncodeFloat64(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapIntfInt32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapIntfInt32V(rv2i(rv).(map[interface{}]int32), e)
+func (e *Encoder) fastpathEncMapStringBoolR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapStringBoolV(rv2i(rv).(map[string]bool), e)
}
-func (_ fastpathT) EncMapIntfInt32V(v map[interface{}]int32, e *Encoder) {
+func (fastpathT) EncMapStringBoolV(v map[string]bool, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l uint
- var vp *bytesI
- for k2 := range v {
- l = uint(len(mksv))
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
+ v2 := make([]string, len(v))
+ var i uint
+ for k := range v {
+ v2[i] = k
i++
}
- sort.Sort(bytesISlice(v2))
- if esep {
- for j := range v2 {
- ee.WriteMapElemKey()
- e.asis(v2[j].v)
- ee.WriteMapElemValue()
- e.encode(v[v2[j].i])
- }
- } else {
- for j := range v2 {
- e.asis(v2[j].v)
- e.encode(v[v2[j].i])
+ sort.Sort(stringSlice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(k2))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, k2)
}
+ e.mapElemValue()
+ e.e.EncodeBool(v[k2])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- e.encode(k2)
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- e.encode(k2)
- ee.EncodeInt(int64(v2))
+ for k2, v2 := range v {
+ e.mapElemKey()
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(k2))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, k2)
}
+ e.mapElemValue()
+ e.e.EncodeBool(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapIntfInt64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapIntfInt64V(rv2i(rv).(map[interface{}]int64), e)
+func (e *Encoder) fastpathEncMapUintIntfR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapUintIntfV(rv2i(rv).(map[uint]interface{}), e)
}
-func (_ fastpathT) EncMapIntfInt64V(v map[interface{}]int64, e *Encoder) {
+func (fastpathT) EncMapUintIntfV(v map[uint]interface{}, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l uint
- var vp *bytesI
- for k2 := range v {
- l = uint(len(mksv))
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
+ v2 := make([]uint64, len(v))
+ var i uint
+ for k := range v {
+ v2[i] = uint64(k)
i++
}
- sort.Sort(bytesISlice(v2))
- if esep {
- for j := range v2 {
- ee.WriteMapElemKey()
- e.asis(v2[j].v)
- ee.WriteMapElemValue()
- e.encode(v[v2[j].i])
- }
- } else {
- for j := range v2 {
- e.asis(v2[j].v)
- e.encode(v[v2[j].i])
- }
+ sort.Sort(uint64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(uint(k2)))
+ e.mapElemValue()
+ e.encode(v[uint(k2)])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- e.encode(k2)
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- e.encode(k2)
- ee.EncodeInt(int64(v2))
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(k2))
+ e.mapElemValue()
+ e.encode(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapIntfFloat32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapIntfFloat32V(rv2i(rv).(map[interface{}]float32), e)
+func (e *Encoder) fastpathEncMapUintStringR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapUintStringV(rv2i(rv).(map[uint]string), e)
}
-func (_ fastpathT) EncMapIntfFloat32V(v map[interface{}]float32, e *Encoder) {
+func (fastpathT) EncMapUintStringV(v map[uint]string, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l uint
- var vp *bytesI
- for k2 := range v {
- l = uint(len(mksv))
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
+ v2 := make([]uint64, len(v))
+ var i uint
+ for k := range v {
+ v2[i] = uint64(k)
i++
}
- sort.Sort(bytesISlice(v2))
- if esep {
- for j := range v2 {
- ee.WriteMapElemKey()
- e.asis(v2[j].v)
- ee.WriteMapElemValue()
- e.encode(v[v2[j].i])
- }
- } else {
- for j := range v2 {
- e.asis(v2[j].v)
- e.encode(v[v2[j].i])
+ sort.Sort(uint64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(uint(k2)))
+ e.mapElemValue()
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(v[uint(k2)]))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, v[uint(k2)])
}
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- e.encode(k2)
- ee.WriteMapElemValue()
- ee.EncodeFloat32(v2)
- }
- } else {
- for k2, v2 := range v {
- e.encode(k2)
- ee.EncodeFloat32(v2)
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(k2))
+ e.mapElemValue()
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(v2))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, v2)
}
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapIntfFloat64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapIntfFloat64V(rv2i(rv).(map[interface{}]float64), e)
+func (e *Encoder) fastpathEncMapUintBytesR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapUintBytesV(rv2i(rv).(map[uint][]byte), e)
}
-func (_ fastpathT) EncMapIntfFloat64V(v map[interface{}]float64, e *Encoder) {
+func (fastpathT) EncMapUintBytesV(v map[uint][]byte, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l uint
- var vp *bytesI
- for k2 := range v {
- l = uint(len(mksv))
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
+ v2 := make([]uint64, len(v))
+ var i uint
+ for k := range v {
+ v2[i] = uint64(k)
i++
}
- sort.Sort(bytesISlice(v2))
- if esep {
- for j := range v2 {
- ee.WriteMapElemKey()
- e.asis(v2[j].v)
- ee.WriteMapElemValue()
- e.encode(v[v2[j].i])
- }
- } else {
- for j := range v2 {
- e.asis(v2[j].v)
- e.encode(v[v2[j].i])
- }
+ sort.Sort(uint64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(uint(k2)))
+ e.mapElemValue()
+ e.e.EncodeStringBytesRaw(v[uint(k2)])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- e.encode(k2)
- ee.WriteMapElemValue()
- ee.EncodeFloat64(v2)
- }
- } else {
- for k2, v2 := range v {
- e.encode(k2)
- ee.EncodeFloat64(v2)
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(k2))
+ e.mapElemValue()
+ e.e.EncodeStringBytesRaw(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapIntfBoolR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapIntfBoolV(rv2i(rv).(map[interface{}]bool), e)
+func (e *Encoder) fastpathEncMapUintUintR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapUintUintV(rv2i(rv).(map[uint]uint), e)
}
-func (_ fastpathT) EncMapIntfBoolV(v map[interface{}]bool, e *Encoder) {
+func (fastpathT) EncMapUintUintV(v map[uint]uint, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
- e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
- var i, l uint
- var vp *bytesI
- for k2 := range v {
- l = uint(len(mksv))
- e2.MustEncode(k2)
- vp = &v2[i]
- vp.v = mksv[l:]
- vp.i = k2
+ v2 := make([]uint64, len(v))
+ var i uint
+ for k := range v {
+ v2[i] = uint64(k)
i++
}
- sort.Sort(bytesISlice(v2))
- if esep {
- for j := range v2 {
- ee.WriteMapElemKey()
- e.asis(v2[j].v)
- ee.WriteMapElemValue()
- e.encode(v[v2[j].i])
- }
- } else {
- for j := range v2 {
- e.asis(v2[j].v)
- e.encode(v[v2[j].i])
- }
+ sort.Sort(uint64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(uint(k2)))
+ e.mapElemValue()
+ e.e.EncodeUint(uint64(v[uint(k2)]))
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- e.encode(k2)
- ee.WriteMapElemValue()
- ee.EncodeBool(v2)
- }
- } else {
- for k2, v2 := range v {
- e.encode(k2)
- ee.EncodeBool(v2)
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(k2))
+ e.mapElemValue()
+ e.e.EncodeUint(uint64(v2))
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapStringIntfR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapStringIntfV(rv2i(rv).(map[string]interface{}), e)
+func (e *Encoder) fastpathEncMapUintUint8R(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapUintUint8V(rv2i(rv).(map[uint]uint8), e)
}
-func (_ fastpathT) EncMapStringIntfV(v map[string]interface{}, e *Encoder) {
+func (fastpathT) EncMapUintUint8V(v map[uint]uint8, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]string, len(v))
+ v2 := make([]uint64, len(v))
var i uint
for k := range v {
- v2[i] = string(k)
+ v2[i] = uint64(k)
i++
}
- sort.Sort(stringSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeStringEnc(cUTF8, k2)
- ee.WriteMapElemValue()
- e.encode(v[string(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeStringEnc(cUTF8, k2)
- e.encode(v[string(k2)])
- }
+ sort.Sort(uint64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(uint(k2)))
+ e.mapElemValue()
+ e.e.EncodeUint(uint64(v[uint(k2)]))
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeStringEnc(cUTF8, k2)
- ee.WriteMapElemValue()
- e.encode(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeStringEnc(cUTF8, k2)
- e.encode(v2)
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(k2))
+ e.mapElemValue()
+ e.e.EncodeUint(uint64(v2))
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapStringStringR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapStringStringV(rv2i(rv).(map[string]string), e)
+func (e *Encoder) fastpathEncMapUintUint64R(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapUintUint64V(rv2i(rv).(map[uint]uint64), e)
}
-func (_ fastpathT) EncMapStringStringV(v map[string]string, e *Encoder) {
+func (fastpathT) EncMapUintUint64V(v map[uint]uint64, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]string, len(v))
+ v2 := make([]uint64, len(v))
var i uint
for k := range v {
- v2[i] = string(k)
+ v2[i] = uint64(k)
i++
}
- sort.Sort(stringSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeStringEnc(cUTF8, k2)
- ee.WriteMapElemValue()
- ee.EncodeStringEnc(cUTF8, v[string(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeStringEnc(cUTF8, k2)
- ee.EncodeStringEnc(cUTF8, v[string(k2)])
- }
+ sort.Sort(uint64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(uint(k2)))
+ e.mapElemValue()
+ e.e.EncodeUint(v[uint(k2)])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeStringEnc(cUTF8, k2)
- ee.WriteMapElemValue()
- ee.EncodeStringEnc(cUTF8, v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeStringEnc(cUTF8, k2)
- ee.EncodeStringEnc(cUTF8, v2)
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(k2))
+ e.mapElemValue()
+ e.e.EncodeUint(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapStringUintR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapStringUintV(rv2i(rv).(map[string]uint), e)
+func (e *Encoder) fastpathEncMapUintUintptrR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapUintUintptrV(rv2i(rv).(map[uint]uintptr), e)
}
-func (_ fastpathT) EncMapStringUintV(v map[string]uint, e *Encoder) {
+func (fastpathT) EncMapUintUintptrV(v map[uint]uintptr, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]string, len(v))
+ v2 := make([]uint64, len(v))
var i uint
for k := range v {
- v2[i] = string(k)
+ v2[i] = uint64(k)
i++
}
- sort.Sort(stringSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeStringEnc(cUTF8, k2)
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[string(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeStringEnc(cUTF8, k2)
- ee.EncodeUint(uint64(v[string(k2)]))
- }
+ sort.Sort(uint64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(uint(k2)))
+ e.mapElemValue()
+ e.encode(v[uint(k2)])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeStringEnc(cUTF8, k2)
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeStringEnc(cUTF8, k2)
- ee.EncodeUint(uint64(v2))
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(k2))
+ e.mapElemValue()
+ e.encode(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapStringUint8R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapStringUint8V(rv2i(rv).(map[string]uint8), e)
+func (e *Encoder) fastpathEncMapUintIntR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapUintIntV(rv2i(rv).(map[uint]int), e)
}
-func (_ fastpathT) EncMapStringUint8V(v map[string]uint8, e *Encoder) {
+func (fastpathT) EncMapUintIntV(v map[uint]int, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]string, len(v))
+ v2 := make([]uint64, len(v))
var i uint
for k := range v {
- v2[i] = string(k)
+ v2[i] = uint64(k)
i++
}
- sort.Sort(stringSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeStringEnc(cUTF8, k2)
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[string(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeStringEnc(cUTF8, k2)
- ee.EncodeUint(uint64(v[string(k2)]))
- }
+ sort.Sort(uint64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(uint(k2)))
+ e.mapElemValue()
+ e.e.EncodeInt(int64(v[uint(k2)]))
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeStringEnc(cUTF8, k2)
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeStringEnc(cUTF8, k2)
- ee.EncodeUint(uint64(v2))
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(k2))
+ e.mapElemValue()
+ e.e.EncodeInt(int64(v2))
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapStringUint16R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapStringUint16V(rv2i(rv).(map[string]uint16), e)
+func (e *Encoder) fastpathEncMapUintInt64R(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapUintInt64V(rv2i(rv).(map[uint]int64), e)
}
-func (_ fastpathT) EncMapStringUint16V(v map[string]uint16, e *Encoder) {
+func (fastpathT) EncMapUintInt64V(v map[uint]int64, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]string, len(v))
+ v2 := make([]uint64, len(v))
var i uint
for k := range v {
- v2[i] = string(k)
+ v2[i] = uint64(k)
i++
}
- sort.Sort(stringSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeStringEnc(cUTF8, k2)
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[string(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeStringEnc(cUTF8, k2)
- ee.EncodeUint(uint64(v[string(k2)]))
- }
+ sort.Sort(uint64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(uint(k2)))
+ e.mapElemValue()
+ e.e.EncodeInt(v[uint(k2)])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeStringEnc(cUTF8, k2)
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeStringEnc(cUTF8, k2)
- ee.EncodeUint(uint64(v2))
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(k2))
+ e.mapElemValue()
+ e.e.EncodeInt(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapStringUint32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapStringUint32V(rv2i(rv).(map[string]uint32), e)
+func (e *Encoder) fastpathEncMapUintFloat32R(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapUintFloat32V(rv2i(rv).(map[uint]float32), e)
}
-func (_ fastpathT) EncMapStringUint32V(v map[string]uint32, e *Encoder) {
+func (fastpathT) EncMapUintFloat32V(v map[uint]float32, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]string, len(v))
+ v2 := make([]uint64, len(v))
var i uint
for k := range v {
- v2[i] = string(k)
+ v2[i] = uint64(k)
i++
}
- sort.Sort(stringSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeStringEnc(cUTF8, k2)
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[string(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeStringEnc(cUTF8, k2)
- ee.EncodeUint(uint64(v[string(k2)]))
- }
+ sort.Sort(uint64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(uint(k2)))
+ e.mapElemValue()
+ e.e.EncodeFloat32(v[uint(k2)])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeStringEnc(cUTF8, k2)
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeStringEnc(cUTF8, k2)
- ee.EncodeUint(uint64(v2))
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(k2))
+ e.mapElemValue()
+ e.e.EncodeFloat32(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapStringUint64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapStringUint64V(rv2i(rv).(map[string]uint64), e)
+func (e *Encoder) fastpathEncMapUintFloat64R(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapUintFloat64V(rv2i(rv).(map[uint]float64), e)
}
-func (_ fastpathT) EncMapStringUint64V(v map[string]uint64, e *Encoder) {
+func (fastpathT) EncMapUintFloat64V(v map[uint]float64, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]string, len(v))
+ v2 := make([]uint64, len(v))
var i uint
for k := range v {
- v2[i] = string(k)
+ v2[i] = uint64(k)
i++
}
- sort.Sort(stringSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeStringEnc(cUTF8, k2)
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[string(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeStringEnc(cUTF8, k2)
- ee.EncodeUint(uint64(v[string(k2)]))
- }
+ sort.Sort(uint64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(uint(k2)))
+ e.mapElemValue()
+ e.e.EncodeFloat64(v[uint(k2)])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeStringEnc(cUTF8, k2)
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeStringEnc(cUTF8, k2)
- ee.EncodeUint(uint64(v2))
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(k2))
+ e.mapElemValue()
+ e.e.EncodeFloat64(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapStringUintptrR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapStringUintptrV(rv2i(rv).(map[string]uintptr), e)
+func (e *Encoder) fastpathEncMapUintBoolR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapUintBoolV(rv2i(rv).(map[uint]bool), e)
}
-func (_ fastpathT) EncMapStringUintptrV(v map[string]uintptr, e *Encoder) {
+func (fastpathT) EncMapUintBoolV(v map[uint]bool, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]string, len(v))
+ v2 := make([]uint64, len(v))
var i uint
for k := range v {
- v2[i] = string(k)
+ v2[i] = uint64(k)
i++
}
- sort.Sort(stringSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeStringEnc(cUTF8, k2)
- ee.WriteMapElemValue()
- e.encode(v[string(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeStringEnc(cUTF8, k2)
- e.encode(v[string(k2)])
- }
+ sort.Sort(uint64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(uint(k2)))
+ e.mapElemValue()
+ e.e.EncodeBool(v[uint(k2)])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeStringEnc(cUTF8, k2)
- ee.WriteMapElemValue()
- e.encode(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeStringEnc(cUTF8, k2)
- e.encode(v2)
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(k2))
+ e.mapElemValue()
+ e.e.EncodeBool(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapStringIntR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapStringIntV(rv2i(rv).(map[string]int), e)
+func (e *Encoder) fastpathEncMapUint8IntfR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapUint8IntfV(rv2i(rv).(map[uint8]interface{}), e)
}
-func (_ fastpathT) EncMapStringIntV(v map[string]int, e *Encoder) {
+func (fastpathT) EncMapUint8IntfV(v map[uint8]interface{}, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]string, len(v))
+ v2 := make([]uint64, len(v))
var i uint
for k := range v {
- v2[i] = string(k)
+ v2[i] = uint64(k)
i++
}
- sort.Sort(stringSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeStringEnc(cUTF8, k2)
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[string(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeStringEnc(cUTF8, k2)
- ee.EncodeInt(int64(v[string(k2)]))
- }
+ sort.Sort(uint64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(uint8(k2)))
+ e.mapElemValue()
+ e.encode(v[uint8(k2)])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeStringEnc(cUTF8, k2)
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeStringEnc(cUTF8, k2)
- ee.EncodeInt(int64(v2))
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(k2))
+ e.mapElemValue()
+ e.encode(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapStringInt8R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapStringInt8V(rv2i(rv).(map[string]int8), e)
+func (e *Encoder) fastpathEncMapUint8StringR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapUint8StringV(rv2i(rv).(map[uint8]string), e)
}
-func (_ fastpathT) EncMapStringInt8V(v map[string]int8, e *Encoder) {
+func (fastpathT) EncMapUint8StringV(v map[uint8]string, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]string, len(v))
+ v2 := make([]uint64, len(v))
var i uint
for k := range v {
- v2[i] = string(k)
+ v2[i] = uint64(k)
i++
}
- sort.Sort(stringSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeStringEnc(cUTF8, k2)
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[string(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeStringEnc(cUTF8, k2)
- ee.EncodeInt(int64(v[string(k2)]))
+ sort.Sort(uint64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(uint8(k2)))
+ e.mapElemValue()
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(v[uint8(k2)]))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, v[uint8(k2)])
}
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeStringEnc(cUTF8, k2)
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeStringEnc(cUTF8, k2)
- ee.EncodeInt(int64(v2))
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(k2))
+ e.mapElemValue()
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(v2))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, v2)
}
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapStringInt16R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapStringInt16V(rv2i(rv).(map[string]int16), e)
+func (e *Encoder) fastpathEncMapUint8BytesR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapUint8BytesV(rv2i(rv).(map[uint8][]byte), e)
}
-func (_ fastpathT) EncMapStringInt16V(v map[string]int16, e *Encoder) {
+func (fastpathT) EncMapUint8BytesV(v map[uint8][]byte, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]string, len(v))
+ v2 := make([]uint64, len(v))
var i uint
for k := range v {
- v2[i] = string(k)
+ v2[i] = uint64(k)
i++
}
- sort.Sort(stringSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeStringEnc(cUTF8, k2)
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[string(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeStringEnc(cUTF8, k2)
- ee.EncodeInt(int64(v[string(k2)]))
- }
+ sort.Sort(uint64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(uint8(k2)))
+ e.mapElemValue()
+ e.e.EncodeStringBytesRaw(v[uint8(k2)])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeStringEnc(cUTF8, k2)
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeStringEnc(cUTF8, k2)
- ee.EncodeInt(int64(v2))
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(k2))
+ e.mapElemValue()
+ e.e.EncodeStringBytesRaw(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapStringInt32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapStringInt32V(rv2i(rv).(map[string]int32), e)
+func (e *Encoder) fastpathEncMapUint8UintR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapUint8UintV(rv2i(rv).(map[uint8]uint), e)
}
-func (_ fastpathT) EncMapStringInt32V(v map[string]int32, e *Encoder) {
+func (fastpathT) EncMapUint8UintV(v map[uint8]uint, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]string, len(v))
+ v2 := make([]uint64, len(v))
var i uint
for k := range v {
- v2[i] = string(k)
+ v2[i] = uint64(k)
i++
}
- sort.Sort(stringSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeStringEnc(cUTF8, k2)
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[string(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeStringEnc(cUTF8, k2)
- ee.EncodeInt(int64(v[string(k2)]))
- }
+ sort.Sort(uint64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(uint8(k2)))
+ e.mapElemValue()
+ e.e.EncodeUint(uint64(v[uint8(k2)]))
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeStringEnc(cUTF8, k2)
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeStringEnc(cUTF8, k2)
- ee.EncodeInt(int64(v2))
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(k2))
+ e.mapElemValue()
+ e.e.EncodeUint(uint64(v2))
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapStringInt64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapStringInt64V(rv2i(rv).(map[string]int64), e)
+func (e *Encoder) fastpathEncMapUint8Uint8R(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapUint8Uint8V(rv2i(rv).(map[uint8]uint8), e)
}
-func (_ fastpathT) EncMapStringInt64V(v map[string]int64, e *Encoder) {
+func (fastpathT) EncMapUint8Uint8V(v map[uint8]uint8, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]string, len(v))
+ v2 := make([]uint64, len(v))
var i uint
for k := range v {
- v2[i] = string(k)
+ v2[i] = uint64(k)
i++
}
- sort.Sort(stringSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeStringEnc(cUTF8, k2)
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[string(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeStringEnc(cUTF8, k2)
- ee.EncodeInt(int64(v[string(k2)]))
- }
+ sort.Sort(uint64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(uint8(k2)))
+ e.mapElemValue()
+ e.e.EncodeUint(uint64(v[uint8(k2)]))
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeStringEnc(cUTF8, k2)
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeStringEnc(cUTF8, k2)
- ee.EncodeInt(int64(v2))
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(k2))
+ e.mapElemValue()
+ e.e.EncodeUint(uint64(v2))
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapStringFloat32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapStringFloat32V(rv2i(rv).(map[string]float32), e)
+func (e *Encoder) fastpathEncMapUint8Uint64R(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapUint8Uint64V(rv2i(rv).(map[uint8]uint64), e)
}
-func (_ fastpathT) EncMapStringFloat32V(v map[string]float32, e *Encoder) {
+func (fastpathT) EncMapUint8Uint64V(v map[uint8]uint64, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]string, len(v))
+ v2 := make([]uint64, len(v))
var i uint
for k := range v {
- v2[i] = string(k)
+ v2[i] = uint64(k)
i++
}
- sort.Sort(stringSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeStringEnc(cUTF8, k2)
- ee.WriteMapElemValue()
- ee.EncodeFloat32(v[string(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeStringEnc(cUTF8, k2)
- ee.EncodeFloat32(v[string(k2)])
- }
+ sort.Sort(uint64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(uint8(k2)))
+ e.mapElemValue()
+ e.e.EncodeUint(v[uint8(k2)])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeStringEnc(cUTF8, k2)
- ee.WriteMapElemValue()
- ee.EncodeFloat32(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeStringEnc(cUTF8, k2)
- ee.EncodeFloat32(v2)
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(k2))
+ e.mapElemValue()
+ e.e.EncodeUint(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapStringFloat64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapStringFloat64V(rv2i(rv).(map[string]float64), e)
+func (e *Encoder) fastpathEncMapUint8UintptrR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapUint8UintptrV(rv2i(rv).(map[uint8]uintptr), e)
}
-func (_ fastpathT) EncMapStringFloat64V(v map[string]float64, e *Encoder) {
+func (fastpathT) EncMapUint8UintptrV(v map[uint8]uintptr, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]string, len(v))
+ v2 := make([]uint64, len(v))
var i uint
for k := range v {
- v2[i] = string(k)
+ v2[i] = uint64(k)
i++
}
- sort.Sort(stringSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeStringEnc(cUTF8, k2)
- ee.WriteMapElemValue()
- ee.EncodeFloat64(v[string(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeStringEnc(cUTF8, k2)
- ee.EncodeFloat64(v[string(k2)])
- }
+ sort.Sort(uint64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(uint8(k2)))
+ e.mapElemValue()
+ e.encode(v[uint8(k2)])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeStringEnc(cUTF8, k2)
- ee.WriteMapElemValue()
- ee.EncodeFloat64(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeStringEnc(cUTF8, k2)
- ee.EncodeFloat64(v2)
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(k2))
+ e.mapElemValue()
+ e.encode(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapStringBoolR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapStringBoolV(rv2i(rv).(map[string]bool), e)
+func (e *Encoder) fastpathEncMapUint8IntR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapUint8IntV(rv2i(rv).(map[uint8]int), e)
}
-func (_ fastpathT) EncMapStringBoolV(v map[string]bool, e *Encoder) {
+func (fastpathT) EncMapUint8IntV(v map[uint8]int, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]string, len(v))
+ v2 := make([]uint64, len(v))
var i uint
for k := range v {
- v2[i] = string(k)
+ v2[i] = uint64(k)
i++
}
- sort.Sort(stringSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeStringEnc(cUTF8, k2)
- ee.WriteMapElemValue()
- ee.EncodeBool(v[string(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeStringEnc(cUTF8, k2)
- ee.EncodeBool(v[string(k2)])
- }
+ sort.Sort(uint64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(uint8(k2)))
+ e.mapElemValue()
+ e.e.EncodeInt(int64(v[uint8(k2)]))
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeStringEnc(cUTF8, k2)
- ee.WriteMapElemValue()
- ee.EncodeBool(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeStringEnc(cUTF8, k2)
- ee.EncodeBool(v2)
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(k2))
+ e.mapElemValue()
+ e.e.EncodeInt(int64(v2))
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapFloat32IntfR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapFloat32IntfV(rv2i(rv).(map[float32]interface{}), e)
+func (e *Encoder) fastpathEncMapUint8Int64R(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapUint8Int64V(rv2i(rv).(map[uint8]int64), e)
}
-func (_ fastpathT) EncMapFloat32IntfV(v map[float32]interface{}, e *Encoder) {
+func (fastpathT) EncMapUint8Int64V(v map[uint8]int64, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]float64, len(v))
+ v2 := make([]uint64, len(v))
var i uint
for k := range v {
- v2[i] = float64(k)
+ v2[i] = uint64(k)
i++
}
- sort.Sort(floatSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeFloat32(float32(k2))
- ee.WriteMapElemValue()
- e.encode(v[float32(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeFloat32(float32(k2))
- e.encode(v[float32(k2)])
- }
+ sort.Sort(uint64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(uint8(k2)))
+ e.mapElemValue()
+ e.e.EncodeInt(v[uint8(k2)])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeFloat32(k2)
- ee.WriteMapElemValue()
- e.encode(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeFloat32(k2)
- e.encode(v2)
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(k2))
+ e.mapElemValue()
+ e.e.EncodeInt(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapFloat32StringR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapFloat32StringV(rv2i(rv).(map[float32]string), e)
+func (e *Encoder) fastpathEncMapUint8Float32R(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapUint8Float32V(rv2i(rv).(map[uint8]float32), e)
}
-func (_ fastpathT) EncMapFloat32StringV(v map[float32]string, e *Encoder) {
+func (fastpathT) EncMapUint8Float32V(v map[uint8]float32, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]float64, len(v))
+ v2 := make([]uint64, len(v))
var i uint
for k := range v {
- v2[i] = float64(k)
+ v2[i] = uint64(k)
i++
}
- sort.Sort(floatSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeFloat32(float32(k2))
- ee.WriteMapElemValue()
- ee.EncodeStringEnc(cUTF8, v[float32(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeFloat32(float32(k2))
- ee.EncodeStringEnc(cUTF8, v[float32(k2)])
- }
+ sort.Sort(uint64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(uint8(k2)))
+ e.mapElemValue()
+ e.e.EncodeFloat32(v[uint8(k2)])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeFloat32(k2)
- ee.WriteMapElemValue()
- ee.EncodeStringEnc(cUTF8, v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeFloat32(k2)
- ee.EncodeStringEnc(cUTF8, v2)
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(k2))
+ e.mapElemValue()
+ e.e.EncodeFloat32(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapFloat32UintR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapFloat32UintV(rv2i(rv).(map[float32]uint), e)
+func (e *Encoder) fastpathEncMapUint8Float64R(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapUint8Float64V(rv2i(rv).(map[uint8]float64), e)
}
-func (_ fastpathT) EncMapFloat32UintV(v map[float32]uint, e *Encoder) {
+func (fastpathT) EncMapUint8Float64V(v map[uint8]float64, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]float64, len(v))
+ v2 := make([]uint64, len(v))
var i uint
for k := range v {
- v2[i] = float64(k)
+ v2[i] = uint64(k)
i++
}
- sort.Sort(floatSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeFloat32(float32(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[float32(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeFloat32(float32(k2))
- ee.EncodeUint(uint64(v[float32(k2)]))
- }
+ sort.Sort(uint64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(uint8(k2)))
+ e.mapElemValue()
+ e.e.EncodeFloat64(v[uint8(k2)])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeFloat32(k2)
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeFloat32(k2)
- ee.EncodeUint(uint64(v2))
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(k2))
+ e.mapElemValue()
+ e.e.EncodeFloat64(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapFloat32Uint8R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapFloat32Uint8V(rv2i(rv).(map[float32]uint8), e)
+func (e *Encoder) fastpathEncMapUint8BoolR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapUint8BoolV(rv2i(rv).(map[uint8]bool), e)
}
-func (_ fastpathT) EncMapFloat32Uint8V(v map[float32]uint8, e *Encoder) {
+func (fastpathT) EncMapUint8BoolV(v map[uint8]bool, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]float64, len(v))
+ v2 := make([]uint64, len(v))
var i uint
for k := range v {
- v2[i] = float64(k)
+ v2[i] = uint64(k)
i++
}
- sort.Sort(floatSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeFloat32(float32(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[float32(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeFloat32(float32(k2))
- ee.EncodeUint(uint64(v[float32(k2)]))
- }
+ sort.Sort(uint64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(uint8(k2)))
+ e.mapElemValue()
+ e.e.EncodeBool(v[uint8(k2)])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeFloat32(k2)
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeFloat32(k2)
- ee.EncodeUint(uint64(v2))
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeUint(uint64(k2))
+ e.mapElemValue()
+ e.e.EncodeBool(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapFloat32Uint16R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapFloat32Uint16V(rv2i(rv).(map[float32]uint16), e)
+func (e *Encoder) fastpathEncMapUint64IntfR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapUint64IntfV(rv2i(rv).(map[uint64]interface{}), e)
}
-func (_ fastpathT) EncMapFloat32Uint16V(v map[float32]uint16, e *Encoder) {
+func (fastpathT) EncMapUint64IntfV(v map[uint64]interface{}, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]float64, len(v))
+ v2 := make([]uint64, len(v))
var i uint
for k := range v {
- v2[i] = float64(k)
+ v2[i] = k
i++
}
- sort.Sort(floatSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeFloat32(float32(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[float32(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeFloat32(float32(k2))
- ee.EncodeUint(uint64(v[float32(k2)]))
- }
+ sort.Sort(uint64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeUint(k2)
+ e.mapElemValue()
+ e.encode(v[k2])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeFloat32(k2)
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeFloat32(k2)
- ee.EncodeUint(uint64(v2))
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeUint(k2)
+ e.mapElemValue()
+ e.encode(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapFloat32Uint32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapFloat32Uint32V(rv2i(rv).(map[float32]uint32), e)
+func (e *Encoder) fastpathEncMapUint64StringR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapUint64StringV(rv2i(rv).(map[uint64]string), e)
}
-func (_ fastpathT) EncMapFloat32Uint32V(v map[float32]uint32, e *Encoder) {
+func (fastpathT) EncMapUint64StringV(v map[uint64]string, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]float64, len(v))
+ v2 := make([]uint64, len(v))
var i uint
for k := range v {
- v2[i] = float64(k)
+ v2[i] = k
i++
}
- sort.Sort(floatSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeFloat32(float32(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[float32(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeFloat32(float32(k2))
- ee.EncodeUint(uint64(v[float32(k2)]))
+ sort.Sort(uint64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeUint(k2)
+ e.mapElemValue()
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(v[k2]))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, v[k2])
}
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeFloat32(k2)
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeFloat32(k2)
- ee.EncodeUint(uint64(v2))
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeUint(k2)
+ e.mapElemValue()
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(v2))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, v2)
}
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapFloat32Uint64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapFloat32Uint64V(rv2i(rv).(map[float32]uint64), e)
+func (e *Encoder) fastpathEncMapUint64BytesR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapUint64BytesV(rv2i(rv).(map[uint64][]byte), e)
}
-func (_ fastpathT) EncMapFloat32Uint64V(v map[float32]uint64, e *Encoder) {
+func (fastpathT) EncMapUint64BytesV(v map[uint64][]byte, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]float64, len(v))
+ v2 := make([]uint64, len(v))
var i uint
for k := range v {
- v2[i] = float64(k)
+ v2[i] = k
i++
}
- sort.Sort(floatSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeFloat32(float32(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[float32(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeFloat32(float32(k2))
- ee.EncodeUint(uint64(v[float32(k2)]))
- }
+ sort.Sort(uint64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeUint(k2)
+ e.mapElemValue()
+ e.e.EncodeStringBytesRaw(v[k2])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeFloat32(k2)
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeFloat32(k2)
- ee.EncodeUint(uint64(v2))
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeUint(k2)
+ e.mapElemValue()
+ e.e.EncodeStringBytesRaw(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapFloat32UintptrR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapFloat32UintptrV(rv2i(rv).(map[float32]uintptr), e)
+func (e *Encoder) fastpathEncMapUint64UintR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapUint64UintV(rv2i(rv).(map[uint64]uint), e)
}
-func (_ fastpathT) EncMapFloat32UintptrV(v map[float32]uintptr, e *Encoder) {
+func (fastpathT) EncMapUint64UintV(v map[uint64]uint, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]float64, len(v))
+ v2 := make([]uint64, len(v))
var i uint
for k := range v {
- v2[i] = float64(k)
+ v2[i] = k
i++
}
- sort.Sort(floatSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeFloat32(float32(k2))
- ee.WriteMapElemValue()
- e.encode(v[float32(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeFloat32(float32(k2))
- e.encode(v[float32(k2)])
- }
+ sort.Sort(uint64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeUint(k2)
+ e.mapElemValue()
+ e.e.EncodeUint(uint64(v[k2]))
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeFloat32(k2)
- ee.WriteMapElemValue()
- e.encode(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeFloat32(k2)
- e.encode(v2)
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeUint(k2)
+ e.mapElemValue()
+ e.e.EncodeUint(uint64(v2))
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapFloat32IntR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapFloat32IntV(rv2i(rv).(map[float32]int), e)
+func (e *Encoder) fastpathEncMapUint64Uint8R(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapUint64Uint8V(rv2i(rv).(map[uint64]uint8), e)
}
-func (_ fastpathT) EncMapFloat32IntV(v map[float32]int, e *Encoder) {
+func (fastpathT) EncMapUint64Uint8V(v map[uint64]uint8, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]float64, len(v))
+ v2 := make([]uint64, len(v))
var i uint
for k := range v {
- v2[i] = float64(k)
+ v2[i] = k
i++
}
- sort.Sort(floatSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeFloat32(float32(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[float32(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeFloat32(float32(k2))
- ee.EncodeInt(int64(v[float32(k2)]))
- }
+ sort.Sort(uint64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeUint(k2)
+ e.mapElemValue()
+ e.e.EncodeUint(uint64(v[k2]))
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeFloat32(k2)
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeFloat32(k2)
- ee.EncodeInt(int64(v2))
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeUint(k2)
+ e.mapElemValue()
+ e.e.EncodeUint(uint64(v2))
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapFloat32Int8R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapFloat32Int8V(rv2i(rv).(map[float32]int8), e)
+func (e *Encoder) fastpathEncMapUint64Uint64R(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapUint64Uint64V(rv2i(rv).(map[uint64]uint64), e)
}
-func (_ fastpathT) EncMapFloat32Int8V(v map[float32]int8, e *Encoder) {
+func (fastpathT) EncMapUint64Uint64V(v map[uint64]uint64, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]float64, len(v))
+ v2 := make([]uint64, len(v))
var i uint
for k := range v {
- v2[i] = float64(k)
+ v2[i] = k
i++
}
- sort.Sort(floatSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeFloat32(float32(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[float32(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeFloat32(float32(k2))
- ee.EncodeInt(int64(v[float32(k2)]))
- }
+ sort.Sort(uint64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeUint(k2)
+ e.mapElemValue()
+ e.e.EncodeUint(v[k2])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeFloat32(k2)
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeFloat32(k2)
- ee.EncodeInt(int64(v2))
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeUint(k2)
+ e.mapElemValue()
+ e.e.EncodeUint(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapFloat32Int16R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapFloat32Int16V(rv2i(rv).(map[float32]int16), e)
+func (e *Encoder) fastpathEncMapUint64UintptrR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapUint64UintptrV(rv2i(rv).(map[uint64]uintptr), e)
}
-func (_ fastpathT) EncMapFloat32Int16V(v map[float32]int16, e *Encoder) {
+func (fastpathT) EncMapUint64UintptrV(v map[uint64]uintptr, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]float64, len(v))
+ v2 := make([]uint64, len(v))
var i uint
for k := range v {
- v2[i] = float64(k)
+ v2[i] = k
i++
}
- sort.Sort(floatSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeFloat32(float32(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[float32(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeFloat32(float32(k2))
- ee.EncodeInt(int64(v[float32(k2)]))
- }
+ sort.Sort(uint64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeUint(k2)
+ e.mapElemValue()
+ e.encode(v[k2])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeFloat32(k2)
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeFloat32(k2)
- ee.EncodeInt(int64(v2))
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeUint(k2)
+ e.mapElemValue()
+ e.encode(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapFloat32Int32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapFloat32Int32V(rv2i(rv).(map[float32]int32), e)
+func (e *Encoder) fastpathEncMapUint64IntR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapUint64IntV(rv2i(rv).(map[uint64]int), e)
}
-func (_ fastpathT) EncMapFloat32Int32V(v map[float32]int32, e *Encoder) {
+func (fastpathT) EncMapUint64IntV(v map[uint64]int, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]float64, len(v))
+ v2 := make([]uint64, len(v))
var i uint
for k := range v {
- v2[i] = float64(k)
+ v2[i] = k
i++
}
- sort.Sort(floatSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeFloat32(float32(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[float32(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeFloat32(float32(k2))
- ee.EncodeInt(int64(v[float32(k2)]))
- }
+ sort.Sort(uint64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeUint(k2)
+ e.mapElemValue()
+ e.e.EncodeInt(int64(v[k2]))
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeFloat32(k2)
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeFloat32(k2)
- ee.EncodeInt(int64(v2))
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeUint(k2)
+ e.mapElemValue()
+ e.e.EncodeInt(int64(v2))
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapFloat32Int64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapFloat32Int64V(rv2i(rv).(map[float32]int64), e)
+func (e *Encoder) fastpathEncMapUint64Int64R(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapUint64Int64V(rv2i(rv).(map[uint64]int64), e)
}
-func (_ fastpathT) EncMapFloat32Int64V(v map[float32]int64, e *Encoder) {
+func (fastpathT) EncMapUint64Int64V(v map[uint64]int64, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]float64, len(v))
+ v2 := make([]uint64, len(v))
var i uint
for k := range v {
- v2[i] = float64(k)
+ v2[i] = k
i++
}
- sort.Sort(floatSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeFloat32(float32(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[float32(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeFloat32(float32(k2))
- ee.EncodeInt(int64(v[float32(k2)]))
- }
+ sort.Sort(uint64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeUint(k2)
+ e.mapElemValue()
+ e.e.EncodeInt(v[k2])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeFloat32(k2)
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeFloat32(k2)
- ee.EncodeInt(int64(v2))
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeUint(k2)
+ e.mapElemValue()
+ e.e.EncodeInt(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapFloat32Float32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapFloat32Float32V(rv2i(rv).(map[float32]float32), e)
+func (e *Encoder) fastpathEncMapUint64Float32R(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapUint64Float32V(rv2i(rv).(map[uint64]float32), e)
}
-func (_ fastpathT) EncMapFloat32Float32V(v map[float32]float32, e *Encoder) {
+func (fastpathT) EncMapUint64Float32V(v map[uint64]float32, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]float64, len(v))
+ v2 := make([]uint64, len(v))
var i uint
for k := range v {
- v2[i] = float64(k)
+ v2[i] = k
i++
}
- sort.Sort(floatSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeFloat32(float32(k2))
- ee.WriteMapElemValue()
- ee.EncodeFloat32(v[float32(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeFloat32(float32(k2))
- ee.EncodeFloat32(v[float32(k2)])
- }
+ sort.Sort(uint64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeUint(k2)
+ e.mapElemValue()
+ e.e.EncodeFloat32(v[k2])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeFloat32(k2)
- ee.WriteMapElemValue()
- ee.EncodeFloat32(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeFloat32(k2)
- ee.EncodeFloat32(v2)
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeUint(k2)
+ e.mapElemValue()
+ e.e.EncodeFloat32(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapFloat32Float64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapFloat32Float64V(rv2i(rv).(map[float32]float64), e)
+func (e *Encoder) fastpathEncMapUint64Float64R(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapUint64Float64V(rv2i(rv).(map[uint64]float64), e)
}
-func (_ fastpathT) EncMapFloat32Float64V(v map[float32]float64, e *Encoder) {
+func (fastpathT) EncMapUint64Float64V(v map[uint64]float64, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]float64, len(v))
+ v2 := make([]uint64, len(v))
var i uint
for k := range v {
- v2[i] = float64(k)
+ v2[i] = k
i++
}
- sort.Sort(floatSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeFloat32(float32(k2))
- ee.WriteMapElemValue()
- ee.EncodeFloat64(v[float32(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeFloat32(float32(k2))
- ee.EncodeFloat64(v[float32(k2)])
- }
+ sort.Sort(uint64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeUint(k2)
+ e.mapElemValue()
+ e.e.EncodeFloat64(v[k2])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeFloat32(k2)
- ee.WriteMapElemValue()
- ee.EncodeFloat64(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeFloat32(k2)
- ee.EncodeFloat64(v2)
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeUint(k2)
+ e.mapElemValue()
+ e.e.EncodeFloat64(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapFloat32BoolR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapFloat32BoolV(rv2i(rv).(map[float32]bool), e)
+func (e *Encoder) fastpathEncMapUint64BoolR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapUint64BoolV(rv2i(rv).(map[uint64]bool), e)
}
-func (_ fastpathT) EncMapFloat32BoolV(v map[float32]bool, e *Encoder) {
+func (fastpathT) EncMapUint64BoolV(v map[uint64]bool, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]float64, len(v))
+ v2 := make([]uint64, len(v))
var i uint
for k := range v {
- v2[i] = float64(k)
+ v2[i] = k
i++
}
- sort.Sort(floatSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeFloat32(float32(k2))
- ee.WriteMapElemValue()
- ee.EncodeBool(v[float32(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeFloat32(float32(k2))
- ee.EncodeBool(v[float32(k2)])
- }
+ sort.Sort(uint64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeUint(k2)
+ e.mapElemValue()
+ e.e.EncodeBool(v[k2])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeFloat32(k2)
- ee.WriteMapElemValue()
- ee.EncodeBool(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeFloat32(k2)
- ee.EncodeBool(v2)
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeUint(k2)
+ e.mapElemValue()
+ e.e.EncodeBool(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapFloat64IntfR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapFloat64IntfV(rv2i(rv).(map[float64]interface{}), e)
+func (e *Encoder) fastpathEncMapIntIntfR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapIntIntfV(rv2i(rv).(map[int]interface{}), e)
}
-func (_ fastpathT) EncMapFloat64IntfV(v map[float64]interface{}, e *Encoder) {
+func (fastpathT) EncMapIntIntfV(v map[int]interface{}, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]float64, len(v))
+ v2 := make([]int64, len(v))
var i uint
for k := range v {
- v2[i] = float64(k)
+ v2[i] = int64(k)
i++
}
- sort.Sort(floatSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeFloat64(float64(k2))
- ee.WriteMapElemValue()
- e.encode(v[float64(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeFloat64(float64(k2))
- e.encode(v[float64(k2)])
- }
+ sort.Sort(int64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeInt(int64(int(k2)))
+ e.mapElemValue()
+ e.encode(v[int(k2)])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeFloat64(k2)
- ee.WriteMapElemValue()
- e.encode(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeFloat64(k2)
- e.encode(v2)
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeInt(int64(k2))
+ e.mapElemValue()
+ e.encode(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapFloat64StringR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapFloat64StringV(rv2i(rv).(map[float64]string), e)
+func (e *Encoder) fastpathEncMapIntStringR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapIntStringV(rv2i(rv).(map[int]string), e)
}
-func (_ fastpathT) EncMapFloat64StringV(v map[float64]string, e *Encoder) {
+func (fastpathT) EncMapIntStringV(v map[int]string, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]float64, len(v))
+ v2 := make([]int64, len(v))
var i uint
for k := range v {
- v2[i] = float64(k)
+ v2[i] = int64(k)
i++
}
- sort.Sort(floatSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeFloat64(float64(k2))
- ee.WriteMapElemValue()
- ee.EncodeStringEnc(cUTF8, v[float64(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeFloat64(float64(k2))
- ee.EncodeStringEnc(cUTF8, v[float64(k2)])
+ sort.Sort(int64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeInt(int64(int(k2)))
+ e.mapElemValue()
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(v[int(k2)]))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, v[int(k2)])
}
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeFloat64(k2)
- ee.WriteMapElemValue()
- ee.EncodeStringEnc(cUTF8, v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeFloat64(k2)
- ee.EncodeStringEnc(cUTF8, v2)
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeInt(int64(k2))
+ e.mapElemValue()
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(v2))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, v2)
}
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapFloat64UintR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapFloat64UintV(rv2i(rv).(map[float64]uint), e)
+func (e *Encoder) fastpathEncMapIntBytesR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapIntBytesV(rv2i(rv).(map[int][]byte), e)
}
-func (_ fastpathT) EncMapFloat64UintV(v map[float64]uint, e *Encoder) {
+func (fastpathT) EncMapIntBytesV(v map[int][]byte, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]float64, len(v))
+ v2 := make([]int64, len(v))
var i uint
for k := range v {
- v2[i] = float64(k)
+ v2[i] = int64(k)
i++
}
- sort.Sort(floatSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeFloat64(float64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[float64(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeFloat64(float64(k2))
- ee.EncodeUint(uint64(v[float64(k2)]))
- }
+ sort.Sort(int64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeInt(int64(int(k2)))
+ e.mapElemValue()
+ e.e.EncodeStringBytesRaw(v[int(k2)])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeFloat64(k2)
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeFloat64(k2)
- ee.EncodeUint(uint64(v2))
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeInt(int64(k2))
+ e.mapElemValue()
+ e.e.EncodeStringBytesRaw(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapFloat64Uint8R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapFloat64Uint8V(rv2i(rv).(map[float64]uint8), e)
+func (e *Encoder) fastpathEncMapIntUintR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapIntUintV(rv2i(rv).(map[int]uint), e)
}
-func (_ fastpathT) EncMapFloat64Uint8V(v map[float64]uint8, e *Encoder) {
+func (fastpathT) EncMapIntUintV(v map[int]uint, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]float64, len(v))
+ v2 := make([]int64, len(v))
var i uint
for k := range v {
- v2[i] = float64(k)
+ v2[i] = int64(k)
i++
}
- sort.Sort(floatSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeFloat64(float64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[float64(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeFloat64(float64(k2))
- ee.EncodeUint(uint64(v[float64(k2)]))
- }
+ sort.Sort(int64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeInt(int64(int(k2)))
+ e.mapElemValue()
+ e.e.EncodeUint(uint64(v[int(k2)]))
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeFloat64(k2)
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeFloat64(k2)
- ee.EncodeUint(uint64(v2))
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeInt(int64(k2))
+ e.mapElemValue()
+ e.e.EncodeUint(uint64(v2))
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapFloat64Uint16R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapFloat64Uint16V(rv2i(rv).(map[float64]uint16), e)
+func (e *Encoder) fastpathEncMapIntUint8R(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapIntUint8V(rv2i(rv).(map[int]uint8), e)
}
-func (_ fastpathT) EncMapFloat64Uint16V(v map[float64]uint16, e *Encoder) {
+func (fastpathT) EncMapIntUint8V(v map[int]uint8, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]float64, len(v))
+ v2 := make([]int64, len(v))
var i uint
for k := range v {
- v2[i] = float64(k)
+ v2[i] = int64(k)
i++
}
- sort.Sort(floatSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeFloat64(float64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[float64(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeFloat64(float64(k2))
- ee.EncodeUint(uint64(v[float64(k2)]))
- }
+ sort.Sort(int64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeInt(int64(int(k2)))
+ e.mapElemValue()
+ e.e.EncodeUint(uint64(v[int(k2)]))
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeFloat64(k2)
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeFloat64(k2)
- ee.EncodeUint(uint64(v2))
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeInt(int64(k2))
+ e.mapElemValue()
+ e.e.EncodeUint(uint64(v2))
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapFloat64Uint32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapFloat64Uint32V(rv2i(rv).(map[float64]uint32), e)
+func (e *Encoder) fastpathEncMapIntUint64R(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapIntUint64V(rv2i(rv).(map[int]uint64), e)
}
-func (_ fastpathT) EncMapFloat64Uint32V(v map[float64]uint32, e *Encoder) {
+func (fastpathT) EncMapIntUint64V(v map[int]uint64, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]float64, len(v))
+ v2 := make([]int64, len(v))
var i uint
for k := range v {
- v2[i] = float64(k)
+ v2[i] = int64(k)
i++
}
- sort.Sort(floatSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeFloat64(float64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[float64(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeFloat64(float64(k2))
- ee.EncodeUint(uint64(v[float64(k2)]))
- }
+ sort.Sort(int64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeInt(int64(int(k2)))
+ e.mapElemValue()
+ e.e.EncodeUint(v[int(k2)])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeFloat64(k2)
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeFloat64(k2)
- ee.EncodeUint(uint64(v2))
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeInt(int64(k2))
+ e.mapElemValue()
+ e.e.EncodeUint(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapFloat64Uint64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapFloat64Uint64V(rv2i(rv).(map[float64]uint64), e)
+func (e *Encoder) fastpathEncMapIntUintptrR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapIntUintptrV(rv2i(rv).(map[int]uintptr), e)
}
-func (_ fastpathT) EncMapFloat64Uint64V(v map[float64]uint64, e *Encoder) {
+func (fastpathT) EncMapIntUintptrV(v map[int]uintptr, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]float64, len(v))
+ v2 := make([]int64, len(v))
var i uint
for k := range v {
- v2[i] = float64(k)
+ v2[i] = int64(k)
i++
}
- sort.Sort(floatSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeFloat64(float64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[float64(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeFloat64(float64(k2))
- ee.EncodeUint(uint64(v[float64(k2)]))
- }
+ sort.Sort(int64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeInt(int64(int(k2)))
+ e.mapElemValue()
+ e.encode(v[int(k2)])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeFloat64(k2)
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeFloat64(k2)
- ee.EncodeUint(uint64(v2))
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeInt(int64(k2))
+ e.mapElemValue()
+ e.encode(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapFloat64UintptrR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapFloat64UintptrV(rv2i(rv).(map[float64]uintptr), e)
+func (e *Encoder) fastpathEncMapIntIntR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapIntIntV(rv2i(rv).(map[int]int), e)
}
-func (_ fastpathT) EncMapFloat64UintptrV(v map[float64]uintptr, e *Encoder) {
+func (fastpathT) EncMapIntIntV(v map[int]int, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]float64, len(v))
+ v2 := make([]int64, len(v))
var i uint
for k := range v {
- v2[i] = float64(k)
+ v2[i] = int64(k)
i++
}
- sort.Sort(floatSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeFloat64(float64(k2))
- ee.WriteMapElemValue()
- e.encode(v[float64(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeFloat64(float64(k2))
- e.encode(v[float64(k2)])
- }
+ sort.Sort(int64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeInt(int64(int(k2)))
+ e.mapElemValue()
+ e.e.EncodeInt(int64(v[int(k2)]))
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeFloat64(k2)
- ee.WriteMapElemValue()
- e.encode(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeFloat64(k2)
- e.encode(v2)
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeInt(int64(k2))
+ e.mapElemValue()
+ e.e.EncodeInt(int64(v2))
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapFloat64IntR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapFloat64IntV(rv2i(rv).(map[float64]int), e)
+func (e *Encoder) fastpathEncMapIntInt64R(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapIntInt64V(rv2i(rv).(map[int]int64), e)
}
-func (_ fastpathT) EncMapFloat64IntV(v map[float64]int, e *Encoder) {
+func (fastpathT) EncMapIntInt64V(v map[int]int64, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]float64, len(v))
+ v2 := make([]int64, len(v))
var i uint
for k := range v {
- v2[i] = float64(k)
+ v2[i] = int64(k)
i++
}
- sort.Sort(floatSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeFloat64(float64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[float64(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeFloat64(float64(k2))
- ee.EncodeInt(int64(v[float64(k2)]))
- }
+ sort.Sort(int64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeInt(int64(int(k2)))
+ e.mapElemValue()
+ e.e.EncodeInt(v[int(k2)])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeFloat64(k2)
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeFloat64(k2)
- ee.EncodeInt(int64(v2))
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeInt(int64(k2))
+ e.mapElemValue()
+ e.e.EncodeInt(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapFloat64Int8R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapFloat64Int8V(rv2i(rv).(map[float64]int8), e)
+func (e *Encoder) fastpathEncMapIntFloat32R(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapIntFloat32V(rv2i(rv).(map[int]float32), e)
}
-func (_ fastpathT) EncMapFloat64Int8V(v map[float64]int8, e *Encoder) {
+func (fastpathT) EncMapIntFloat32V(v map[int]float32, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]float64, len(v))
+ v2 := make([]int64, len(v))
var i uint
for k := range v {
- v2[i] = float64(k)
+ v2[i] = int64(k)
i++
}
- sort.Sort(floatSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeFloat64(float64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[float64(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeFloat64(float64(k2))
- ee.EncodeInt(int64(v[float64(k2)]))
- }
+ sort.Sort(int64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeInt(int64(int(k2)))
+ e.mapElemValue()
+ e.e.EncodeFloat32(v[int(k2)])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeFloat64(k2)
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeFloat64(k2)
- ee.EncodeInt(int64(v2))
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeInt(int64(k2))
+ e.mapElemValue()
+ e.e.EncodeFloat32(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapFloat64Int16R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapFloat64Int16V(rv2i(rv).(map[float64]int16), e)
+func (e *Encoder) fastpathEncMapIntFloat64R(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapIntFloat64V(rv2i(rv).(map[int]float64), e)
}
-func (_ fastpathT) EncMapFloat64Int16V(v map[float64]int16, e *Encoder) {
+func (fastpathT) EncMapIntFloat64V(v map[int]float64, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]float64, len(v))
+ v2 := make([]int64, len(v))
var i uint
for k := range v {
- v2[i] = float64(k)
+ v2[i] = int64(k)
i++
}
- sort.Sort(floatSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeFloat64(float64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[float64(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeFloat64(float64(k2))
- ee.EncodeInt(int64(v[float64(k2)]))
- }
+ sort.Sort(int64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeInt(int64(int(k2)))
+ e.mapElemValue()
+ e.e.EncodeFloat64(v[int(k2)])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeFloat64(k2)
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeFloat64(k2)
- ee.EncodeInt(int64(v2))
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeInt(int64(k2))
+ e.mapElemValue()
+ e.e.EncodeFloat64(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapFloat64Int32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapFloat64Int32V(rv2i(rv).(map[float64]int32), e)
+func (e *Encoder) fastpathEncMapIntBoolR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapIntBoolV(rv2i(rv).(map[int]bool), e)
}
-func (_ fastpathT) EncMapFloat64Int32V(v map[float64]int32, e *Encoder) {
+func (fastpathT) EncMapIntBoolV(v map[int]bool, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]float64, len(v))
+ v2 := make([]int64, len(v))
var i uint
for k := range v {
- v2[i] = float64(k)
+ v2[i] = int64(k)
i++
}
- sort.Sort(floatSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeFloat64(float64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[float64(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeFloat64(float64(k2))
- ee.EncodeInt(int64(v[float64(k2)]))
- }
+ sort.Sort(int64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeInt(int64(int(k2)))
+ e.mapElemValue()
+ e.e.EncodeBool(v[int(k2)])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeFloat64(k2)
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeFloat64(k2)
- ee.EncodeInt(int64(v2))
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeInt(int64(k2))
+ e.mapElemValue()
+ e.e.EncodeBool(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapFloat64Int64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapFloat64Int64V(rv2i(rv).(map[float64]int64), e)
+func (e *Encoder) fastpathEncMapInt64IntfR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapInt64IntfV(rv2i(rv).(map[int64]interface{}), e)
}
-func (_ fastpathT) EncMapFloat64Int64V(v map[float64]int64, e *Encoder) {
+func (fastpathT) EncMapInt64IntfV(v map[int64]interface{}, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]float64, len(v))
+ v2 := make([]int64, len(v))
var i uint
for k := range v {
- v2[i] = float64(k)
+ v2[i] = k
i++
}
- sort.Sort(floatSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeFloat64(float64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[float64(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeFloat64(float64(k2))
- ee.EncodeInt(int64(v[float64(k2)]))
- }
+ sort.Sort(int64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeInt(k2)
+ e.mapElemValue()
+ e.encode(v[k2])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeFloat64(k2)
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeFloat64(k2)
- ee.EncodeInt(int64(v2))
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeInt(k2)
+ e.mapElemValue()
+ e.encode(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapFloat64Float32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapFloat64Float32V(rv2i(rv).(map[float64]float32), e)
+func (e *Encoder) fastpathEncMapInt64StringR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapInt64StringV(rv2i(rv).(map[int64]string), e)
}
-func (_ fastpathT) EncMapFloat64Float32V(v map[float64]float32, e *Encoder) {
+func (fastpathT) EncMapInt64StringV(v map[int64]string, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]float64, len(v))
+ v2 := make([]int64, len(v))
var i uint
for k := range v {
- v2[i] = float64(k)
+ v2[i] = k
i++
}
- sort.Sort(floatSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeFloat64(float64(k2))
- ee.WriteMapElemValue()
- ee.EncodeFloat32(v[float64(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeFloat64(float64(k2))
- ee.EncodeFloat32(v[float64(k2)])
+ sort.Sort(int64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeInt(k2)
+ e.mapElemValue()
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(v[k2]))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, v[k2])
}
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeFloat64(k2)
- ee.WriteMapElemValue()
- ee.EncodeFloat32(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeFloat64(k2)
- ee.EncodeFloat32(v2)
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeInt(k2)
+ e.mapElemValue()
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(v2))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, v2)
}
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapFloat64Float64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapFloat64Float64V(rv2i(rv).(map[float64]float64), e)
+func (e *Encoder) fastpathEncMapInt64BytesR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapInt64BytesV(rv2i(rv).(map[int64][]byte), e)
}
-func (_ fastpathT) EncMapFloat64Float64V(v map[float64]float64, e *Encoder) {
+func (fastpathT) EncMapInt64BytesV(v map[int64][]byte, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]float64, len(v))
+ v2 := make([]int64, len(v))
var i uint
for k := range v {
- v2[i] = float64(k)
+ v2[i] = k
i++
}
- sort.Sort(floatSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeFloat64(float64(k2))
- ee.WriteMapElemValue()
- ee.EncodeFloat64(v[float64(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeFloat64(float64(k2))
- ee.EncodeFloat64(v[float64(k2)])
- }
+ sort.Sort(int64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeInt(k2)
+ e.mapElemValue()
+ e.e.EncodeStringBytesRaw(v[k2])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeFloat64(k2)
- ee.WriteMapElemValue()
- ee.EncodeFloat64(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeFloat64(k2)
- ee.EncodeFloat64(v2)
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeInt(k2)
+ e.mapElemValue()
+ e.e.EncodeStringBytesRaw(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapFloat64BoolR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapFloat64BoolV(rv2i(rv).(map[float64]bool), e)
+func (e *Encoder) fastpathEncMapInt64UintR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapInt64UintV(rv2i(rv).(map[int64]uint), e)
}
-func (_ fastpathT) EncMapFloat64BoolV(v map[float64]bool, e *Encoder) {
+func (fastpathT) EncMapInt64UintV(v map[int64]uint, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]float64, len(v))
+ v2 := make([]int64, len(v))
var i uint
for k := range v {
- v2[i] = float64(k)
+ v2[i] = k
i++
}
- sort.Sort(floatSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeFloat64(float64(k2))
- ee.WriteMapElemValue()
- ee.EncodeBool(v[float64(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeFloat64(float64(k2))
- ee.EncodeBool(v[float64(k2)])
- }
+ sort.Sort(int64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeInt(k2)
+ e.mapElemValue()
+ e.e.EncodeUint(uint64(v[k2]))
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeFloat64(k2)
- ee.WriteMapElemValue()
- ee.EncodeBool(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeFloat64(k2)
- ee.EncodeBool(v2)
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeInt(k2)
+ e.mapElemValue()
+ e.e.EncodeUint(uint64(v2))
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapUintIntfR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUintIntfV(rv2i(rv).(map[uint]interface{}), e)
+func (e *Encoder) fastpathEncMapInt64Uint8R(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapInt64Uint8V(rv2i(rv).(map[int64]uint8), e)
}
-func (_ fastpathT) EncMapUintIntfV(v map[uint]interface{}, e *Encoder) {
+func (fastpathT) EncMapInt64Uint8V(v map[int64]uint8, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]uint64, len(v))
+ v2 := make([]int64, len(v))
var i uint
for k := range v {
- v2[i] = uint64(k)
+ v2[i] = k
i++
}
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint(k2)))
- ee.WriteMapElemValue()
- e.encode(v[uint(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint(k2)))
- e.encode(v[uint(k2)])
- }
+ sort.Sort(int64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeInt(k2)
+ e.mapElemValue()
+ e.e.EncodeUint(uint64(v[k2]))
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- e.encode(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- e.encode(v2)
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeInt(k2)
+ e.mapElemValue()
+ e.e.EncodeUint(uint64(v2))
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapUintStringR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUintStringV(rv2i(rv).(map[uint]string), e)
+func (e *Encoder) fastpathEncMapInt64Uint64R(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapInt64Uint64V(rv2i(rv).(map[int64]uint64), e)
}
-func (_ fastpathT) EncMapUintStringV(v map[uint]string, e *Encoder) {
+func (fastpathT) EncMapInt64Uint64V(v map[int64]uint64, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]uint64, len(v))
+ v2 := make([]int64, len(v))
var i uint
for k := range v {
- v2[i] = uint64(k)
+ v2[i] = k
i++
}
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint(k2)))
- ee.WriteMapElemValue()
- ee.EncodeStringEnc(cUTF8, v[uint(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint(k2)))
- ee.EncodeStringEnc(cUTF8, v[uint(k2)])
- }
+ sort.Sort(int64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeInt(k2)
+ e.mapElemValue()
+ e.e.EncodeUint(v[k2])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeStringEnc(cUTF8, v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeStringEnc(cUTF8, v2)
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeInt(k2)
+ e.mapElemValue()
+ e.e.EncodeUint(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapUintUintR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUintUintV(rv2i(rv).(map[uint]uint), e)
+func (e *Encoder) fastpathEncMapInt64UintptrR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapInt64UintptrV(rv2i(rv).(map[int64]uintptr), e)
}
-func (_ fastpathT) EncMapUintUintV(v map[uint]uint, e *Encoder) {
+func (fastpathT) EncMapInt64UintptrV(v map[int64]uintptr, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]uint64, len(v))
+ v2 := make([]int64, len(v))
var i uint
for k := range v {
- v2[i] = uint64(k)
+ v2[i] = k
i++
}
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[uint(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint(k2)))
- ee.EncodeUint(uint64(v[uint(k2)]))
- }
+ sort.Sort(int64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeInt(k2)
+ e.mapElemValue()
+ e.encode(v[k2])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeUint(uint64(v2))
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeInt(k2)
+ e.mapElemValue()
+ e.encode(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapUintUint8R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUintUint8V(rv2i(rv).(map[uint]uint8), e)
+func (e *Encoder) fastpathEncMapInt64IntR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapInt64IntV(rv2i(rv).(map[int64]int), e)
}
-func (_ fastpathT) EncMapUintUint8V(v map[uint]uint8, e *Encoder) {
+func (fastpathT) EncMapInt64IntV(v map[int64]int, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]uint64, len(v))
+ v2 := make([]int64, len(v))
var i uint
for k := range v {
- v2[i] = uint64(k)
+ v2[i] = k
i++
}
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[uint(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint(k2)))
- ee.EncodeUint(uint64(v[uint(k2)]))
- }
+ sort.Sort(int64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeInt(k2)
+ e.mapElemValue()
+ e.e.EncodeInt(int64(v[k2]))
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeUint(uint64(v2))
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeInt(k2)
+ e.mapElemValue()
+ e.e.EncodeInt(int64(v2))
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapUintUint16R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUintUint16V(rv2i(rv).(map[uint]uint16), e)
+func (e *Encoder) fastpathEncMapInt64Int64R(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapInt64Int64V(rv2i(rv).(map[int64]int64), e)
}
-func (_ fastpathT) EncMapUintUint16V(v map[uint]uint16, e *Encoder) {
+func (fastpathT) EncMapInt64Int64V(v map[int64]int64, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]uint64, len(v))
+ v2 := make([]int64, len(v))
var i uint
for k := range v {
- v2[i] = uint64(k)
+ v2[i] = k
i++
}
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[uint(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint(k2)))
- ee.EncodeUint(uint64(v[uint(k2)]))
- }
+ sort.Sort(int64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeInt(k2)
+ e.mapElemValue()
+ e.e.EncodeInt(v[k2])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeUint(uint64(v2))
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeInt(k2)
+ e.mapElemValue()
+ e.e.EncodeInt(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapUintUint32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUintUint32V(rv2i(rv).(map[uint]uint32), e)
+func (e *Encoder) fastpathEncMapInt64Float32R(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapInt64Float32V(rv2i(rv).(map[int64]float32), e)
}
-func (_ fastpathT) EncMapUintUint32V(v map[uint]uint32, e *Encoder) {
+func (fastpathT) EncMapInt64Float32V(v map[int64]float32, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]uint64, len(v))
+ v2 := make([]int64, len(v))
var i uint
for k := range v {
- v2[i] = uint64(k)
+ v2[i] = k
i++
}
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[uint(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint(k2)))
- ee.EncodeUint(uint64(v[uint(k2)]))
- }
+ sort.Sort(int64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeInt(k2)
+ e.mapElemValue()
+ e.e.EncodeFloat32(v[k2])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeUint(uint64(v2))
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeInt(k2)
+ e.mapElemValue()
+ e.e.EncodeFloat32(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapUintUint64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUintUint64V(rv2i(rv).(map[uint]uint64), e)
+func (e *Encoder) fastpathEncMapInt64Float64R(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapInt64Float64V(rv2i(rv).(map[int64]float64), e)
}
-func (_ fastpathT) EncMapUintUint64V(v map[uint]uint64, e *Encoder) {
+func (fastpathT) EncMapInt64Float64V(v map[int64]float64, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]uint64, len(v))
+ v2 := make([]int64, len(v))
var i uint
for k := range v {
- v2[i] = uint64(k)
+ v2[i] = k
i++
}
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[uint(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint(k2)))
- ee.EncodeUint(uint64(v[uint(k2)]))
- }
+ sort.Sort(int64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeInt(k2)
+ e.mapElemValue()
+ e.e.EncodeFloat64(v[k2])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeUint(uint64(v2))
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeInt(k2)
+ e.mapElemValue()
+ e.e.EncodeFloat64(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapUintUintptrR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUintUintptrV(rv2i(rv).(map[uint]uintptr), e)
+func (e *Encoder) fastpathEncMapInt64BoolR(f *codecFnInfo, rv reflect.Value) {
+ fastpathTV.EncMapInt64BoolV(rv2i(rv).(map[int64]bool), e)
}
-func (_ fastpathT) EncMapUintUintptrV(v map[uint]uintptr, e *Encoder) {
+func (fastpathT) EncMapInt64BoolV(v map[int64]bool, e *Encoder) {
if v == nil {
e.e.EncodeNil()
return
}
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
+ e.mapStart(len(v))
if e.h.Canonical {
- v2 := make([]uint64, len(v))
+ v2 := make([]int64, len(v))
var i uint
for k := range v {
- v2[i] = uint64(k)
+ v2[i] = k
i++
}
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint(k2)))
- ee.WriteMapElemValue()
- e.encode(v[uint(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint(k2)))
- e.encode(v[uint(k2)])
- }
+ sort.Sort(int64Slice(v2))
+ for _, k2 := range v2 {
+ e.mapElemKey()
+ e.e.EncodeInt(k2)
+ e.mapElemValue()
+ e.e.EncodeBool(v[k2])
}
} else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- e.encode(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- e.encode(v2)
- }
+ for k2, v2 := range v {
+ e.mapElemKey()
+ e.e.EncodeInt(k2)
+ e.mapElemValue()
+ e.e.EncodeBool(v2)
}
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
-func (e *Encoder) fastpathEncMapUintIntR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUintIntV(rv2i(rv).(map[uint]int), e)
-}
-func (_ fastpathT) EncMapUintIntV(v map[uint]int, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[uint(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint(k2)))
- ee.EncodeInt(int64(v[uint(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
+// -- decode
-func (e *Encoder) fastpathEncMapUintInt8R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUintInt8V(rv2i(rv).(map[uint]int8), e)
-}
-func (_ fastpathT) EncMapUintInt8V(v map[uint]int8, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
+// -- -- fast path type switch
+func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool {
+ var changed bool
+ switch v := iv.(type) {
+
+ case []interface{}:
+ var v2 []interface{}
+ v2, changed = fastpathTV.DecSliceIntfV(v, false, d)
+ if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
+ copy(v, v2)
}
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[uint(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint(k2)))
- ee.EncodeInt(int64(v[uint(k2)]))
- }
+ case *[]interface{}:
+ var v2 []interface{}
+ v2, changed = fastpathTV.DecSliceIntfV(*v, true, d)
+ if changed {
+ *v = v2
}
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeInt(int64(v2))
- }
+ case []string:
+ var v2 []string
+ v2, changed = fastpathTV.DecSliceStringV(v, false, d)
+ if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
+ copy(v, v2)
}
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUintInt16R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUintInt16V(rv2i(rv).(map[uint]int16), e)
-}
-func (_ fastpathT) EncMapUintInt16V(v map[uint]int16, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
+ case *[]string:
+ var v2 []string
+ v2, changed = fastpathTV.DecSliceStringV(*v, true, d)
+ if changed {
+ *v = v2
}
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[uint(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint(k2)))
- ee.EncodeInt(int64(v[uint(k2)]))
- }
+ case [][]byte:
+ var v2 [][]byte
+ v2, changed = fastpathTV.DecSliceBytesV(v, false, d)
+ if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
+ copy(v, v2)
}
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeInt(int64(v2))
- }
+ case *[][]byte:
+ var v2 [][]byte
+ v2, changed = fastpathTV.DecSliceBytesV(*v, true, d)
+ if changed {
+ *v = v2
}
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUintInt32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUintInt32V(rv2i(rv).(map[uint]int32), e)
-}
-func (_ fastpathT) EncMapUintInt32V(v map[uint]int32, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
+ case []float32:
+ var v2 []float32
+ v2, changed = fastpathTV.DecSliceFloat32V(v, false, d)
+ if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
+ copy(v, v2)
}
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[uint(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint(k2)))
- ee.EncodeInt(int64(v[uint(k2)]))
- }
+ case *[]float32:
+ var v2 []float32
+ v2, changed = fastpathTV.DecSliceFloat32V(*v, true, d)
+ if changed {
+ *v = v2
}
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeInt(int64(v2))
- }
+ case []float64:
+ var v2 []float64
+ v2, changed = fastpathTV.DecSliceFloat64V(v, false, d)
+ if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
+ copy(v, v2)
}
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUintInt64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUintInt64V(rv2i(rv).(map[uint]int64), e)
-}
-func (_ fastpathT) EncMapUintInt64V(v map[uint]int64, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
+ case *[]float64:
+ var v2 []float64
+ v2, changed = fastpathTV.DecSliceFloat64V(*v, true, d)
+ if changed {
+ *v = v2
}
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[uint(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint(k2)))
- ee.EncodeInt(int64(v[uint(k2)]))
- }
+ case []uint:
+ var v2 []uint
+ v2, changed = fastpathTV.DecSliceUintV(v, false, d)
+ if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
+ copy(v, v2)
}
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeInt(int64(v2))
- }
+ case *[]uint:
+ var v2 []uint
+ v2, changed = fastpathTV.DecSliceUintV(*v, true, d)
+ if changed {
+ *v = v2
}
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUintFloat32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUintFloat32V(rv2i(rv).(map[uint]float32), e)
-}
-func (_ fastpathT) EncMapUintFloat32V(v map[uint]float32, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
+ case []uint16:
+ var v2 []uint16
+ v2, changed = fastpathTV.DecSliceUint16V(v, false, d)
+ if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
+ copy(v, v2)
}
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint(k2)))
- ee.WriteMapElemValue()
- ee.EncodeFloat32(v[uint(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint(k2)))
- ee.EncodeFloat32(v[uint(k2)])
- }
+ case *[]uint16:
+ var v2 []uint16
+ v2, changed = fastpathTV.DecSliceUint16V(*v, true, d)
+ if changed {
+ *v = v2
}
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeFloat32(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeFloat32(v2)
- }
+ case []uint32:
+ var v2 []uint32
+ v2, changed = fastpathTV.DecSliceUint32V(v, false, d)
+ if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
+ copy(v, v2)
}
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUintFloat64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUintFloat64V(rv2i(rv).(map[uint]float64), e)
-}
-func (_ fastpathT) EncMapUintFloat64V(v map[uint]float64, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
+ case *[]uint32:
+ var v2 []uint32
+ v2, changed = fastpathTV.DecSliceUint32V(*v, true, d)
+ if changed {
+ *v = v2
}
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint(k2)))
- ee.WriteMapElemValue()
- ee.EncodeFloat64(v[uint(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint(k2)))
- ee.EncodeFloat64(v[uint(k2)])
- }
+ case []uint64:
+ var v2 []uint64
+ v2, changed = fastpathTV.DecSliceUint64V(v, false, d)
+ if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
+ copy(v, v2)
}
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeFloat64(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeFloat64(v2)
- }
+ case *[]uint64:
+ var v2 []uint64
+ v2, changed = fastpathTV.DecSliceUint64V(*v, true, d)
+ if changed {
+ *v = v2
}
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUintBoolR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUintBoolV(rv2i(rv).(map[uint]bool), e)
-}
-func (_ fastpathT) EncMapUintBoolV(v map[uint]bool, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
+ case []uintptr:
+ var v2 []uintptr
+ v2, changed = fastpathTV.DecSliceUintptrV(v, false, d)
+ if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
+ copy(v, v2)
}
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint(k2)))
- ee.WriteMapElemValue()
- ee.EncodeBool(v[uint(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint(k2)))
- ee.EncodeBool(v[uint(k2)])
- }
+ case *[]uintptr:
+ var v2 []uintptr
+ v2, changed = fastpathTV.DecSliceUintptrV(*v, true, d)
+ if changed {
+ *v = v2
}
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeBool(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeBool(v2)
- }
+ case []int:
+ var v2 []int
+ v2, changed = fastpathTV.DecSliceIntV(v, false, d)
+ if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
+ copy(v, v2)
}
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint8IntfR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint8IntfV(rv2i(rv).(map[uint8]interface{}), e)
-}
-func (_ fastpathT) EncMapUint8IntfV(v map[uint8]interface{}, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint8(k2)))
- ee.WriteMapElemValue()
- e.encode(v[uint8(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint8(k2)))
- e.encode(v[uint8(k2)])
- }
+ case *[]int:
+ var v2 []int
+ v2, changed = fastpathTV.DecSliceIntV(*v, true, d)
+ if changed {
+ *v = v2
}
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- e.encode(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- e.encode(v2)
- }
+ case []int8:
+ var v2 []int8
+ v2, changed = fastpathTV.DecSliceInt8V(v, false, d)
+ if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
+ copy(v, v2)
}
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint8StringR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint8StringV(rv2i(rv).(map[uint8]string), e)
-}
-func (_ fastpathT) EncMapUint8StringV(v map[uint8]string, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
+ case *[]int8:
+ var v2 []int8
+ v2, changed = fastpathTV.DecSliceInt8V(*v, true, d)
+ if changed {
+ *v = v2
}
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint8(k2)))
- ee.WriteMapElemValue()
- ee.EncodeStringEnc(cUTF8, v[uint8(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint8(k2)))
- ee.EncodeStringEnc(cUTF8, v[uint8(k2)])
- }
+ case []int16:
+ var v2 []int16
+ v2, changed = fastpathTV.DecSliceInt16V(v, false, d)
+ if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
+ copy(v, v2)
}
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeStringEnc(cUTF8, v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeStringEnc(cUTF8, v2)
- }
+ case *[]int16:
+ var v2 []int16
+ v2, changed = fastpathTV.DecSliceInt16V(*v, true, d)
+ if changed {
+ *v = v2
}
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint8UintR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint8UintV(rv2i(rv).(map[uint8]uint), e)
-}
-func (_ fastpathT) EncMapUint8UintV(v map[uint8]uint, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
+ case []int32:
+ var v2 []int32
+ v2, changed = fastpathTV.DecSliceInt32V(v, false, d)
+ if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
+ copy(v, v2)
}
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint8(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[uint8(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint8(k2)))
- ee.EncodeUint(uint64(v[uint8(k2)]))
- }
+ case *[]int32:
+ var v2 []int32
+ v2, changed = fastpathTV.DecSliceInt32V(*v, true, d)
+ if changed {
+ *v = v2
}
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeUint(uint64(v2))
- }
+ case []int64:
+ var v2 []int64
+ v2, changed = fastpathTV.DecSliceInt64V(v, false, d)
+ if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
+ copy(v, v2)
}
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint8Uint8R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint8Uint8V(rv2i(rv).(map[uint8]uint8), e)
-}
-func (_ fastpathT) EncMapUint8Uint8V(v map[uint8]uint8, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
+ case *[]int64:
+ var v2 []int64
+ v2, changed = fastpathTV.DecSliceInt64V(*v, true, d)
+ if changed {
+ *v = v2
}
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint8(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[uint8(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint8(k2)))
- ee.EncodeUint(uint64(v[uint8(k2)]))
- }
+ case []bool:
+ var v2 []bool
+ v2, changed = fastpathTV.DecSliceBoolV(v, false, d)
+ if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
+ copy(v, v2)
}
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeUint(uint64(v2))
- }
+ case *[]bool:
+ var v2 []bool
+ v2, changed = fastpathTV.DecSliceBoolV(*v, true, d)
+ if changed {
+ *v = v2
}
- }
- ee.WriteMapEnd()
-}
-func (e *Encoder) fastpathEncMapUint8Uint16R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint8Uint16V(rv2i(rv).(map[uint8]uint16), e)
-}
-func (_ fastpathT) EncMapUint8Uint16V(v map[uint8]uint16, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
+ case map[string]interface{}:
+ fastpathTV.DecMapStringIntfV(v, false, d)
+ case *map[string]interface{}:
+ var v2 map[string]interface{}
+ v2, changed = fastpathTV.DecMapStringIntfV(*v, true, d)
+ if changed {
+ *v = v2
}
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint8(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[uint8(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint8(k2)))
- ee.EncodeUint(uint64(v[uint8(k2)]))
- }
+ case map[string]string:
+ fastpathTV.DecMapStringStringV(v, false, d)
+ case *map[string]string:
+ var v2 map[string]string
+ v2, changed = fastpathTV.DecMapStringStringV(*v, true, d)
+ if changed {
+ *v = v2
}
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeUint(uint64(v2))
- }
+ case map[string][]byte:
+ fastpathTV.DecMapStringBytesV(v, false, d)
+ case *map[string][]byte:
+ var v2 map[string][]byte
+ v2, changed = fastpathTV.DecMapStringBytesV(*v, true, d)
+ if changed {
+ *v = v2
}
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint8Uint32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint8Uint32V(rv2i(rv).(map[uint8]uint32), e)
-}
-func (_ fastpathT) EncMapUint8Uint32V(v map[uint8]uint32, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
+ case map[string]uint:
+ fastpathTV.DecMapStringUintV(v, false, d)
+ case *map[string]uint:
+ var v2 map[string]uint
+ v2, changed = fastpathTV.DecMapStringUintV(*v, true, d)
+ if changed {
+ *v = v2
}
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint8(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[uint8(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint8(k2)))
- ee.EncodeUint(uint64(v[uint8(k2)]))
- }
+ case map[string]uint8:
+ fastpathTV.DecMapStringUint8V(v, false, d)
+ case *map[string]uint8:
+ var v2 map[string]uint8
+ v2, changed = fastpathTV.DecMapStringUint8V(*v, true, d)
+ if changed {
+ *v = v2
}
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeUint(uint64(v2))
- }
+ case map[string]uint64:
+ fastpathTV.DecMapStringUint64V(v, false, d)
+ case *map[string]uint64:
+ var v2 map[string]uint64
+ v2, changed = fastpathTV.DecMapStringUint64V(*v, true, d)
+ if changed {
+ *v = v2
}
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint8Uint64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint8Uint64V(rv2i(rv).(map[uint8]uint64), e)
-}
-func (_ fastpathT) EncMapUint8Uint64V(v map[uint8]uint64, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
+ case map[string]uintptr:
+ fastpathTV.DecMapStringUintptrV(v, false, d)
+ case *map[string]uintptr:
+ var v2 map[string]uintptr
+ v2, changed = fastpathTV.DecMapStringUintptrV(*v, true, d)
+ if changed {
+ *v = v2
}
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint8(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[uint8(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint8(k2)))
- ee.EncodeUint(uint64(v[uint8(k2)]))
- }
+ case map[string]int:
+ fastpathTV.DecMapStringIntV(v, false, d)
+ case *map[string]int:
+ var v2 map[string]int
+ v2, changed = fastpathTV.DecMapStringIntV(*v, true, d)
+ if changed {
+ *v = v2
}
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeUint(uint64(v2))
- }
+ case map[string]int64:
+ fastpathTV.DecMapStringInt64V(v, false, d)
+ case *map[string]int64:
+ var v2 map[string]int64
+ v2, changed = fastpathTV.DecMapStringInt64V(*v, true, d)
+ if changed {
+ *v = v2
}
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint8UintptrR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint8UintptrV(rv2i(rv).(map[uint8]uintptr), e)
-}
-func (_ fastpathT) EncMapUint8UintptrV(v map[uint8]uintptr, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
+ case map[string]float32:
+ fastpathTV.DecMapStringFloat32V(v, false, d)
+ case *map[string]float32:
+ var v2 map[string]float32
+ v2, changed = fastpathTV.DecMapStringFloat32V(*v, true, d)
+ if changed {
+ *v = v2
}
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint8(k2)))
- ee.WriteMapElemValue()
- e.encode(v[uint8(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint8(k2)))
- e.encode(v[uint8(k2)])
- }
+ case map[string]float64:
+ fastpathTV.DecMapStringFloat64V(v, false, d)
+ case *map[string]float64:
+ var v2 map[string]float64
+ v2, changed = fastpathTV.DecMapStringFloat64V(*v, true, d)
+ if changed {
+ *v = v2
}
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- e.encode(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- e.encode(v2)
- }
+ case map[string]bool:
+ fastpathTV.DecMapStringBoolV(v, false, d)
+ case *map[string]bool:
+ var v2 map[string]bool
+ v2, changed = fastpathTV.DecMapStringBoolV(*v, true, d)
+ if changed {
+ *v = v2
}
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint8IntR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint8IntV(rv2i(rv).(map[uint8]int), e)
-}
-func (_ fastpathT) EncMapUint8IntV(v map[uint8]int, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
+ case map[uint]interface{}:
+ fastpathTV.DecMapUintIntfV(v, false, d)
+ case *map[uint]interface{}:
+ var v2 map[uint]interface{}
+ v2, changed = fastpathTV.DecMapUintIntfV(*v, true, d)
+ if changed {
+ *v = v2
}
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint8(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[uint8(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint8(k2)))
- ee.EncodeInt(int64(v[uint8(k2)]))
- }
+ case map[uint]string:
+ fastpathTV.DecMapUintStringV(v, false, d)
+ case *map[uint]string:
+ var v2 map[uint]string
+ v2, changed = fastpathTV.DecMapUintStringV(*v, true, d)
+ if changed {
+ *v = v2
}
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeInt(int64(v2))
- }
+ case map[uint][]byte:
+ fastpathTV.DecMapUintBytesV(v, false, d)
+ case *map[uint][]byte:
+ var v2 map[uint][]byte
+ v2, changed = fastpathTV.DecMapUintBytesV(*v, true, d)
+ if changed {
+ *v = v2
}
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint8Int8R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint8Int8V(rv2i(rv).(map[uint8]int8), e)
-}
-func (_ fastpathT) EncMapUint8Int8V(v map[uint8]int8, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
+ case map[uint]uint:
+ fastpathTV.DecMapUintUintV(v, false, d)
+ case *map[uint]uint:
+ var v2 map[uint]uint
+ v2, changed = fastpathTV.DecMapUintUintV(*v, true, d)
+ if changed {
+ *v = v2
}
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint8(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[uint8(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint8(k2)))
- ee.EncodeInt(int64(v[uint8(k2)]))
- }
+ case map[uint]uint8:
+ fastpathTV.DecMapUintUint8V(v, false, d)
+ case *map[uint]uint8:
+ var v2 map[uint]uint8
+ v2, changed = fastpathTV.DecMapUintUint8V(*v, true, d)
+ if changed {
+ *v = v2
}
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeInt(int64(v2))
- }
+ case map[uint]uint64:
+ fastpathTV.DecMapUintUint64V(v, false, d)
+ case *map[uint]uint64:
+ var v2 map[uint]uint64
+ v2, changed = fastpathTV.DecMapUintUint64V(*v, true, d)
+ if changed {
+ *v = v2
}
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint8Int16R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint8Int16V(rv2i(rv).(map[uint8]int16), e)
-}
-func (_ fastpathT) EncMapUint8Int16V(v map[uint8]int16, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
+ case map[uint]uintptr:
+ fastpathTV.DecMapUintUintptrV(v, false, d)
+ case *map[uint]uintptr:
+ var v2 map[uint]uintptr
+ v2, changed = fastpathTV.DecMapUintUintptrV(*v, true, d)
+ if changed {
+ *v = v2
}
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint8(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[uint8(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint8(k2)))
- ee.EncodeInt(int64(v[uint8(k2)]))
- }
+ case map[uint]int:
+ fastpathTV.DecMapUintIntV(v, false, d)
+ case *map[uint]int:
+ var v2 map[uint]int
+ v2, changed = fastpathTV.DecMapUintIntV(*v, true, d)
+ if changed {
+ *v = v2
}
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeInt(int64(v2))
- }
+ case map[uint]int64:
+ fastpathTV.DecMapUintInt64V(v, false, d)
+ case *map[uint]int64:
+ var v2 map[uint]int64
+ v2, changed = fastpathTV.DecMapUintInt64V(*v, true, d)
+ if changed {
+ *v = v2
}
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint8Int32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint8Int32V(rv2i(rv).(map[uint8]int32), e)
-}
-func (_ fastpathT) EncMapUint8Int32V(v map[uint8]int32, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
+ case map[uint]float32:
+ fastpathTV.DecMapUintFloat32V(v, false, d)
+ case *map[uint]float32:
+ var v2 map[uint]float32
+ v2, changed = fastpathTV.DecMapUintFloat32V(*v, true, d)
+ if changed {
+ *v = v2
}
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint8(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[uint8(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint8(k2)))
- ee.EncodeInt(int64(v[uint8(k2)]))
- }
+ case map[uint]float64:
+ fastpathTV.DecMapUintFloat64V(v, false, d)
+ case *map[uint]float64:
+ var v2 map[uint]float64
+ v2, changed = fastpathTV.DecMapUintFloat64V(*v, true, d)
+ if changed {
+ *v = v2
}
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeInt(int64(v2))
- }
+ case map[uint]bool:
+ fastpathTV.DecMapUintBoolV(v, false, d)
+ case *map[uint]bool:
+ var v2 map[uint]bool
+ v2, changed = fastpathTV.DecMapUintBoolV(*v, true, d)
+ if changed {
+ *v = v2
}
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint8Int64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint8Int64V(rv2i(rv).(map[uint8]int64), e)
-}
-func (_ fastpathT) EncMapUint8Int64V(v map[uint8]int64, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
+ case map[uint8]interface{}:
+ fastpathTV.DecMapUint8IntfV(v, false, d)
+ case *map[uint8]interface{}:
+ var v2 map[uint8]interface{}
+ v2, changed = fastpathTV.DecMapUint8IntfV(*v, true, d)
+ if changed {
+ *v = v2
}
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint8(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[uint8(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint8(k2)))
- ee.EncodeInt(int64(v[uint8(k2)]))
- }
+ case map[uint8]string:
+ fastpathTV.DecMapUint8StringV(v, false, d)
+ case *map[uint8]string:
+ var v2 map[uint8]string
+ v2, changed = fastpathTV.DecMapUint8StringV(*v, true, d)
+ if changed {
+ *v = v2
}
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeInt(int64(v2))
- }
+ case map[uint8][]byte:
+ fastpathTV.DecMapUint8BytesV(v, false, d)
+ case *map[uint8][]byte:
+ var v2 map[uint8][]byte
+ v2, changed = fastpathTV.DecMapUint8BytesV(*v, true, d)
+ if changed {
+ *v = v2
}
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint8Float32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint8Float32V(rv2i(rv).(map[uint8]float32), e)
-}
-func (_ fastpathT) EncMapUint8Float32V(v map[uint8]float32, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
+ case map[uint8]uint:
+ fastpathTV.DecMapUint8UintV(v, false, d)
+ case *map[uint8]uint:
+ var v2 map[uint8]uint
+ v2, changed = fastpathTV.DecMapUint8UintV(*v, true, d)
+ if changed {
+ *v = v2
}
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint8(k2)))
- ee.WriteMapElemValue()
- ee.EncodeFloat32(v[uint8(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint8(k2)))
- ee.EncodeFloat32(v[uint8(k2)])
- }
+ case map[uint8]uint8:
+ fastpathTV.DecMapUint8Uint8V(v, false, d)
+ case *map[uint8]uint8:
+ var v2 map[uint8]uint8
+ v2, changed = fastpathTV.DecMapUint8Uint8V(*v, true, d)
+ if changed {
+ *v = v2
}
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeFloat32(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeFloat32(v2)
- }
+ case map[uint8]uint64:
+ fastpathTV.DecMapUint8Uint64V(v, false, d)
+ case *map[uint8]uint64:
+ var v2 map[uint8]uint64
+ v2, changed = fastpathTV.DecMapUint8Uint64V(*v, true, d)
+ if changed {
+ *v = v2
}
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint8Float64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint8Float64V(rv2i(rv).(map[uint8]float64), e)
-}
-func (_ fastpathT) EncMapUint8Float64V(v map[uint8]float64, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
+ case map[uint8]uintptr:
+ fastpathTV.DecMapUint8UintptrV(v, false, d)
+ case *map[uint8]uintptr:
+ var v2 map[uint8]uintptr
+ v2, changed = fastpathTV.DecMapUint8UintptrV(*v, true, d)
+ if changed {
+ *v = v2
}
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint8(k2)))
- ee.WriteMapElemValue()
- ee.EncodeFloat64(v[uint8(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint8(k2)))
- ee.EncodeFloat64(v[uint8(k2)])
- }
+ case map[uint8]int:
+ fastpathTV.DecMapUint8IntV(v, false, d)
+ case *map[uint8]int:
+ var v2 map[uint8]int
+ v2, changed = fastpathTV.DecMapUint8IntV(*v, true, d)
+ if changed {
+ *v = v2
}
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeFloat64(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeFloat64(v2)
- }
+ case map[uint8]int64:
+ fastpathTV.DecMapUint8Int64V(v, false, d)
+ case *map[uint8]int64:
+ var v2 map[uint8]int64
+ v2, changed = fastpathTV.DecMapUint8Int64V(*v, true, d)
+ if changed {
+ *v = v2
}
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint8BoolR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint8BoolV(rv2i(rv).(map[uint8]bool), e)
-}
-func (_ fastpathT) EncMapUint8BoolV(v map[uint8]bool, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
+ case map[uint8]float32:
+ fastpathTV.DecMapUint8Float32V(v, false, d)
+ case *map[uint8]float32:
+ var v2 map[uint8]float32
+ v2, changed = fastpathTV.DecMapUint8Float32V(*v, true, d)
+ if changed {
+ *v = v2
}
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint8(k2)))
- ee.WriteMapElemValue()
- ee.EncodeBool(v[uint8(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint8(k2)))
- ee.EncodeBool(v[uint8(k2)])
- }
+ case map[uint8]float64:
+ fastpathTV.DecMapUint8Float64V(v, false, d)
+ case *map[uint8]float64:
+ var v2 map[uint8]float64
+ v2, changed = fastpathTV.DecMapUint8Float64V(*v, true, d)
+ if changed {
+ *v = v2
}
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeBool(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeBool(v2)
- }
+ case map[uint8]bool:
+ fastpathTV.DecMapUint8BoolV(v, false, d)
+ case *map[uint8]bool:
+ var v2 map[uint8]bool
+ v2, changed = fastpathTV.DecMapUint8BoolV(*v, true, d)
+ if changed {
+ *v = v2
}
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint16IntfR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint16IntfV(rv2i(rv).(map[uint16]interface{}), e)
-}
-func (_ fastpathT) EncMapUint16IntfV(v map[uint16]interface{}, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
+ case map[uint64]interface{}:
+ fastpathTV.DecMapUint64IntfV(v, false, d)
+ case *map[uint64]interface{}:
+ var v2 map[uint64]interface{}
+ v2, changed = fastpathTV.DecMapUint64IntfV(*v, true, d)
+ if changed {
+ *v = v2
}
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint16(k2)))
- ee.WriteMapElemValue()
- e.encode(v[uint16(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint16(k2)))
- e.encode(v[uint16(k2)])
- }
+ case map[uint64]string:
+ fastpathTV.DecMapUint64StringV(v, false, d)
+ case *map[uint64]string:
+ var v2 map[uint64]string
+ v2, changed = fastpathTV.DecMapUint64StringV(*v, true, d)
+ if changed {
+ *v = v2
}
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- e.encode(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- e.encode(v2)
- }
+ case map[uint64][]byte:
+ fastpathTV.DecMapUint64BytesV(v, false, d)
+ case *map[uint64][]byte:
+ var v2 map[uint64][]byte
+ v2, changed = fastpathTV.DecMapUint64BytesV(*v, true, d)
+ if changed {
+ *v = v2
}
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint16StringR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint16StringV(rv2i(rv).(map[uint16]string), e)
-}
-func (_ fastpathT) EncMapUint16StringV(v map[uint16]string, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
+ case map[uint64]uint:
+ fastpathTV.DecMapUint64UintV(v, false, d)
+ case *map[uint64]uint:
+ var v2 map[uint64]uint
+ v2, changed = fastpathTV.DecMapUint64UintV(*v, true, d)
+ if changed {
+ *v = v2
}
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint16(k2)))
- ee.WriteMapElemValue()
- ee.EncodeStringEnc(cUTF8, v[uint16(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint16(k2)))
- ee.EncodeStringEnc(cUTF8, v[uint16(k2)])
- }
+ case map[uint64]uint8:
+ fastpathTV.DecMapUint64Uint8V(v, false, d)
+ case *map[uint64]uint8:
+ var v2 map[uint64]uint8
+ v2, changed = fastpathTV.DecMapUint64Uint8V(*v, true, d)
+ if changed {
+ *v = v2
}
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeStringEnc(cUTF8, v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeStringEnc(cUTF8, v2)
- }
+ case map[uint64]uint64:
+ fastpathTV.DecMapUint64Uint64V(v, false, d)
+ case *map[uint64]uint64:
+ var v2 map[uint64]uint64
+ v2, changed = fastpathTV.DecMapUint64Uint64V(*v, true, d)
+ if changed {
+ *v = v2
}
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint16UintR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint16UintV(rv2i(rv).(map[uint16]uint), e)
-}
-func (_ fastpathT) EncMapUint16UintV(v map[uint16]uint, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
+ case map[uint64]uintptr:
+ fastpathTV.DecMapUint64UintptrV(v, false, d)
+ case *map[uint64]uintptr:
+ var v2 map[uint64]uintptr
+ v2, changed = fastpathTV.DecMapUint64UintptrV(*v, true, d)
+ if changed {
+ *v = v2
}
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint16(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[uint16(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint16(k2)))
- ee.EncodeUint(uint64(v[uint16(k2)]))
- }
+ case map[uint64]int:
+ fastpathTV.DecMapUint64IntV(v, false, d)
+ case *map[uint64]int:
+ var v2 map[uint64]int
+ v2, changed = fastpathTV.DecMapUint64IntV(*v, true, d)
+ if changed {
+ *v = v2
}
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeUint(uint64(v2))
- }
+ case map[uint64]int64:
+ fastpathTV.DecMapUint64Int64V(v, false, d)
+ case *map[uint64]int64:
+ var v2 map[uint64]int64
+ v2, changed = fastpathTV.DecMapUint64Int64V(*v, true, d)
+ if changed {
+ *v = v2
}
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint16Uint8R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint16Uint8V(rv2i(rv).(map[uint16]uint8), e)
-}
-func (_ fastpathT) EncMapUint16Uint8V(v map[uint16]uint8, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
+ case map[uint64]float32:
+ fastpathTV.DecMapUint64Float32V(v, false, d)
+ case *map[uint64]float32:
+ var v2 map[uint64]float32
+ v2, changed = fastpathTV.DecMapUint64Float32V(*v, true, d)
+ if changed {
+ *v = v2
}
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint16(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[uint16(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint16(k2)))
- ee.EncodeUint(uint64(v[uint16(k2)]))
- }
+ case map[uint64]float64:
+ fastpathTV.DecMapUint64Float64V(v, false, d)
+ case *map[uint64]float64:
+ var v2 map[uint64]float64
+ v2, changed = fastpathTV.DecMapUint64Float64V(*v, true, d)
+ if changed {
+ *v = v2
}
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeUint(uint64(v2))
- }
+ case map[uint64]bool:
+ fastpathTV.DecMapUint64BoolV(v, false, d)
+ case *map[uint64]bool:
+ var v2 map[uint64]bool
+ v2, changed = fastpathTV.DecMapUint64BoolV(*v, true, d)
+ if changed {
+ *v = v2
}
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint16Uint16R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint16Uint16V(rv2i(rv).(map[uint16]uint16), e)
-}
-func (_ fastpathT) EncMapUint16Uint16V(v map[uint16]uint16, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
+ case map[int]interface{}:
+ fastpathTV.DecMapIntIntfV(v, false, d)
+ case *map[int]interface{}:
+ var v2 map[int]interface{}
+ v2, changed = fastpathTV.DecMapIntIntfV(*v, true, d)
+ if changed {
+ *v = v2
}
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint16(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[uint16(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint16(k2)))
- ee.EncodeUint(uint64(v[uint16(k2)]))
- }
+ case map[int]string:
+ fastpathTV.DecMapIntStringV(v, false, d)
+ case *map[int]string:
+ var v2 map[int]string
+ v2, changed = fastpathTV.DecMapIntStringV(*v, true, d)
+ if changed {
+ *v = v2
}
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeUint(uint64(v2))
- }
+ case map[int][]byte:
+ fastpathTV.DecMapIntBytesV(v, false, d)
+ case *map[int][]byte:
+ var v2 map[int][]byte
+ v2, changed = fastpathTV.DecMapIntBytesV(*v, true, d)
+ if changed {
+ *v = v2
}
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint16Uint32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint16Uint32V(rv2i(rv).(map[uint16]uint32), e)
-}
-func (_ fastpathT) EncMapUint16Uint32V(v map[uint16]uint32, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
+ case map[int]uint:
+ fastpathTV.DecMapIntUintV(v, false, d)
+ case *map[int]uint:
+ var v2 map[int]uint
+ v2, changed = fastpathTV.DecMapIntUintV(*v, true, d)
+ if changed {
+ *v = v2
}
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint16(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[uint16(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint16(k2)))
- ee.EncodeUint(uint64(v[uint16(k2)]))
- }
+ case map[int]uint8:
+ fastpathTV.DecMapIntUint8V(v, false, d)
+ case *map[int]uint8:
+ var v2 map[int]uint8
+ v2, changed = fastpathTV.DecMapIntUint8V(*v, true, d)
+ if changed {
+ *v = v2
}
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeUint(uint64(v2))
- }
+ case map[int]uint64:
+ fastpathTV.DecMapIntUint64V(v, false, d)
+ case *map[int]uint64:
+ var v2 map[int]uint64
+ v2, changed = fastpathTV.DecMapIntUint64V(*v, true, d)
+ if changed {
+ *v = v2
}
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint16Uint64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint16Uint64V(rv2i(rv).(map[uint16]uint64), e)
-}
-func (_ fastpathT) EncMapUint16Uint64V(v map[uint16]uint64, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
+ case map[int]uintptr:
+ fastpathTV.DecMapIntUintptrV(v, false, d)
+ case *map[int]uintptr:
+ var v2 map[int]uintptr
+ v2, changed = fastpathTV.DecMapIntUintptrV(*v, true, d)
+ if changed {
+ *v = v2
}
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint16(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[uint16(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint16(k2)))
- ee.EncodeUint(uint64(v[uint16(k2)]))
- }
+ case map[int]int:
+ fastpathTV.DecMapIntIntV(v, false, d)
+ case *map[int]int:
+ var v2 map[int]int
+ v2, changed = fastpathTV.DecMapIntIntV(*v, true, d)
+ if changed {
+ *v = v2
}
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeUint(uint64(v2))
- }
+ case map[int]int64:
+ fastpathTV.DecMapIntInt64V(v, false, d)
+ case *map[int]int64:
+ var v2 map[int]int64
+ v2, changed = fastpathTV.DecMapIntInt64V(*v, true, d)
+ if changed {
+ *v = v2
}
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint16UintptrR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint16UintptrV(rv2i(rv).(map[uint16]uintptr), e)
-}
-func (_ fastpathT) EncMapUint16UintptrV(v map[uint16]uintptr, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
+ case map[int]float32:
+ fastpathTV.DecMapIntFloat32V(v, false, d)
+ case *map[int]float32:
+ var v2 map[int]float32
+ v2, changed = fastpathTV.DecMapIntFloat32V(*v, true, d)
+ if changed {
+ *v = v2
}
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint16(k2)))
- ee.WriteMapElemValue()
- e.encode(v[uint16(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint16(k2)))
- e.encode(v[uint16(k2)])
- }
+ case map[int]float64:
+ fastpathTV.DecMapIntFloat64V(v, false, d)
+ case *map[int]float64:
+ var v2 map[int]float64
+ v2, changed = fastpathTV.DecMapIntFloat64V(*v, true, d)
+ if changed {
+ *v = v2
}
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- e.encode(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- e.encode(v2)
- }
+ case map[int]bool:
+ fastpathTV.DecMapIntBoolV(v, false, d)
+ case *map[int]bool:
+ var v2 map[int]bool
+ v2, changed = fastpathTV.DecMapIntBoolV(*v, true, d)
+ if changed {
+ *v = v2
}
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint16IntR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint16IntV(rv2i(rv).(map[uint16]int), e)
-}
-func (_ fastpathT) EncMapUint16IntV(v map[uint16]int, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
+ case map[int64]interface{}:
+ fastpathTV.DecMapInt64IntfV(v, false, d)
+ case *map[int64]interface{}:
+ var v2 map[int64]interface{}
+ v2, changed = fastpathTV.DecMapInt64IntfV(*v, true, d)
+ if changed {
+ *v = v2
}
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint16(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[uint16(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint16(k2)))
- ee.EncodeInt(int64(v[uint16(k2)]))
- }
+ case map[int64]string:
+ fastpathTV.DecMapInt64StringV(v, false, d)
+ case *map[int64]string:
+ var v2 map[int64]string
+ v2, changed = fastpathTV.DecMapInt64StringV(*v, true, d)
+ if changed {
+ *v = v2
}
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeInt(int64(v2))
- }
+ case map[int64][]byte:
+ fastpathTV.DecMapInt64BytesV(v, false, d)
+ case *map[int64][]byte:
+ var v2 map[int64][]byte
+ v2, changed = fastpathTV.DecMapInt64BytesV(*v, true, d)
+ if changed {
+ *v = v2
}
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint16Int8R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint16Int8V(rv2i(rv).(map[uint16]int8), e)
-}
-func (_ fastpathT) EncMapUint16Int8V(v map[uint16]int8, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint16(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[uint16(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint16(k2)))
- ee.EncodeInt(int64(v[uint16(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint16Int16R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint16Int16V(rv2i(rv).(map[uint16]int16), e)
-}
-func (_ fastpathT) EncMapUint16Int16V(v map[uint16]int16, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint16(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[uint16(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint16(k2)))
- ee.EncodeInt(int64(v[uint16(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint16Int32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint16Int32V(rv2i(rv).(map[uint16]int32), e)
-}
-func (_ fastpathT) EncMapUint16Int32V(v map[uint16]int32, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint16(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[uint16(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint16(k2)))
- ee.EncodeInt(int64(v[uint16(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint16Int64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint16Int64V(rv2i(rv).(map[uint16]int64), e)
-}
-func (_ fastpathT) EncMapUint16Int64V(v map[uint16]int64, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint16(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[uint16(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint16(k2)))
- ee.EncodeInt(int64(v[uint16(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint16Float32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint16Float32V(rv2i(rv).(map[uint16]float32), e)
-}
-func (_ fastpathT) EncMapUint16Float32V(v map[uint16]float32, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint16(k2)))
- ee.WriteMapElemValue()
- ee.EncodeFloat32(v[uint16(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint16(k2)))
- ee.EncodeFloat32(v[uint16(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeFloat32(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeFloat32(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint16Float64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint16Float64V(rv2i(rv).(map[uint16]float64), e)
-}
-func (_ fastpathT) EncMapUint16Float64V(v map[uint16]float64, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint16(k2)))
- ee.WriteMapElemValue()
- ee.EncodeFloat64(v[uint16(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint16(k2)))
- ee.EncodeFloat64(v[uint16(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeFloat64(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeFloat64(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint16BoolR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint16BoolV(rv2i(rv).(map[uint16]bool), e)
-}
-func (_ fastpathT) EncMapUint16BoolV(v map[uint16]bool, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint16(k2)))
- ee.WriteMapElemValue()
- ee.EncodeBool(v[uint16(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint16(k2)))
- ee.EncodeBool(v[uint16(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeBool(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeBool(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint32IntfR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint32IntfV(rv2i(rv).(map[uint32]interface{}), e)
-}
-func (_ fastpathT) EncMapUint32IntfV(v map[uint32]interface{}, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint32(k2)))
- ee.WriteMapElemValue()
- e.encode(v[uint32(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint32(k2)))
- e.encode(v[uint32(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- e.encode(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- e.encode(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint32StringR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint32StringV(rv2i(rv).(map[uint32]string), e)
-}
-func (_ fastpathT) EncMapUint32StringV(v map[uint32]string, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint32(k2)))
- ee.WriteMapElemValue()
- ee.EncodeStringEnc(cUTF8, v[uint32(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint32(k2)))
- ee.EncodeStringEnc(cUTF8, v[uint32(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeStringEnc(cUTF8, v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeStringEnc(cUTF8, v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint32UintR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint32UintV(rv2i(rv).(map[uint32]uint), e)
-}
-func (_ fastpathT) EncMapUint32UintV(v map[uint32]uint, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint32(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[uint32(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint32(k2)))
- ee.EncodeUint(uint64(v[uint32(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint32Uint8R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint32Uint8V(rv2i(rv).(map[uint32]uint8), e)
-}
-func (_ fastpathT) EncMapUint32Uint8V(v map[uint32]uint8, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint32(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[uint32(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint32(k2)))
- ee.EncodeUint(uint64(v[uint32(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint32Uint16R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint32Uint16V(rv2i(rv).(map[uint32]uint16), e)
-}
-func (_ fastpathT) EncMapUint32Uint16V(v map[uint32]uint16, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint32(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[uint32(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint32(k2)))
- ee.EncodeUint(uint64(v[uint32(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint32Uint32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint32Uint32V(rv2i(rv).(map[uint32]uint32), e)
-}
-func (_ fastpathT) EncMapUint32Uint32V(v map[uint32]uint32, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint32(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[uint32(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint32(k2)))
- ee.EncodeUint(uint64(v[uint32(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint32Uint64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint32Uint64V(rv2i(rv).(map[uint32]uint64), e)
-}
-func (_ fastpathT) EncMapUint32Uint64V(v map[uint32]uint64, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint32(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[uint32(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint32(k2)))
- ee.EncodeUint(uint64(v[uint32(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint32UintptrR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint32UintptrV(rv2i(rv).(map[uint32]uintptr), e)
-}
-func (_ fastpathT) EncMapUint32UintptrV(v map[uint32]uintptr, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint32(k2)))
- ee.WriteMapElemValue()
- e.encode(v[uint32(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint32(k2)))
- e.encode(v[uint32(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- e.encode(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- e.encode(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint32IntR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint32IntV(rv2i(rv).(map[uint32]int), e)
-}
-func (_ fastpathT) EncMapUint32IntV(v map[uint32]int, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint32(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[uint32(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint32(k2)))
- ee.EncodeInt(int64(v[uint32(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint32Int8R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint32Int8V(rv2i(rv).(map[uint32]int8), e)
-}
-func (_ fastpathT) EncMapUint32Int8V(v map[uint32]int8, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint32(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[uint32(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint32(k2)))
- ee.EncodeInt(int64(v[uint32(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint32Int16R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint32Int16V(rv2i(rv).(map[uint32]int16), e)
-}
-func (_ fastpathT) EncMapUint32Int16V(v map[uint32]int16, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint32(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[uint32(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint32(k2)))
- ee.EncodeInt(int64(v[uint32(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint32Int32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint32Int32V(rv2i(rv).(map[uint32]int32), e)
-}
-func (_ fastpathT) EncMapUint32Int32V(v map[uint32]int32, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint32(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[uint32(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint32(k2)))
- ee.EncodeInt(int64(v[uint32(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint32Int64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint32Int64V(rv2i(rv).(map[uint32]int64), e)
-}
-func (_ fastpathT) EncMapUint32Int64V(v map[uint32]int64, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint32(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[uint32(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint32(k2)))
- ee.EncodeInt(int64(v[uint32(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint32Float32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint32Float32V(rv2i(rv).(map[uint32]float32), e)
-}
-func (_ fastpathT) EncMapUint32Float32V(v map[uint32]float32, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint32(k2)))
- ee.WriteMapElemValue()
- ee.EncodeFloat32(v[uint32(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint32(k2)))
- ee.EncodeFloat32(v[uint32(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeFloat32(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeFloat32(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint32Float64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint32Float64V(rv2i(rv).(map[uint32]float64), e)
-}
-func (_ fastpathT) EncMapUint32Float64V(v map[uint32]float64, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint32(k2)))
- ee.WriteMapElemValue()
- ee.EncodeFloat64(v[uint32(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint32(k2)))
- ee.EncodeFloat64(v[uint32(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeFloat64(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeFloat64(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint32BoolR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint32BoolV(rv2i(rv).(map[uint32]bool), e)
-}
-func (_ fastpathT) EncMapUint32BoolV(v map[uint32]bool, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint32(k2)))
- ee.WriteMapElemValue()
- ee.EncodeBool(v[uint32(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint32(k2)))
- ee.EncodeBool(v[uint32(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeBool(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeBool(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint64IntfR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint64IntfV(rv2i(rv).(map[uint64]interface{}), e)
-}
-func (_ fastpathT) EncMapUint64IntfV(v map[uint64]interface{}, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint64(k2)))
- ee.WriteMapElemValue()
- e.encode(v[uint64(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint64(k2)))
- e.encode(v[uint64(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- e.encode(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- e.encode(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint64StringR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint64StringV(rv2i(rv).(map[uint64]string), e)
-}
-func (_ fastpathT) EncMapUint64StringV(v map[uint64]string, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint64(k2)))
- ee.WriteMapElemValue()
- ee.EncodeStringEnc(cUTF8, v[uint64(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint64(k2)))
- ee.EncodeStringEnc(cUTF8, v[uint64(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeStringEnc(cUTF8, v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeStringEnc(cUTF8, v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint64UintR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint64UintV(rv2i(rv).(map[uint64]uint), e)
-}
-func (_ fastpathT) EncMapUint64UintV(v map[uint64]uint, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint64(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[uint64(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint64(k2)))
- ee.EncodeUint(uint64(v[uint64(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint64Uint8R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint64Uint8V(rv2i(rv).(map[uint64]uint8), e)
-}
-func (_ fastpathT) EncMapUint64Uint8V(v map[uint64]uint8, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint64(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[uint64(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint64(k2)))
- ee.EncodeUint(uint64(v[uint64(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint64Uint16R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint64Uint16V(rv2i(rv).(map[uint64]uint16), e)
-}
-func (_ fastpathT) EncMapUint64Uint16V(v map[uint64]uint16, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint64(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[uint64(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint64(k2)))
- ee.EncodeUint(uint64(v[uint64(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint64Uint32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint64Uint32V(rv2i(rv).(map[uint64]uint32), e)
-}
-func (_ fastpathT) EncMapUint64Uint32V(v map[uint64]uint32, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint64(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[uint64(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint64(k2)))
- ee.EncodeUint(uint64(v[uint64(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint64Uint64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint64Uint64V(rv2i(rv).(map[uint64]uint64), e)
-}
-func (_ fastpathT) EncMapUint64Uint64V(v map[uint64]uint64, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint64(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[uint64(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint64(k2)))
- ee.EncodeUint(uint64(v[uint64(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint64UintptrR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint64UintptrV(rv2i(rv).(map[uint64]uintptr), e)
-}
-func (_ fastpathT) EncMapUint64UintptrV(v map[uint64]uintptr, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint64(k2)))
- ee.WriteMapElemValue()
- e.encode(v[uint64(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint64(k2)))
- e.encode(v[uint64(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- e.encode(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- e.encode(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint64IntR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint64IntV(rv2i(rv).(map[uint64]int), e)
-}
-func (_ fastpathT) EncMapUint64IntV(v map[uint64]int, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint64(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[uint64(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint64(k2)))
- ee.EncodeInt(int64(v[uint64(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint64Int8R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint64Int8V(rv2i(rv).(map[uint64]int8), e)
-}
-func (_ fastpathT) EncMapUint64Int8V(v map[uint64]int8, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint64(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[uint64(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint64(k2)))
- ee.EncodeInt(int64(v[uint64(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint64Int16R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint64Int16V(rv2i(rv).(map[uint64]int16), e)
-}
-func (_ fastpathT) EncMapUint64Int16V(v map[uint64]int16, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint64(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[uint64(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint64(k2)))
- ee.EncodeInt(int64(v[uint64(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint64Int32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint64Int32V(rv2i(rv).(map[uint64]int32), e)
-}
-func (_ fastpathT) EncMapUint64Int32V(v map[uint64]int32, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint64(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[uint64(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint64(k2)))
- ee.EncodeInt(int64(v[uint64(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint64Int64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint64Int64V(rv2i(rv).(map[uint64]int64), e)
-}
-func (_ fastpathT) EncMapUint64Int64V(v map[uint64]int64, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint64(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[uint64(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint64(k2)))
- ee.EncodeInt(int64(v[uint64(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint64Float32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint64Float32V(rv2i(rv).(map[uint64]float32), e)
-}
-func (_ fastpathT) EncMapUint64Float32V(v map[uint64]float32, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint64(k2)))
- ee.WriteMapElemValue()
- ee.EncodeFloat32(v[uint64(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint64(k2)))
- ee.EncodeFloat32(v[uint64(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeFloat32(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeFloat32(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint64Float64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint64Float64V(rv2i(rv).(map[uint64]float64), e)
-}
-func (_ fastpathT) EncMapUint64Float64V(v map[uint64]float64, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint64(k2)))
- ee.WriteMapElemValue()
- ee.EncodeFloat64(v[uint64(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint64(k2)))
- ee.EncodeFloat64(v[uint64(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeFloat64(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeFloat64(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUint64BoolR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUint64BoolV(rv2i(rv).(map[uint64]bool), e)
-}
-func (_ fastpathT) EncMapUint64BoolV(v map[uint64]bool, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(uint64(k2)))
- ee.WriteMapElemValue()
- ee.EncodeBool(v[uint64(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeUint(uint64(uint64(k2)))
- ee.EncodeBool(v[uint64(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeUint(uint64(k2))
- ee.WriteMapElemValue()
- ee.EncodeBool(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeUint(uint64(k2))
- ee.EncodeBool(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUintptrIntfR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUintptrIntfV(rv2i(rv).(map[uintptr]interface{}), e)
-}
-func (_ fastpathT) EncMapUintptrIntfV(v map[uintptr]interface{}, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- e.encode(uintptr(k2))
- ee.WriteMapElemValue()
- e.encode(v[uintptr(k2)])
- }
- } else {
- for _, k2 := range v2 {
- e.encode(uintptr(k2))
- e.encode(v[uintptr(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- e.encode(k2)
- ee.WriteMapElemValue()
- e.encode(v2)
- }
- } else {
- for k2, v2 := range v {
- e.encode(k2)
- e.encode(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUintptrStringR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUintptrStringV(rv2i(rv).(map[uintptr]string), e)
-}
-func (_ fastpathT) EncMapUintptrStringV(v map[uintptr]string, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- e.encode(uintptr(k2))
- ee.WriteMapElemValue()
- ee.EncodeStringEnc(cUTF8, v[uintptr(k2)])
- }
- } else {
- for _, k2 := range v2 {
- e.encode(uintptr(k2))
- ee.EncodeStringEnc(cUTF8, v[uintptr(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- e.encode(k2)
- ee.WriteMapElemValue()
- ee.EncodeStringEnc(cUTF8, v2)
- }
- } else {
- for k2, v2 := range v {
- e.encode(k2)
- ee.EncodeStringEnc(cUTF8, v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUintptrUintR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUintptrUintV(rv2i(rv).(map[uintptr]uint), e)
-}
-func (_ fastpathT) EncMapUintptrUintV(v map[uintptr]uint, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- e.encode(uintptr(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[uintptr(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- e.encode(uintptr(k2))
- ee.EncodeUint(uint64(v[uintptr(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- e.encode(k2)
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- e.encode(k2)
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUintptrUint8R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUintptrUint8V(rv2i(rv).(map[uintptr]uint8), e)
-}
-func (_ fastpathT) EncMapUintptrUint8V(v map[uintptr]uint8, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- e.encode(uintptr(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[uintptr(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- e.encode(uintptr(k2))
- ee.EncodeUint(uint64(v[uintptr(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- e.encode(k2)
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- e.encode(k2)
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUintptrUint16R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUintptrUint16V(rv2i(rv).(map[uintptr]uint16), e)
-}
-func (_ fastpathT) EncMapUintptrUint16V(v map[uintptr]uint16, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- e.encode(uintptr(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[uintptr(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- e.encode(uintptr(k2))
- ee.EncodeUint(uint64(v[uintptr(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- e.encode(k2)
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- e.encode(k2)
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUintptrUint32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUintptrUint32V(rv2i(rv).(map[uintptr]uint32), e)
-}
-func (_ fastpathT) EncMapUintptrUint32V(v map[uintptr]uint32, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- e.encode(uintptr(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[uintptr(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- e.encode(uintptr(k2))
- ee.EncodeUint(uint64(v[uintptr(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- e.encode(k2)
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- e.encode(k2)
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUintptrUint64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUintptrUint64V(rv2i(rv).(map[uintptr]uint64), e)
-}
-func (_ fastpathT) EncMapUintptrUint64V(v map[uintptr]uint64, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- e.encode(uintptr(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[uintptr(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- e.encode(uintptr(k2))
- ee.EncodeUint(uint64(v[uintptr(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- e.encode(k2)
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- e.encode(k2)
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUintptrUintptrR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUintptrUintptrV(rv2i(rv).(map[uintptr]uintptr), e)
-}
-func (_ fastpathT) EncMapUintptrUintptrV(v map[uintptr]uintptr, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- e.encode(uintptr(k2))
- ee.WriteMapElemValue()
- e.encode(v[uintptr(k2)])
- }
- } else {
- for _, k2 := range v2 {
- e.encode(uintptr(k2))
- e.encode(v[uintptr(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- e.encode(k2)
- ee.WriteMapElemValue()
- e.encode(v2)
- }
- } else {
- for k2, v2 := range v {
- e.encode(k2)
- e.encode(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUintptrIntR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUintptrIntV(rv2i(rv).(map[uintptr]int), e)
-}
-func (_ fastpathT) EncMapUintptrIntV(v map[uintptr]int, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- e.encode(uintptr(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[uintptr(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- e.encode(uintptr(k2))
- ee.EncodeInt(int64(v[uintptr(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- e.encode(k2)
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- e.encode(k2)
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUintptrInt8R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUintptrInt8V(rv2i(rv).(map[uintptr]int8), e)
-}
-func (_ fastpathT) EncMapUintptrInt8V(v map[uintptr]int8, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- e.encode(uintptr(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[uintptr(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- e.encode(uintptr(k2))
- ee.EncodeInt(int64(v[uintptr(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- e.encode(k2)
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- e.encode(k2)
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUintptrInt16R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUintptrInt16V(rv2i(rv).(map[uintptr]int16), e)
-}
-func (_ fastpathT) EncMapUintptrInt16V(v map[uintptr]int16, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- e.encode(uintptr(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[uintptr(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- e.encode(uintptr(k2))
- ee.EncodeInt(int64(v[uintptr(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- e.encode(k2)
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- e.encode(k2)
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUintptrInt32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUintptrInt32V(rv2i(rv).(map[uintptr]int32), e)
-}
-func (_ fastpathT) EncMapUintptrInt32V(v map[uintptr]int32, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- e.encode(uintptr(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[uintptr(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- e.encode(uintptr(k2))
- ee.EncodeInt(int64(v[uintptr(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- e.encode(k2)
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- e.encode(k2)
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUintptrInt64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUintptrInt64V(rv2i(rv).(map[uintptr]int64), e)
-}
-func (_ fastpathT) EncMapUintptrInt64V(v map[uintptr]int64, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- e.encode(uintptr(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[uintptr(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- e.encode(uintptr(k2))
- ee.EncodeInt(int64(v[uintptr(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- e.encode(k2)
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- e.encode(k2)
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUintptrFloat32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUintptrFloat32V(rv2i(rv).(map[uintptr]float32), e)
-}
-func (_ fastpathT) EncMapUintptrFloat32V(v map[uintptr]float32, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- e.encode(uintptr(k2))
- ee.WriteMapElemValue()
- ee.EncodeFloat32(v[uintptr(k2)])
- }
- } else {
- for _, k2 := range v2 {
- e.encode(uintptr(k2))
- ee.EncodeFloat32(v[uintptr(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- e.encode(k2)
- ee.WriteMapElemValue()
- ee.EncodeFloat32(v2)
- }
- } else {
- for k2, v2 := range v {
- e.encode(k2)
- ee.EncodeFloat32(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUintptrFloat64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUintptrFloat64V(rv2i(rv).(map[uintptr]float64), e)
-}
-func (_ fastpathT) EncMapUintptrFloat64V(v map[uintptr]float64, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- e.encode(uintptr(k2))
- ee.WriteMapElemValue()
- ee.EncodeFloat64(v[uintptr(k2)])
- }
- } else {
- for _, k2 := range v2 {
- e.encode(uintptr(k2))
- ee.EncodeFloat64(v[uintptr(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- e.encode(k2)
- ee.WriteMapElemValue()
- ee.EncodeFloat64(v2)
- }
- } else {
- for k2, v2 := range v {
- e.encode(k2)
- ee.EncodeFloat64(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapUintptrBoolR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapUintptrBoolV(rv2i(rv).(map[uintptr]bool), e)
-}
-func (_ fastpathT) EncMapUintptrBoolV(v map[uintptr]bool, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]uint64, len(v))
- var i uint
- for k := range v {
- v2[i] = uint64(k)
- i++
- }
- sort.Sort(uintSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- e.encode(uintptr(k2))
- ee.WriteMapElemValue()
- ee.EncodeBool(v[uintptr(k2)])
- }
- } else {
- for _, k2 := range v2 {
- e.encode(uintptr(k2))
- ee.EncodeBool(v[uintptr(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- e.encode(k2)
- ee.WriteMapElemValue()
- ee.EncodeBool(v2)
- }
- } else {
- for k2, v2 := range v {
- e.encode(k2)
- ee.EncodeBool(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapIntIntfR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapIntIntfV(rv2i(rv).(map[int]interface{}), e)
-}
-func (_ fastpathT) EncMapIntIntfV(v map[int]interface{}, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int(k2)))
- ee.WriteMapElemValue()
- e.encode(v[int(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int(k2)))
- e.encode(v[int(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- e.encode(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- e.encode(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapIntStringR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapIntStringV(rv2i(rv).(map[int]string), e)
-}
-func (_ fastpathT) EncMapIntStringV(v map[int]string, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int(k2)))
- ee.WriteMapElemValue()
- ee.EncodeStringEnc(cUTF8, v[int(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int(k2)))
- ee.EncodeStringEnc(cUTF8, v[int(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeStringEnc(cUTF8, v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeStringEnc(cUTF8, v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapIntUintR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapIntUintV(rv2i(rv).(map[int]uint), e)
-}
-func (_ fastpathT) EncMapIntUintV(v map[int]uint, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[int(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int(k2)))
- ee.EncodeUint(uint64(v[int(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapIntUint8R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapIntUint8V(rv2i(rv).(map[int]uint8), e)
-}
-func (_ fastpathT) EncMapIntUint8V(v map[int]uint8, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[int(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int(k2)))
- ee.EncodeUint(uint64(v[int(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapIntUint16R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapIntUint16V(rv2i(rv).(map[int]uint16), e)
-}
-func (_ fastpathT) EncMapIntUint16V(v map[int]uint16, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[int(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int(k2)))
- ee.EncodeUint(uint64(v[int(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapIntUint32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapIntUint32V(rv2i(rv).(map[int]uint32), e)
-}
-func (_ fastpathT) EncMapIntUint32V(v map[int]uint32, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[int(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int(k2)))
- ee.EncodeUint(uint64(v[int(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapIntUint64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapIntUint64V(rv2i(rv).(map[int]uint64), e)
-}
-func (_ fastpathT) EncMapIntUint64V(v map[int]uint64, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[int(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int(k2)))
- ee.EncodeUint(uint64(v[int(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapIntUintptrR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapIntUintptrV(rv2i(rv).(map[int]uintptr), e)
-}
-func (_ fastpathT) EncMapIntUintptrV(v map[int]uintptr, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int(k2)))
- ee.WriteMapElemValue()
- e.encode(v[int(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int(k2)))
- e.encode(v[int(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- e.encode(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- e.encode(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapIntIntR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapIntIntV(rv2i(rv).(map[int]int), e)
-}
-func (_ fastpathT) EncMapIntIntV(v map[int]int, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[int(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int(k2)))
- ee.EncodeInt(int64(v[int(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapIntInt8R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapIntInt8V(rv2i(rv).(map[int]int8), e)
-}
-func (_ fastpathT) EncMapIntInt8V(v map[int]int8, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[int(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int(k2)))
- ee.EncodeInt(int64(v[int(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapIntInt16R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapIntInt16V(rv2i(rv).(map[int]int16), e)
-}
-func (_ fastpathT) EncMapIntInt16V(v map[int]int16, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[int(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int(k2)))
- ee.EncodeInt(int64(v[int(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapIntInt32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapIntInt32V(rv2i(rv).(map[int]int32), e)
-}
-func (_ fastpathT) EncMapIntInt32V(v map[int]int32, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[int(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int(k2)))
- ee.EncodeInt(int64(v[int(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapIntInt64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapIntInt64V(rv2i(rv).(map[int]int64), e)
-}
-func (_ fastpathT) EncMapIntInt64V(v map[int]int64, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[int(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int(k2)))
- ee.EncodeInt(int64(v[int(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapIntFloat32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapIntFloat32V(rv2i(rv).(map[int]float32), e)
-}
-func (_ fastpathT) EncMapIntFloat32V(v map[int]float32, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int(k2)))
- ee.WriteMapElemValue()
- ee.EncodeFloat32(v[int(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int(k2)))
- ee.EncodeFloat32(v[int(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeFloat32(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeFloat32(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapIntFloat64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapIntFloat64V(rv2i(rv).(map[int]float64), e)
-}
-func (_ fastpathT) EncMapIntFloat64V(v map[int]float64, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int(k2)))
- ee.WriteMapElemValue()
- ee.EncodeFloat64(v[int(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int(k2)))
- ee.EncodeFloat64(v[int(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeFloat64(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeFloat64(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapIntBoolR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapIntBoolV(rv2i(rv).(map[int]bool), e)
-}
-func (_ fastpathT) EncMapIntBoolV(v map[int]bool, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int(k2)))
- ee.WriteMapElemValue()
- ee.EncodeBool(v[int(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int(k2)))
- ee.EncodeBool(v[int(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeBool(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeBool(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt8IntfR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt8IntfV(rv2i(rv).(map[int8]interface{}), e)
-}
-func (_ fastpathT) EncMapInt8IntfV(v map[int8]interface{}, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int8(k2)))
- ee.WriteMapElemValue()
- e.encode(v[int8(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int8(k2)))
- e.encode(v[int8(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- e.encode(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- e.encode(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt8StringR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt8StringV(rv2i(rv).(map[int8]string), e)
-}
-func (_ fastpathT) EncMapInt8StringV(v map[int8]string, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int8(k2)))
- ee.WriteMapElemValue()
- ee.EncodeStringEnc(cUTF8, v[int8(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int8(k2)))
- ee.EncodeStringEnc(cUTF8, v[int8(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeStringEnc(cUTF8, v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeStringEnc(cUTF8, v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt8UintR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt8UintV(rv2i(rv).(map[int8]uint), e)
-}
-func (_ fastpathT) EncMapInt8UintV(v map[int8]uint, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int8(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[int8(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int8(k2)))
- ee.EncodeUint(uint64(v[int8(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt8Uint8R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt8Uint8V(rv2i(rv).(map[int8]uint8), e)
-}
-func (_ fastpathT) EncMapInt8Uint8V(v map[int8]uint8, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int8(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[int8(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int8(k2)))
- ee.EncodeUint(uint64(v[int8(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt8Uint16R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt8Uint16V(rv2i(rv).(map[int8]uint16), e)
-}
-func (_ fastpathT) EncMapInt8Uint16V(v map[int8]uint16, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int8(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[int8(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int8(k2)))
- ee.EncodeUint(uint64(v[int8(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt8Uint32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt8Uint32V(rv2i(rv).(map[int8]uint32), e)
-}
-func (_ fastpathT) EncMapInt8Uint32V(v map[int8]uint32, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int8(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[int8(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int8(k2)))
- ee.EncodeUint(uint64(v[int8(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt8Uint64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt8Uint64V(rv2i(rv).(map[int8]uint64), e)
-}
-func (_ fastpathT) EncMapInt8Uint64V(v map[int8]uint64, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int8(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[int8(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int8(k2)))
- ee.EncodeUint(uint64(v[int8(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt8UintptrR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt8UintptrV(rv2i(rv).(map[int8]uintptr), e)
-}
-func (_ fastpathT) EncMapInt8UintptrV(v map[int8]uintptr, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int8(k2)))
- ee.WriteMapElemValue()
- e.encode(v[int8(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int8(k2)))
- e.encode(v[int8(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- e.encode(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- e.encode(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt8IntR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt8IntV(rv2i(rv).(map[int8]int), e)
-}
-func (_ fastpathT) EncMapInt8IntV(v map[int8]int, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int8(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[int8(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int8(k2)))
- ee.EncodeInt(int64(v[int8(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt8Int8R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt8Int8V(rv2i(rv).(map[int8]int8), e)
-}
-func (_ fastpathT) EncMapInt8Int8V(v map[int8]int8, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int8(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[int8(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int8(k2)))
- ee.EncodeInt(int64(v[int8(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt8Int16R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt8Int16V(rv2i(rv).(map[int8]int16), e)
-}
-func (_ fastpathT) EncMapInt8Int16V(v map[int8]int16, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int8(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[int8(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int8(k2)))
- ee.EncodeInt(int64(v[int8(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt8Int32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt8Int32V(rv2i(rv).(map[int8]int32), e)
-}
-func (_ fastpathT) EncMapInt8Int32V(v map[int8]int32, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int8(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[int8(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int8(k2)))
- ee.EncodeInt(int64(v[int8(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt8Int64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt8Int64V(rv2i(rv).(map[int8]int64), e)
-}
-func (_ fastpathT) EncMapInt8Int64V(v map[int8]int64, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int8(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[int8(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int8(k2)))
- ee.EncodeInt(int64(v[int8(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt8Float32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt8Float32V(rv2i(rv).(map[int8]float32), e)
-}
-func (_ fastpathT) EncMapInt8Float32V(v map[int8]float32, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int8(k2)))
- ee.WriteMapElemValue()
- ee.EncodeFloat32(v[int8(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int8(k2)))
- ee.EncodeFloat32(v[int8(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeFloat32(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeFloat32(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt8Float64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt8Float64V(rv2i(rv).(map[int8]float64), e)
-}
-func (_ fastpathT) EncMapInt8Float64V(v map[int8]float64, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int8(k2)))
- ee.WriteMapElemValue()
- ee.EncodeFloat64(v[int8(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int8(k2)))
- ee.EncodeFloat64(v[int8(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeFloat64(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeFloat64(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt8BoolR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt8BoolV(rv2i(rv).(map[int8]bool), e)
-}
-func (_ fastpathT) EncMapInt8BoolV(v map[int8]bool, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int8(k2)))
- ee.WriteMapElemValue()
- ee.EncodeBool(v[int8(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int8(k2)))
- ee.EncodeBool(v[int8(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeBool(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeBool(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt16IntfR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt16IntfV(rv2i(rv).(map[int16]interface{}), e)
-}
-func (_ fastpathT) EncMapInt16IntfV(v map[int16]interface{}, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int16(k2)))
- ee.WriteMapElemValue()
- e.encode(v[int16(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int16(k2)))
- e.encode(v[int16(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- e.encode(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- e.encode(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt16StringR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt16StringV(rv2i(rv).(map[int16]string), e)
-}
-func (_ fastpathT) EncMapInt16StringV(v map[int16]string, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int16(k2)))
- ee.WriteMapElemValue()
- ee.EncodeStringEnc(cUTF8, v[int16(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int16(k2)))
- ee.EncodeStringEnc(cUTF8, v[int16(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeStringEnc(cUTF8, v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeStringEnc(cUTF8, v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt16UintR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt16UintV(rv2i(rv).(map[int16]uint), e)
-}
-func (_ fastpathT) EncMapInt16UintV(v map[int16]uint, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int16(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[int16(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int16(k2)))
- ee.EncodeUint(uint64(v[int16(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt16Uint8R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt16Uint8V(rv2i(rv).(map[int16]uint8), e)
-}
-func (_ fastpathT) EncMapInt16Uint8V(v map[int16]uint8, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int16(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[int16(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int16(k2)))
- ee.EncodeUint(uint64(v[int16(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt16Uint16R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt16Uint16V(rv2i(rv).(map[int16]uint16), e)
-}
-func (_ fastpathT) EncMapInt16Uint16V(v map[int16]uint16, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int16(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[int16(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int16(k2)))
- ee.EncodeUint(uint64(v[int16(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt16Uint32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt16Uint32V(rv2i(rv).(map[int16]uint32), e)
-}
-func (_ fastpathT) EncMapInt16Uint32V(v map[int16]uint32, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int16(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[int16(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int16(k2)))
- ee.EncodeUint(uint64(v[int16(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt16Uint64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt16Uint64V(rv2i(rv).(map[int16]uint64), e)
-}
-func (_ fastpathT) EncMapInt16Uint64V(v map[int16]uint64, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int16(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[int16(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int16(k2)))
- ee.EncodeUint(uint64(v[int16(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt16UintptrR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt16UintptrV(rv2i(rv).(map[int16]uintptr), e)
-}
-func (_ fastpathT) EncMapInt16UintptrV(v map[int16]uintptr, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int16(k2)))
- ee.WriteMapElemValue()
- e.encode(v[int16(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int16(k2)))
- e.encode(v[int16(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- e.encode(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- e.encode(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt16IntR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt16IntV(rv2i(rv).(map[int16]int), e)
-}
-func (_ fastpathT) EncMapInt16IntV(v map[int16]int, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int16(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[int16(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int16(k2)))
- ee.EncodeInt(int64(v[int16(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt16Int8R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt16Int8V(rv2i(rv).(map[int16]int8), e)
-}
-func (_ fastpathT) EncMapInt16Int8V(v map[int16]int8, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int16(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[int16(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int16(k2)))
- ee.EncodeInt(int64(v[int16(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt16Int16R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt16Int16V(rv2i(rv).(map[int16]int16), e)
-}
-func (_ fastpathT) EncMapInt16Int16V(v map[int16]int16, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int16(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[int16(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int16(k2)))
- ee.EncodeInt(int64(v[int16(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt16Int32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt16Int32V(rv2i(rv).(map[int16]int32), e)
-}
-func (_ fastpathT) EncMapInt16Int32V(v map[int16]int32, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int16(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[int16(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int16(k2)))
- ee.EncodeInt(int64(v[int16(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt16Int64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt16Int64V(rv2i(rv).(map[int16]int64), e)
-}
-func (_ fastpathT) EncMapInt16Int64V(v map[int16]int64, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int16(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[int16(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int16(k2)))
- ee.EncodeInt(int64(v[int16(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt16Float32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt16Float32V(rv2i(rv).(map[int16]float32), e)
-}
-func (_ fastpathT) EncMapInt16Float32V(v map[int16]float32, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int16(k2)))
- ee.WriteMapElemValue()
- ee.EncodeFloat32(v[int16(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int16(k2)))
- ee.EncodeFloat32(v[int16(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeFloat32(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeFloat32(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt16Float64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt16Float64V(rv2i(rv).(map[int16]float64), e)
-}
-func (_ fastpathT) EncMapInt16Float64V(v map[int16]float64, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int16(k2)))
- ee.WriteMapElemValue()
- ee.EncodeFloat64(v[int16(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int16(k2)))
- ee.EncodeFloat64(v[int16(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeFloat64(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeFloat64(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt16BoolR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt16BoolV(rv2i(rv).(map[int16]bool), e)
-}
-func (_ fastpathT) EncMapInt16BoolV(v map[int16]bool, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int16(k2)))
- ee.WriteMapElemValue()
- ee.EncodeBool(v[int16(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int16(k2)))
- ee.EncodeBool(v[int16(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeBool(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeBool(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt32IntfR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt32IntfV(rv2i(rv).(map[int32]interface{}), e)
-}
-func (_ fastpathT) EncMapInt32IntfV(v map[int32]interface{}, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int32(k2)))
- ee.WriteMapElemValue()
- e.encode(v[int32(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int32(k2)))
- e.encode(v[int32(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- e.encode(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- e.encode(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt32StringR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt32StringV(rv2i(rv).(map[int32]string), e)
-}
-func (_ fastpathT) EncMapInt32StringV(v map[int32]string, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int32(k2)))
- ee.WriteMapElemValue()
- ee.EncodeStringEnc(cUTF8, v[int32(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int32(k2)))
- ee.EncodeStringEnc(cUTF8, v[int32(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeStringEnc(cUTF8, v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeStringEnc(cUTF8, v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt32UintR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt32UintV(rv2i(rv).(map[int32]uint), e)
-}
-func (_ fastpathT) EncMapInt32UintV(v map[int32]uint, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int32(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[int32(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int32(k2)))
- ee.EncodeUint(uint64(v[int32(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt32Uint8R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt32Uint8V(rv2i(rv).(map[int32]uint8), e)
-}
-func (_ fastpathT) EncMapInt32Uint8V(v map[int32]uint8, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int32(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[int32(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int32(k2)))
- ee.EncodeUint(uint64(v[int32(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt32Uint16R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt32Uint16V(rv2i(rv).(map[int32]uint16), e)
-}
-func (_ fastpathT) EncMapInt32Uint16V(v map[int32]uint16, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int32(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[int32(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int32(k2)))
- ee.EncodeUint(uint64(v[int32(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt32Uint32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt32Uint32V(rv2i(rv).(map[int32]uint32), e)
-}
-func (_ fastpathT) EncMapInt32Uint32V(v map[int32]uint32, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int32(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[int32(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int32(k2)))
- ee.EncodeUint(uint64(v[int32(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt32Uint64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt32Uint64V(rv2i(rv).(map[int32]uint64), e)
-}
-func (_ fastpathT) EncMapInt32Uint64V(v map[int32]uint64, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int32(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[int32(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int32(k2)))
- ee.EncodeUint(uint64(v[int32(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt32UintptrR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt32UintptrV(rv2i(rv).(map[int32]uintptr), e)
-}
-func (_ fastpathT) EncMapInt32UintptrV(v map[int32]uintptr, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int32(k2)))
- ee.WriteMapElemValue()
- e.encode(v[int32(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int32(k2)))
- e.encode(v[int32(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- e.encode(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- e.encode(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt32IntR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt32IntV(rv2i(rv).(map[int32]int), e)
-}
-func (_ fastpathT) EncMapInt32IntV(v map[int32]int, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int32(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[int32(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int32(k2)))
- ee.EncodeInt(int64(v[int32(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt32Int8R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt32Int8V(rv2i(rv).(map[int32]int8), e)
-}
-func (_ fastpathT) EncMapInt32Int8V(v map[int32]int8, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int32(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[int32(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int32(k2)))
- ee.EncodeInt(int64(v[int32(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt32Int16R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt32Int16V(rv2i(rv).(map[int32]int16), e)
-}
-func (_ fastpathT) EncMapInt32Int16V(v map[int32]int16, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int32(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[int32(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int32(k2)))
- ee.EncodeInt(int64(v[int32(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt32Int32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt32Int32V(rv2i(rv).(map[int32]int32), e)
-}
-func (_ fastpathT) EncMapInt32Int32V(v map[int32]int32, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int32(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[int32(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int32(k2)))
- ee.EncodeInt(int64(v[int32(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt32Int64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt32Int64V(rv2i(rv).(map[int32]int64), e)
-}
-func (_ fastpathT) EncMapInt32Int64V(v map[int32]int64, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int32(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[int32(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int32(k2)))
- ee.EncodeInt(int64(v[int32(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt32Float32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt32Float32V(rv2i(rv).(map[int32]float32), e)
-}
-func (_ fastpathT) EncMapInt32Float32V(v map[int32]float32, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int32(k2)))
- ee.WriteMapElemValue()
- ee.EncodeFloat32(v[int32(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int32(k2)))
- ee.EncodeFloat32(v[int32(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeFloat32(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeFloat32(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt32Float64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt32Float64V(rv2i(rv).(map[int32]float64), e)
-}
-func (_ fastpathT) EncMapInt32Float64V(v map[int32]float64, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int32(k2)))
- ee.WriteMapElemValue()
- ee.EncodeFloat64(v[int32(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int32(k2)))
- ee.EncodeFloat64(v[int32(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeFloat64(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeFloat64(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt32BoolR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt32BoolV(rv2i(rv).(map[int32]bool), e)
-}
-func (_ fastpathT) EncMapInt32BoolV(v map[int32]bool, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int32(k2)))
- ee.WriteMapElemValue()
- ee.EncodeBool(v[int32(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int32(k2)))
- ee.EncodeBool(v[int32(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeBool(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeBool(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt64IntfR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt64IntfV(rv2i(rv).(map[int64]interface{}), e)
-}
-func (_ fastpathT) EncMapInt64IntfV(v map[int64]interface{}, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int64(k2)))
- ee.WriteMapElemValue()
- e.encode(v[int64(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int64(k2)))
- e.encode(v[int64(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- e.encode(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- e.encode(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt64StringR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt64StringV(rv2i(rv).(map[int64]string), e)
-}
-func (_ fastpathT) EncMapInt64StringV(v map[int64]string, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int64(k2)))
- ee.WriteMapElemValue()
- ee.EncodeStringEnc(cUTF8, v[int64(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int64(k2)))
- ee.EncodeStringEnc(cUTF8, v[int64(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeStringEnc(cUTF8, v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeStringEnc(cUTF8, v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt64UintR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt64UintV(rv2i(rv).(map[int64]uint), e)
-}
-func (_ fastpathT) EncMapInt64UintV(v map[int64]uint, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int64(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[int64(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int64(k2)))
- ee.EncodeUint(uint64(v[int64(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt64Uint8R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt64Uint8V(rv2i(rv).(map[int64]uint8), e)
-}
-func (_ fastpathT) EncMapInt64Uint8V(v map[int64]uint8, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int64(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[int64(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int64(k2)))
- ee.EncodeUint(uint64(v[int64(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt64Uint16R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt64Uint16V(rv2i(rv).(map[int64]uint16), e)
-}
-func (_ fastpathT) EncMapInt64Uint16V(v map[int64]uint16, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int64(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[int64(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int64(k2)))
- ee.EncodeUint(uint64(v[int64(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt64Uint32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt64Uint32V(rv2i(rv).(map[int64]uint32), e)
-}
-func (_ fastpathT) EncMapInt64Uint32V(v map[int64]uint32, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int64(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[int64(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int64(k2)))
- ee.EncodeUint(uint64(v[int64(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt64Uint64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt64Uint64V(rv2i(rv).(map[int64]uint64), e)
-}
-func (_ fastpathT) EncMapInt64Uint64V(v map[int64]uint64, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int64(k2)))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[int64(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int64(k2)))
- ee.EncodeUint(uint64(v[int64(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt64UintptrR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt64UintptrV(rv2i(rv).(map[int64]uintptr), e)
-}
-func (_ fastpathT) EncMapInt64UintptrV(v map[int64]uintptr, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int64(k2)))
- ee.WriteMapElemValue()
- e.encode(v[int64(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int64(k2)))
- e.encode(v[int64(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- e.encode(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- e.encode(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt64IntR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt64IntV(rv2i(rv).(map[int64]int), e)
-}
-func (_ fastpathT) EncMapInt64IntV(v map[int64]int, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int64(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[int64(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int64(k2)))
- ee.EncodeInt(int64(v[int64(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt64Int8R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt64Int8V(rv2i(rv).(map[int64]int8), e)
-}
-func (_ fastpathT) EncMapInt64Int8V(v map[int64]int8, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int64(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[int64(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int64(k2)))
- ee.EncodeInt(int64(v[int64(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt64Int16R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt64Int16V(rv2i(rv).(map[int64]int16), e)
-}
-func (_ fastpathT) EncMapInt64Int16V(v map[int64]int16, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int64(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[int64(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int64(k2)))
- ee.EncodeInt(int64(v[int64(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt64Int32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt64Int32V(rv2i(rv).(map[int64]int32), e)
-}
-func (_ fastpathT) EncMapInt64Int32V(v map[int64]int32, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int64(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[int64(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int64(k2)))
- ee.EncodeInt(int64(v[int64(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt64Int64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt64Int64V(rv2i(rv).(map[int64]int64), e)
-}
-func (_ fastpathT) EncMapInt64Int64V(v map[int64]int64, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int64(k2)))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[int64(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int64(k2)))
- ee.EncodeInt(int64(v[int64(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt64Float32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt64Float32V(rv2i(rv).(map[int64]float32), e)
-}
-func (_ fastpathT) EncMapInt64Float32V(v map[int64]float32, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int64(k2)))
- ee.WriteMapElemValue()
- ee.EncodeFloat32(v[int64(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int64(k2)))
- ee.EncodeFloat32(v[int64(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeFloat32(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeFloat32(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt64Float64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt64Float64V(rv2i(rv).(map[int64]float64), e)
-}
-func (_ fastpathT) EncMapInt64Float64V(v map[int64]float64, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int64(k2)))
- ee.WriteMapElemValue()
- ee.EncodeFloat64(v[int64(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int64(k2)))
- ee.EncodeFloat64(v[int64(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeFloat64(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeFloat64(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapInt64BoolR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapInt64BoolV(rv2i(rv).(map[int64]bool), e)
-}
-func (_ fastpathT) EncMapInt64BoolV(v map[int64]bool, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]int64, len(v))
- var i uint
- for k := range v {
- v2[i] = int64(k)
- i++
- }
- sort.Sort(intSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(int64(k2)))
- ee.WriteMapElemValue()
- ee.EncodeBool(v[int64(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeInt(int64(int64(k2)))
- ee.EncodeBool(v[int64(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeInt(int64(k2))
- ee.WriteMapElemValue()
- ee.EncodeBool(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeInt(int64(k2))
- ee.EncodeBool(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapBoolIntfR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapBoolIntfV(rv2i(rv).(map[bool]interface{}), e)
-}
-func (_ fastpathT) EncMapBoolIntfV(v map[bool]interface{}, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i uint
- for k := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeBool(bool(k2))
- ee.WriteMapElemValue()
- e.encode(v[bool(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeBool(bool(k2))
- e.encode(v[bool(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeBool(k2)
- ee.WriteMapElemValue()
- e.encode(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeBool(k2)
- e.encode(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapBoolStringR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapBoolStringV(rv2i(rv).(map[bool]string), e)
-}
-func (_ fastpathT) EncMapBoolStringV(v map[bool]string, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i uint
- for k := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeBool(bool(k2))
- ee.WriteMapElemValue()
- ee.EncodeStringEnc(cUTF8, v[bool(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeBool(bool(k2))
- ee.EncodeStringEnc(cUTF8, v[bool(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeBool(k2)
- ee.WriteMapElemValue()
- ee.EncodeStringEnc(cUTF8, v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeBool(k2)
- ee.EncodeStringEnc(cUTF8, v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapBoolUintR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapBoolUintV(rv2i(rv).(map[bool]uint), e)
-}
-func (_ fastpathT) EncMapBoolUintV(v map[bool]uint, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i uint
- for k := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeBool(bool(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[bool(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeBool(bool(k2))
- ee.EncodeUint(uint64(v[bool(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeBool(k2)
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeBool(k2)
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapBoolUint8R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapBoolUint8V(rv2i(rv).(map[bool]uint8), e)
-}
-func (_ fastpathT) EncMapBoolUint8V(v map[bool]uint8, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i uint
- for k := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeBool(bool(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[bool(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeBool(bool(k2))
- ee.EncodeUint(uint64(v[bool(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeBool(k2)
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeBool(k2)
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapBoolUint16R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapBoolUint16V(rv2i(rv).(map[bool]uint16), e)
-}
-func (_ fastpathT) EncMapBoolUint16V(v map[bool]uint16, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i uint
- for k := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeBool(bool(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[bool(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeBool(bool(k2))
- ee.EncodeUint(uint64(v[bool(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeBool(k2)
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeBool(k2)
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapBoolUint32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapBoolUint32V(rv2i(rv).(map[bool]uint32), e)
-}
-func (_ fastpathT) EncMapBoolUint32V(v map[bool]uint32, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i uint
- for k := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeBool(bool(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[bool(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeBool(bool(k2))
- ee.EncodeUint(uint64(v[bool(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeBool(k2)
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeBool(k2)
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapBoolUint64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapBoolUint64V(rv2i(rv).(map[bool]uint64), e)
-}
-func (_ fastpathT) EncMapBoolUint64V(v map[bool]uint64, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i uint
- for k := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeBool(bool(k2))
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v[bool(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeBool(bool(k2))
- ee.EncodeUint(uint64(v[bool(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeBool(k2)
- ee.WriteMapElemValue()
- ee.EncodeUint(uint64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeBool(k2)
- ee.EncodeUint(uint64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapBoolUintptrR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapBoolUintptrV(rv2i(rv).(map[bool]uintptr), e)
-}
-func (_ fastpathT) EncMapBoolUintptrV(v map[bool]uintptr, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i uint
- for k := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeBool(bool(k2))
- ee.WriteMapElemValue()
- e.encode(v[bool(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeBool(bool(k2))
- e.encode(v[bool(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeBool(k2)
- ee.WriteMapElemValue()
- e.encode(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeBool(k2)
- e.encode(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapBoolIntR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapBoolIntV(rv2i(rv).(map[bool]int), e)
-}
-func (_ fastpathT) EncMapBoolIntV(v map[bool]int, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i uint
- for k := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeBool(bool(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[bool(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeBool(bool(k2))
- ee.EncodeInt(int64(v[bool(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeBool(k2)
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeBool(k2)
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapBoolInt8R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapBoolInt8V(rv2i(rv).(map[bool]int8), e)
-}
-func (_ fastpathT) EncMapBoolInt8V(v map[bool]int8, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i uint
- for k := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeBool(bool(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[bool(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeBool(bool(k2))
- ee.EncodeInt(int64(v[bool(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeBool(k2)
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeBool(k2)
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapBoolInt16R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapBoolInt16V(rv2i(rv).(map[bool]int16), e)
-}
-func (_ fastpathT) EncMapBoolInt16V(v map[bool]int16, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i uint
- for k := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeBool(bool(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[bool(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeBool(bool(k2))
- ee.EncodeInt(int64(v[bool(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeBool(k2)
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeBool(k2)
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapBoolInt32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapBoolInt32V(rv2i(rv).(map[bool]int32), e)
-}
-func (_ fastpathT) EncMapBoolInt32V(v map[bool]int32, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i uint
- for k := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeBool(bool(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[bool(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeBool(bool(k2))
- ee.EncodeInt(int64(v[bool(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeBool(k2)
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeBool(k2)
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapBoolInt64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapBoolInt64V(rv2i(rv).(map[bool]int64), e)
-}
-func (_ fastpathT) EncMapBoolInt64V(v map[bool]int64, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i uint
- for k := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeBool(bool(k2))
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v[bool(k2)]))
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeBool(bool(k2))
- ee.EncodeInt(int64(v[bool(k2)]))
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeBool(k2)
- ee.WriteMapElemValue()
- ee.EncodeInt(int64(v2))
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeBool(k2)
- ee.EncodeInt(int64(v2))
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapBoolFloat32R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapBoolFloat32V(rv2i(rv).(map[bool]float32), e)
-}
-func (_ fastpathT) EncMapBoolFloat32V(v map[bool]float32, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i uint
- for k := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeBool(bool(k2))
- ee.WriteMapElemValue()
- ee.EncodeFloat32(v[bool(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeBool(bool(k2))
- ee.EncodeFloat32(v[bool(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeBool(k2)
- ee.WriteMapElemValue()
- ee.EncodeFloat32(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeBool(k2)
- ee.EncodeFloat32(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapBoolFloat64R(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapBoolFloat64V(rv2i(rv).(map[bool]float64), e)
-}
-func (_ fastpathT) EncMapBoolFloat64V(v map[bool]float64, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i uint
- for k := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeBool(bool(k2))
- ee.WriteMapElemValue()
- ee.EncodeFloat64(v[bool(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeBool(bool(k2))
- ee.EncodeFloat64(v[bool(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeBool(k2)
- ee.WriteMapElemValue()
- ee.EncodeFloat64(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeBool(k2)
- ee.EncodeFloat64(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-func (e *Encoder) fastpathEncMapBoolBoolR(f *codecFnInfo, rv reflect.Value) {
- fastpathTV.EncMapBoolBoolV(rv2i(rv).(map[bool]bool), e)
-}
-func (_ fastpathT) EncMapBoolBoolV(v map[bool]bool, e *Encoder) {
- if v == nil {
- e.e.EncodeNil()
- return
- }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- v2 := make([]bool, len(v))
- var i uint
- for k := range v {
- v2[i] = bool(k)
- i++
- }
- sort.Sort(boolSlice(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- ee.EncodeBool(bool(k2))
- ee.WriteMapElemValue()
- ee.EncodeBool(v[bool(k2)])
- }
- } else {
- for _, k2 := range v2 {
- ee.EncodeBool(bool(k2))
- ee.EncodeBool(v[bool(k2)])
- }
- }
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- ee.EncodeBool(k2)
- ee.WriteMapElemValue()
- ee.EncodeBool(v2)
- }
- } else {
- for k2, v2 := range v {
- ee.EncodeBool(k2)
- ee.EncodeBool(v2)
- }
- }
- }
- ee.WriteMapEnd()
-}
-
-// -- decode
-
-// -- -- fast path type switch
-func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool {
- var changed bool
- switch v := iv.(type) {
-
- case []interface{}:
- var v2 []interface{}
- v2, changed = fastpathTV.DecSliceIntfV(v, false, d)
- if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
- copy(v, v2)
- }
- case *[]interface{}:
- var v2 []interface{}
- v2, changed = fastpathTV.DecSliceIntfV(*v, true, d)
- if changed {
- *v = v2
- }
- case []string:
- var v2 []string
- v2, changed = fastpathTV.DecSliceStringV(v, false, d)
- if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
- copy(v, v2)
- }
- case *[]string:
- var v2 []string
- v2, changed = fastpathTV.DecSliceStringV(*v, true, d)
- if changed {
- *v = v2
- }
- case []float32:
- var v2 []float32
- v2, changed = fastpathTV.DecSliceFloat32V(v, false, d)
- if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
- copy(v, v2)
- }
- case *[]float32:
- var v2 []float32
- v2, changed = fastpathTV.DecSliceFloat32V(*v, true, d)
- if changed {
- *v = v2
- }
- case []float64:
- var v2 []float64
- v2, changed = fastpathTV.DecSliceFloat64V(v, false, d)
- if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
- copy(v, v2)
- }
- case *[]float64:
- var v2 []float64
- v2, changed = fastpathTV.DecSliceFloat64V(*v, true, d)
- if changed {
- *v = v2
- }
- case []uint:
- var v2 []uint
- v2, changed = fastpathTV.DecSliceUintV(v, false, d)
- if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
- copy(v, v2)
- }
- case *[]uint:
- var v2 []uint
- v2, changed = fastpathTV.DecSliceUintV(*v, true, d)
- if changed {
- *v = v2
- }
- case []uint16:
- var v2 []uint16
- v2, changed = fastpathTV.DecSliceUint16V(v, false, d)
- if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
- copy(v, v2)
- }
- case *[]uint16:
- var v2 []uint16
- v2, changed = fastpathTV.DecSliceUint16V(*v, true, d)
- if changed {
- *v = v2
- }
- case []uint32:
- var v2 []uint32
- v2, changed = fastpathTV.DecSliceUint32V(v, false, d)
- if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
- copy(v, v2)
- }
- case *[]uint32:
- var v2 []uint32
- v2, changed = fastpathTV.DecSliceUint32V(*v, true, d)
- if changed {
- *v = v2
- }
- case []uint64:
- var v2 []uint64
- v2, changed = fastpathTV.DecSliceUint64V(v, false, d)
- if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
- copy(v, v2)
- }
- case *[]uint64:
- var v2 []uint64
- v2, changed = fastpathTV.DecSliceUint64V(*v, true, d)
- if changed {
- *v = v2
- }
- case []uintptr:
- var v2 []uintptr
- v2, changed = fastpathTV.DecSliceUintptrV(v, false, d)
- if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
- copy(v, v2)
- }
- case *[]uintptr:
- var v2 []uintptr
- v2, changed = fastpathTV.DecSliceUintptrV(*v, true, d)
- if changed {
- *v = v2
- }
- case []int:
- var v2 []int
- v2, changed = fastpathTV.DecSliceIntV(v, false, d)
- if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
- copy(v, v2)
- }
- case *[]int:
- var v2 []int
- v2, changed = fastpathTV.DecSliceIntV(*v, true, d)
- if changed {
- *v = v2
- }
- case []int8:
- var v2 []int8
- v2, changed = fastpathTV.DecSliceInt8V(v, false, d)
- if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
- copy(v, v2)
- }
- case *[]int8:
- var v2 []int8
- v2, changed = fastpathTV.DecSliceInt8V(*v, true, d)
- if changed {
- *v = v2
- }
- case []int16:
- var v2 []int16
- v2, changed = fastpathTV.DecSliceInt16V(v, false, d)
- if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
- copy(v, v2)
- }
- case *[]int16:
- var v2 []int16
- v2, changed = fastpathTV.DecSliceInt16V(*v, true, d)
- if changed {
- *v = v2
- }
- case []int32:
- var v2 []int32
- v2, changed = fastpathTV.DecSliceInt32V(v, false, d)
- if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
- copy(v, v2)
- }
- case *[]int32:
- var v2 []int32
- v2, changed = fastpathTV.DecSliceInt32V(*v, true, d)
- if changed {
- *v = v2
- }
- case []int64:
- var v2 []int64
- v2, changed = fastpathTV.DecSliceInt64V(v, false, d)
- if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
- copy(v, v2)
- }
- case *[]int64:
- var v2 []int64
- v2, changed = fastpathTV.DecSliceInt64V(*v, true, d)
- if changed {
- *v = v2
- }
- case []bool:
- var v2 []bool
- v2, changed = fastpathTV.DecSliceBoolV(v, false, d)
- if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
- copy(v, v2)
- }
- case *[]bool:
- var v2 []bool
- v2, changed = fastpathTV.DecSliceBoolV(*v, true, d)
- if changed {
- *v = v2
- }
-
- case map[interface{}]interface{}:
- fastpathTV.DecMapIntfIntfV(v, false, d)
- case *map[interface{}]interface{}:
- var v2 map[interface{}]interface{}
- v2, changed = fastpathTV.DecMapIntfIntfV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[interface{}]string:
- fastpathTV.DecMapIntfStringV(v, false, d)
- case *map[interface{}]string:
- var v2 map[interface{}]string
- v2, changed = fastpathTV.DecMapIntfStringV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[interface{}]uint:
- fastpathTV.DecMapIntfUintV(v, false, d)
- case *map[interface{}]uint:
- var v2 map[interface{}]uint
- v2, changed = fastpathTV.DecMapIntfUintV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[interface{}]uint8:
- fastpathTV.DecMapIntfUint8V(v, false, d)
- case *map[interface{}]uint8:
- var v2 map[interface{}]uint8
- v2, changed = fastpathTV.DecMapIntfUint8V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[interface{}]uint16:
- fastpathTV.DecMapIntfUint16V(v, false, d)
- case *map[interface{}]uint16:
- var v2 map[interface{}]uint16
- v2, changed = fastpathTV.DecMapIntfUint16V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[interface{}]uint32:
- fastpathTV.DecMapIntfUint32V(v, false, d)
- case *map[interface{}]uint32:
- var v2 map[interface{}]uint32
- v2, changed = fastpathTV.DecMapIntfUint32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[interface{}]uint64:
- fastpathTV.DecMapIntfUint64V(v, false, d)
- case *map[interface{}]uint64:
- var v2 map[interface{}]uint64
- v2, changed = fastpathTV.DecMapIntfUint64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[interface{}]uintptr:
- fastpathTV.DecMapIntfUintptrV(v, false, d)
- case *map[interface{}]uintptr:
- var v2 map[interface{}]uintptr
- v2, changed = fastpathTV.DecMapIntfUintptrV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[interface{}]int:
- fastpathTV.DecMapIntfIntV(v, false, d)
- case *map[interface{}]int:
- var v2 map[interface{}]int
- v2, changed = fastpathTV.DecMapIntfIntV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[interface{}]int8:
- fastpathTV.DecMapIntfInt8V(v, false, d)
- case *map[interface{}]int8:
- var v2 map[interface{}]int8
- v2, changed = fastpathTV.DecMapIntfInt8V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[interface{}]int16:
- fastpathTV.DecMapIntfInt16V(v, false, d)
- case *map[interface{}]int16:
- var v2 map[interface{}]int16
- v2, changed = fastpathTV.DecMapIntfInt16V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[interface{}]int32:
- fastpathTV.DecMapIntfInt32V(v, false, d)
- case *map[interface{}]int32:
- var v2 map[interface{}]int32
- v2, changed = fastpathTV.DecMapIntfInt32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[interface{}]int64:
- fastpathTV.DecMapIntfInt64V(v, false, d)
- case *map[interface{}]int64:
- var v2 map[interface{}]int64
- v2, changed = fastpathTV.DecMapIntfInt64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[interface{}]float32:
- fastpathTV.DecMapIntfFloat32V(v, false, d)
- case *map[interface{}]float32:
- var v2 map[interface{}]float32
- v2, changed = fastpathTV.DecMapIntfFloat32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[interface{}]float64:
- fastpathTV.DecMapIntfFloat64V(v, false, d)
- case *map[interface{}]float64:
- var v2 map[interface{}]float64
- v2, changed = fastpathTV.DecMapIntfFloat64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[interface{}]bool:
- fastpathTV.DecMapIntfBoolV(v, false, d)
- case *map[interface{}]bool:
- var v2 map[interface{}]bool
- v2, changed = fastpathTV.DecMapIntfBoolV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[string]interface{}:
- fastpathTV.DecMapStringIntfV(v, false, d)
- case *map[string]interface{}:
- var v2 map[string]interface{}
- v2, changed = fastpathTV.DecMapStringIntfV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[string]string:
- fastpathTV.DecMapStringStringV(v, false, d)
- case *map[string]string:
- var v2 map[string]string
- v2, changed = fastpathTV.DecMapStringStringV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[string]uint:
- fastpathTV.DecMapStringUintV(v, false, d)
- case *map[string]uint:
- var v2 map[string]uint
- v2, changed = fastpathTV.DecMapStringUintV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[string]uint8:
- fastpathTV.DecMapStringUint8V(v, false, d)
- case *map[string]uint8:
- var v2 map[string]uint8
- v2, changed = fastpathTV.DecMapStringUint8V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[string]uint16:
- fastpathTV.DecMapStringUint16V(v, false, d)
- case *map[string]uint16:
- var v2 map[string]uint16
- v2, changed = fastpathTV.DecMapStringUint16V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[string]uint32:
- fastpathTV.DecMapStringUint32V(v, false, d)
- case *map[string]uint32:
- var v2 map[string]uint32
- v2, changed = fastpathTV.DecMapStringUint32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[string]uint64:
- fastpathTV.DecMapStringUint64V(v, false, d)
- case *map[string]uint64:
- var v2 map[string]uint64
- v2, changed = fastpathTV.DecMapStringUint64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[string]uintptr:
- fastpathTV.DecMapStringUintptrV(v, false, d)
- case *map[string]uintptr:
- var v2 map[string]uintptr
- v2, changed = fastpathTV.DecMapStringUintptrV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[string]int:
- fastpathTV.DecMapStringIntV(v, false, d)
- case *map[string]int:
- var v2 map[string]int
- v2, changed = fastpathTV.DecMapStringIntV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[string]int8:
- fastpathTV.DecMapStringInt8V(v, false, d)
- case *map[string]int8:
- var v2 map[string]int8
- v2, changed = fastpathTV.DecMapStringInt8V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[string]int16:
- fastpathTV.DecMapStringInt16V(v, false, d)
- case *map[string]int16:
- var v2 map[string]int16
- v2, changed = fastpathTV.DecMapStringInt16V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[string]int32:
- fastpathTV.DecMapStringInt32V(v, false, d)
- case *map[string]int32:
- var v2 map[string]int32
- v2, changed = fastpathTV.DecMapStringInt32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[string]int64:
- fastpathTV.DecMapStringInt64V(v, false, d)
- case *map[string]int64:
- var v2 map[string]int64
- v2, changed = fastpathTV.DecMapStringInt64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[string]float32:
- fastpathTV.DecMapStringFloat32V(v, false, d)
- case *map[string]float32:
- var v2 map[string]float32
- v2, changed = fastpathTV.DecMapStringFloat32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[string]float64:
- fastpathTV.DecMapStringFloat64V(v, false, d)
- case *map[string]float64:
- var v2 map[string]float64
- v2, changed = fastpathTV.DecMapStringFloat64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[string]bool:
- fastpathTV.DecMapStringBoolV(v, false, d)
- case *map[string]bool:
- var v2 map[string]bool
- v2, changed = fastpathTV.DecMapStringBoolV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[float32]interface{}:
- fastpathTV.DecMapFloat32IntfV(v, false, d)
- case *map[float32]interface{}:
- var v2 map[float32]interface{}
- v2, changed = fastpathTV.DecMapFloat32IntfV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[float32]string:
- fastpathTV.DecMapFloat32StringV(v, false, d)
- case *map[float32]string:
- var v2 map[float32]string
- v2, changed = fastpathTV.DecMapFloat32StringV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[float32]uint:
- fastpathTV.DecMapFloat32UintV(v, false, d)
- case *map[float32]uint:
- var v2 map[float32]uint
- v2, changed = fastpathTV.DecMapFloat32UintV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[float32]uint8:
- fastpathTV.DecMapFloat32Uint8V(v, false, d)
- case *map[float32]uint8:
- var v2 map[float32]uint8
- v2, changed = fastpathTV.DecMapFloat32Uint8V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[float32]uint16:
- fastpathTV.DecMapFloat32Uint16V(v, false, d)
- case *map[float32]uint16:
- var v2 map[float32]uint16
- v2, changed = fastpathTV.DecMapFloat32Uint16V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[float32]uint32:
- fastpathTV.DecMapFloat32Uint32V(v, false, d)
- case *map[float32]uint32:
- var v2 map[float32]uint32
- v2, changed = fastpathTV.DecMapFloat32Uint32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[float32]uint64:
- fastpathTV.DecMapFloat32Uint64V(v, false, d)
- case *map[float32]uint64:
- var v2 map[float32]uint64
- v2, changed = fastpathTV.DecMapFloat32Uint64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[float32]uintptr:
- fastpathTV.DecMapFloat32UintptrV(v, false, d)
- case *map[float32]uintptr:
- var v2 map[float32]uintptr
- v2, changed = fastpathTV.DecMapFloat32UintptrV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[float32]int:
- fastpathTV.DecMapFloat32IntV(v, false, d)
- case *map[float32]int:
- var v2 map[float32]int
- v2, changed = fastpathTV.DecMapFloat32IntV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[float32]int8:
- fastpathTV.DecMapFloat32Int8V(v, false, d)
- case *map[float32]int8:
- var v2 map[float32]int8
- v2, changed = fastpathTV.DecMapFloat32Int8V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[float32]int16:
- fastpathTV.DecMapFloat32Int16V(v, false, d)
- case *map[float32]int16:
- var v2 map[float32]int16
- v2, changed = fastpathTV.DecMapFloat32Int16V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[float32]int32:
- fastpathTV.DecMapFloat32Int32V(v, false, d)
- case *map[float32]int32:
- var v2 map[float32]int32
- v2, changed = fastpathTV.DecMapFloat32Int32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[float32]int64:
- fastpathTV.DecMapFloat32Int64V(v, false, d)
- case *map[float32]int64:
- var v2 map[float32]int64
- v2, changed = fastpathTV.DecMapFloat32Int64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[float32]float32:
- fastpathTV.DecMapFloat32Float32V(v, false, d)
- case *map[float32]float32:
- var v2 map[float32]float32
- v2, changed = fastpathTV.DecMapFloat32Float32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[float32]float64:
- fastpathTV.DecMapFloat32Float64V(v, false, d)
- case *map[float32]float64:
- var v2 map[float32]float64
- v2, changed = fastpathTV.DecMapFloat32Float64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[float32]bool:
- fastpathTV.DecMapFloat32BoolV(v, false, d)
- case *map[float32]bool:
- var v2 map[float32]bool
- v2, changed = fastpathTV.DecMapFloat32BoolV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[float64]interface{}:
- fastpathTV.DecMapFloat64IntfV(v, false, d)
- case *map[float64]interface{}:
- var v2 map[float64]interface{}
- v2, changed = fastpathTV.DecMapFloat64IntfV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[float64]string:
- fastpathTV.DecMapFloat64StringV(v, false, d)
- case *map[float64]string:
- var v2 map[float64]string
- v2, changed = fastpathTV.DecMapFloat64StringV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[float64]uint:
- fastpathTV.DecMapFloat64UintV(v, false, d)
- case *map[float64]uint:
- var v2 map[float64]uint
- v2, changed = fastpathTV.DecMapFloat64UintV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[float64]uint8:
- fastpathTV.DecMapFloat64Uint8V(v, false, d)
- case *map[float64]uint8:
- var v2 map[float64]uint8
- v2, changed = fastpathTV.DecMapFloat64Uint8V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[float64]uint16:
- fastpathTV.DecMapFloat64Uint16V(v, false, d)
- case *map[float64]uint16:
- var v2 map[float64]uint16
- v2, changed = fastpathTV.DecMapFloat64Uint16V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[float64]uint32:
- fastpathTV.DecMapFloat64Uint32V(v, false, d)
- case *map[float64]uint32:
- var v2 map[float64]uint32
- v2, changed = fastpathTV.DecMapFloat64Uint32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[float64]uint64:
- fastpathTV.DecMapFloat64Uint64V(v, false, d)
- case *map[float64]uint64:
- var v2 map[float64]uint64
- v2, changed = fastpathTV.DecMapFloat64Uint64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[float64]uintptr:
- fastpathTV.DecMapFloat64UintptrV(v, false, d)
- case *map[float64]uintptr:
- var v2 map[float64]uintptr
- v2, changed = fastpathTV.DecMapFloat64UintptrV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[float64]int:
- fastpathTV.DecMapFloat64IntV(v, false, d)
- case *map[float64]int:
- var v2 map[float64]int
- v2, changed = fastpathTV.DecMapFloat64IntV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[float64]int8:
- fastpathTV.DecMapFloat64Int8V(v, false, d)
- case *map[float64]int8:
- var v2 map[float64]int8
- v2, changed = fastpathTV.DecMapFloat64Int8V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[float64]int16:
- fastpathTV.DecMapFloat64Int16V(v, false, d)
- case *map[float64]int16:
- var v2 map[float64]int16
- v2, changed = fastpathTV.DecMapFloat64Int16V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[float64]int32:
- fastpathTV.DecMapFloat64Int32V(v, false, d)
- case *map[float64]int32:
- var v2 map[float64]int32
- v2, changed = fastpathTV.DecMapFloat64Int32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[float64]int64:
- fastpathTV.DecMapFloat64Int64V(v, false, d)
- case *map[float64]int64:
- var v2 map[float64]int64
- v2, changed = fastpathTV.DecMapFloat64Int64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[float64]float32:
- fastpathTV.DecMapFloat64Float32V(v, false, d)
- case *map[float64]float32:
- var v2 map[float64]float32
- v2, changed = fastpathTV.DecMapFloat64Float32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[float64]float64:
- fastpathTV.DecMapFloat64Float64V(v, false, d)
- case *map[float64]float64:
- var v2 map[float64]float64
- v2, changed = fastpathTV.DecMapFloat64Float64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[float64]bool:
- fastpathTV.DecMapFloat64BoolV(v, false, d)
- case *map[float64]bool:
- var v2 map[float64]bool
- v2, changed = fastpathTV.DecMapFloat64BoolV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint]interface{}:
- fastpathTV.DecMapUintIntfV(v, false, d)
- case *map[uint]interface{}:
- var v2 map[uint]interface{}
- v2, changed = fastpathTV.DecMapUintIntfV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint]string:
- fastpathTV.DecMapUintStringV(v, false, d)
- case *map[uint]string:
- var v2 map[uint]string
- v2, changed = fastpathTV.DecMapUintStringV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint]uint:
- fastpathTV.DecMapUintUintV(v, false, d)
- case *map[uint]uint:
- var v2 map[uint]uint
- v2, changed = fastpathTV.DecMapUintUintV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint]uint8:
- fastpathTV.DecMapUintUint8V(v, false, d)
- case *map[uint]uint8:
- var v2 map[uint]uint8
- v2, changed = fastpathTV.DecMapUintUint8V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint]uint16:
- fastpathTV.DecMapUintUint16V(v, false, d)
- case *map[uint]uint16:
- var v2 map[uint]uint16
- v2, changed = fastpathTV.DecMapUintUint16V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint]uint32:
- fastpathTV.DecMapUintUint32V(v, false, d)
- case *map[uint]uint32:
- var v2 map[uint]uint32
- v2, changed = fastpathTV.DecMapUintUint32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint]uint64:
- fastpathTV.DecMapUintUint64V(v, false, d)
- case *map[uint]uint64:
- var v2 map[uint]uint64
- v2, changed = fastpathTV.DecMapUintUint64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint]uintptr:
- fastpathTV.DecMapUintUintptrV(v, false, d)
- case *map[uint]uintptr:
- var v2 map[uint]uintptr
- v2, changed = fastpathTV.DecMapUintUintptrV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint]int:
- fastpathTV.DecMapUintIntV(v, false, d)
- case *map[uint]int:
- var v2 map[uint]int
- v2, changed = fastpathTV.DecMapUintIntV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint]int8:
- fastpathTV.DecMapUintInt8V(v, false, d)
- case *map[uint]int8:
- var v2 map[uint]int8
- v2, changed = fastpathTV.DecMapUintInt8V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint]int16:
- fastpathTV.DecMapUintInt16V(v, false, d)
- case *map[uint]int16:
- var v2 map[uint]int16
- v2, changed = fastpathTV.DecMapUintInt16V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint]int32:
- fastpathTV.DecMapUintInt32V(v, false, d)
- case *map[uint]int32:
- var v2 map[uint]int32
- v2, changed = fastpathTV.DecMapUintInt32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint]int64:
- fastpathTV.DecMapUintInt64V(v, false, d)
- case *map[uint]int64:
- var v2 map[uint]int64
- v2, changed = fastpathTV.DecMapUintInt64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint]float32:
- fastpathTV.DecMapUintFloat32V(v, false, d)
- case *map[uint]float32:
- var v2 map[uint]float32
- v2, changed = fastpathTV.DecMapUintFloat32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint]float64:
- fastpathTV.DecMapUintFloat64V(v, false, d)
- case *map[uint]float64:
- var v2 map[uint]float64
- v2, changed = fastpathTV.DecMapUintFloat64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint]bool:
- fastpathTV.DecMapUintBoolV(v, false, d)
- case *map[uint]bool:
- var v2 map[uint]bool
- v2, changed = fastpathTV.DecMapUintBoolV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint8]interface{}:
- fastpathTV.DecMapUint8IntfV(v, false, d)
- case *map[uint8]interface{}:
- var v2 map[uint8]interface{}
- v2, changed = fastpathTV.DecMapUint8IntfV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint8]string:
- fastpathTV.DecMapUint8StringV(v, false, d)
- case *map[uint8]string:
- var v2 map[uint8]string
- v2, changed = fastpathTV.DecMapUint8StringV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint8]uint:
- fastpathTV.DecMapUint8UintV(v, false, d)
- case *map[uint8]uint:
- var v2 map[uint8]uint
- v2, changed = fastpathTV.DecMapUint8UintV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint8]uint8:
- fastpathTV.DecMapUint8Uint8V(v, false, d)
- case *map[uint8]uint8:
- var v2 map[uint8]uint8
- v2, changed = fastpathTV.DecMapUint8Uint8V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint8]uint16:
- fastpathTV.DecMapUint8Uint16V(v, false, d)
- case *map[uint8]uint16:
- var v2 map[uint8]uint16
- v2, changed = fastpathTV.DecMapUint8Uint16V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint8]uint32:
- fastpathTV.DecMapUint8Uint32V(v, false, d)
- case *map[uint8]uint32:
- var v2 map[uint8]uint32
- v2, changed = fastpathTV.DecMapUint8Uint32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint8]uint64:
- fastpathTV.DecMapUint8Uint64V(v, false, d)
- case *map[uint8]uint64:
- var v2 map[uint8]uint64
- v2, changed = fastpathTV.DecMapUint8Uint64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint8]uintptr:
- fastpathTV.DecMapUint8UintptrV(v, false, d)
- case *map[uint8]uintptr:
- var v2 map[uint8]uintptr
- v2, changed = fastpathTV.DecMapUint8UintptrV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint8]int:
- fastpathTV.DecMapUint8IntV(v, false, d)
- case *map[uint8]int:
- var v2 map[uint8]int
- v2, changed = fastpathTV.DecMapUint8IntV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint8]int8:
- fastpathTV.DecMapUint8Int8V(v, false, d)
- case *map[uint8]int8:
- var v2 map[uint8]int8
- v2, changed = fastpathTV.DecMapUint8Int8V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint8]int16:
- fastpathTV.DecMapUint8Int16V(v, false, d)
- case *map[uint8]int16:
- var v2 map[uint8]int16
- v2, changed = fastpathTV.DecMapUint8Int16V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint8]int32:
- fastpathTV.DecMapUint8Int32V(v, false, d)
- case *map[uint8]int32:
- var v2 map[uint8]int32
- v2, changed = fastpathTV.DecMapUint8Int32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint8]int64:
- fastpathTV.DecMapUint8Int64V(v, false, d)
- case *map[uint8]int64:
- var v2 map[uint8]int64
- v2, changed = fastpathTV.DecMapUint8Int64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint8]float32:
- fastpathTV.DecMapUint8Float32V(v, false, d)
- case *map[uint8]float32:
- var v2 map[uint8]float32
- v2, changed = fastpathTV.DecMapUint8Float32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint8]float64:
- fastpathTV.DecMapUint8Float64V(v, false, d)
- case *map[uint8]float64:
- var v2 map[uint8]float64
- v2, changed = fastpathTV.DecMapUint8Float64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint8]bool:
- fastpathTV.DecMapUint8BoolV(v, false, d)
- case *map[uint8]bool:
- var v2 map[uint8]bool
- v2, changed = fastpathTV.DecMapUint8BoolV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint16]interface{}:
- fastpathTV.DecMapUint16IntfV(v, false, d)
- case *map[uint16]interface{}:
- var v2 map[uint16]interface{}
- v2, changed = fastpathTV.DecMapUint16IntfV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint16]string:
- fastpathTV.DecMapUint16StringV(v, false, d)
- case *map[uint16]string:
- var v2 map[uint16]string
- v2, changed = fastpathTV.DecMapUint16StringV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint16]uint:
- fastpathTV.DecMapUint16UintV(v, false, d)
- case *map[uint16]uint:
- var v2 map[uint16]uint
- v2, changed = fastpathTV.DecMapUint16UintV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint16]uint8:
- fastpathTV.DecMapUint16Uint8V(v, false, d)
- case *map[uint16]uint8:
- var v2 map[uint16]uint8
- v2, changed = fastpathTV.DecMapUint16Uint8V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint16]uint16:
- fastpathTV.DecMapUint16Uint16V(v, false, d)
- case *map[uint16]uint16:
- var v2 map[uint16]uint16
- v2, changed = fastpathTV.DecMapUint16Uint16V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint16]uint32:
- fastpathTV.DecMapUint16Uint32V(v, false, d)
- case *map[uint16]uint32:
- var v2 map[uint16]uint32
- v2, changed = fastpathTV.DecMapUint16Uint32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint16]uint64:
- fastpathTV.DecMapUint16Uint64V(v, false, d)
- case *map[uint16]uint64:
- var v2 map[uint16]uint64
- v2, changed = fastpathTV.DecMapUint16Uint64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint16]uintptr:
- fastpathTV.DecMapUint16UintptrV(v, false, d)
- case *map[uint16]uintptr:
- var v2 map[uint16]uintptr
- v2, changed = fastpathTV.DecMapUint16UintptrV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint16]int:
- fastpathTV.DecMapUint16IntV(v, false, d)
- case *map[uint16]int:
- var v2 map[uint16]int
- v2, changed = fastpathTV.DecMapUint16IntV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint16]int8:
- fastpathTV.DecMapUint16Int8V(v, false, d)
- case *map[uint16]int8:
- var v2 map[uint16]int8
- v2, changed = fastpathTV.DecMapUint16Int8V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint16]int16:
- fastpathTV.DecMapUint16Int16V(v, false, d)
- case *map[uint16]int16:
- var v2 map[uint16]int16
- v2, changed = fastpathTV.DecMapUint16Int16V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint16]int32:
- fastpathTV.DecMapUint16Int32V(v, false, d)
- case *map[uint16]int32:
- var v2 map[uint16]int32
- v2, changed = fastpathTV.DecMapUint16Int32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint16]int64:
- fastpathTV.DecMapUint16Int64V(v, false, d)
- case *map[uint16]int64:
- var v2 map[uint16]int64
- v2, changed = fastpathTV.DecMapUint16Int64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint16]float32:
- fastpathTV.DecMapUint16Float32V(v, false, d)
- case *map[uint16]float32:
- var v2 map[uint16]float32
- v2, changed = fastpathTV.DecMapUint16Float32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint16]float64:
- fastpathTV.DecMapUint16Float64V(v, false, d)
- case *map[uint16]float64:
- var v2 map[uint16]float64
- v2, changed = fastpathTV.DecMapUint16Float64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint16]bool:
- fastpathTV.DecMapUint16BoolV(v, false, d)
- case *map[uint16]bool:
- var v2 map[uint16]bool
- v2, changed = fastpathTV.DecMapUint16BoolV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint32]interface{}:
- fastpathTV.DecMapUint32IntfV(v, false, d)
- case *map[uint32]interface{}:
- var v2 map[uint32]interface{}
- v2, changed = fastpathTV.DecMapUint32IntfV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint32]string:
- fastpathTV.DecMapUint32StringV(v, false, d)
- case *map[uint32]string:
- var v2 map[uint32]string
- v2, changed = fastpathTV.DecMapUint32StringV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint32]uint:
- fastpathTV.DecMapUint32UintV(v, false, d)
- case *map[uint32]uint:
- var v2 map[uint32]uint
- v2, changed = fastpathTV.DecMapUint32UintV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint32]uint8:
- fastpathTV.DecMapUint32Uint8V(v, false, d)
- case *map[uint32]uint8:
- var v2 map[uint32]uint8
- v2, changed = fastpathTV.DecMapUint32Uint8V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint32]uint16:
- fastpathTV.DecMapUint32Uint16V(v, false, d)
- case *map[uint32]uint16:
- var v2 map[uint32]uint16
- v2, changed = fastpathTV.DecMapUint32Uint16V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint32]uint32:
- fastpathTV.DecMapUint32Uint32V(v, false, d)
- case *map[uint32]uint32:
- var v2 map[uint32]uint32
- v2, changed = fastpathTV.DecMapUint32Uint32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint32]uint64:
- fastpathTV.DecMapUint32Uint64V(v, false, d)
- case *map[uint32]uint64:
- var v2 map[uint32]uint64
- v2, changed = fastpathTV.DecMapUint32Uint64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint32]uintptr:
- fastpathTV.DecMapUint32UintptrV(v, false, d)
- case *map[uint32]uintptr:
- var v2 map[uint32]uintptr
- v2, changed = fastpathTV.DecMapUint32UintptrV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint32]int:
- fastpathTV.DecMapUint32IntV(v, false, d)
- case *map[uint32]int:
- var v2 map[uint32]int
- v2, changed = fastpathTV.DecMapUint32IntV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint32]int8:
- fastpathTV.DecMapUint32Int8V(v, false, d)
- case *map[uint32]int8:
- var v2 map[uint32]int8
- v2, changed = fastpathTV.DecMapUint32Int8V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint32]int16:
- fastpathTV.DecMapUint32Int16V(v, false, d)
- case *map[uint32]int16:
- var v2 map[uint32]int16
- v2, changed = fastpathTV.DecMapUint32Int16V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint32]int32:
- fastpathTV.DecMapUint32Int32V(v, false, d)
- case *map[uint32]int32:
- var v2 map[uint32]int32
- v2, changed = fastpathTV.DecMapUint32Int32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint32]int64:
- fastpathTV.DecMapUint32Int64V(v, false, d)
- case *map[uint32]int64:
- var v2 map[uint32]int64
- v2, changed = fastpathTV.DecMapUint32Int64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint32]float32:
- fastpathTV.DecMapUint32Float32V(v, false, d)
- case *map[uint32]float32:
- var v2 map[uint32]float32
- v2, changed = fastpathTV.DecMapUint32Float32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint32]float64:
- fastpathTV.DecMapUint32Float64V(v, false, d)
- case *map[uint32]float64:
- var v2 map[uint32]float64
- v2, changed = fastpathTV.DecMapUint32Float64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint32]bool:
- fastpathTV.DecMapUint32BoolV(v, false, d)
- case *map[uint32]bool:
- var v2 map[uint32]bool
- v2, changed = fastpathTV.DecMapUint32BoolV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint64]interface{}:
- fastpathTV.DecMapUint64IntfV(v, false, d)
- case *map[uint64]interface{}:
- var v2 map[uint64]interface{}
- v2, changed = fastpathTV.DecMapUint64IntfV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint64]string:
- fastpathTV.DecMapUint64StringV(v, false, d)
- case *map[uint64]string:
- var v2 map[uint64]string
- v2, changed = fastpathTV.DecMapUint64StringV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint64]uint:
- fastpathTV.DecMapUint64UintV(v, false, d)
- case *map[uint64]uint:
- var v2 map[uint64]uint
- v2, changed = fastpathTV.DecMapUint64UintV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint64]uint8:
- fastpathTV.DecMapUint64Uint8V(v, false, d)
- case *map[uint64]uint8:
- var v2 map[uint64]uint8
- v2, changed = fastpathTV.DecMapUint64Uint8V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint64]uint16:
- fastpathTV.DecMapUint64Uint16V(v, false, d)
- case *map[uint64]uint16:
- var v2 map[uint64]uint16
- v2, changed = fastpathTV.DecMapUint64Uint16V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint64]uint32:
- fastpathTV.DecMapUint64Uint32V(v, false, d)
- case *map[uint64]uint32:
- var v2 map[uint64]uint32
- v2, changed = fastpathTV.DecMapUint64Uint32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint64]uint64:
- fastpathTV.DecMapUint64Uint64V(v, false, d)
- case *map[uint64]uint64:
- var v2 map[uint64]uint64
- v2, changed = fastpathTV.DecMapUint64Uint64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint64]uintptr:
- fastpathTV.DecMapUint64UintptrV(v, false, d)
- case *map[uint64]uintptr:
- var v2 map[uint64]uintptr
- v2, changed = fastpathTV.DecMapUint64UintptrV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint64]int:
- fastpathTV.DecMapUint64IntV(v, false, d)
- case *map[uint64]int:
- var v2 map[uint64]int
- v2, changed = fastpathTV.DecMapUint64IntV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint64]int8:
- fastpathTV.DecMapUint64Int8V(v, false, d)
- case *map[uint64]int8:
- var v2 map[uint64]int8
- v2, changed = fastpathTV.DecMapUint64Int8V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint64]int16:
- fastpathTV.DecMapUint64Int16V(v, false, d)
- case *map[uint64]int16:
- var v2 map[uint64]int16
- v2, changed = fastpathTV.DecMapUint64Int16V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint64]int32:
- fastpathTV.DecMapUint64Int32V(v, false, d)
- case *map[uint64]int32:
- var v2 map[uint64]int32
- v2, changed = fastpathTV.DecMapUint64Int32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint64]int64:
- fastpathTV.DecMapUint64Int64V(v, false, d)
- case *map[uint64]int64:
- var v2 map[uint64]int64
- v2, changed = fastpathTV.DecMapUint64Int64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint64]float32:
- fastpathTV.DecMapUint64Float32V(v, false, d)
- case *map[uint64]float32:
- var v2 map[uint64]float32
- v2, changed = fastpathTV.DecMapUint64Float32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint64]float64:
- fastpathTV.DecMapUint64Float64V(v, false, d)
- case *map[uint64]float64:
- var v2 map[uint64]float64
- v2, changed = fastpathTV.DecMapUint64Float64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uint64]bool:
- fastpathTV.DecMapUint64BoolV(v, false, d)
- case *map[uint64]bool:
- var v2 map[uint64]bool
- v2, changed = fastpathTV.DecMapUint64BoolV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uintptr]interface{}:
- fastpathTV.DecMapUintptrIntfV(v, false, d)
- case *map[uintptr]interface{}:
- var v2 map[uintptr]interface{}
- v2, changed = fastpathTV.DecMapUintptrIntfV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uintptr]string:
- fastpathTV.DecMapUintptrStringV(v, false, d)
- case *map[uintptr]string:
- var v2 map[uintptr]string
- v2, changed = fastpathTV.DecMapUintptrStringV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uintptr]uint:
- fastpathTV.DecMapUintptrUintV(v, false, d)
- case *map[uintptr]uint:
- var v2 map[uintptr]uint
- v2, changed = fastpathTV.DecMapUintptrUintV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uintptr]uint8:
- fastpathTV.DecMapUintptrUint8V(v, false, d)
- case *map[uintptr]uint8:
- var v2 map[uintptr]uint8
- v2, changed = fastpathTV.DecMapUintptrUint8V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uintptr]uint16:
- fastpathTV.DecMapUintptrUint16V(v, false, d)
- case *map[uintptr]uint16:
- var v2 map[uintptr]uint16
- v2, changed = fastpathTV.DecMapUintptrUint16V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uintptr]uint32:
- fastpathTV.DecMapUintptrUint32V(v, false, d)
- case *map[uintptr]uint32:
- var v2 map[uintptr]uint32
- v2, changed = fastpathTV.DecMapUintptrUint32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uintptr]uint64:
- fastpathTV.DecMapUintptrUint64V(v, false, d)
- case *map[uintptr]uint64:
- var v2 map[uintptr]uint64
- v2, changed = fastpathTV.DecMapUintptrUint64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uintptr]uintptr:
- fastpathTV.DecMapUintptrUintptrV(v, false, d)
- case *map[uintptr]uintptr:
- var v2 map[uintptr]uintptr
- v2, changed = fastpathTV.DecMapUintptrUintptrV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uintptr]int:
- fastpathTV.DecMapUintptrIntV(v, false, d)
- case *map[uintptr]int:
- var v2 map[uintptr]int
- v2, changed = fastpathTV.DecMapUintptrIntV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uintptr]int8:
- fastpathTV.DecMapUintptrInt8V(v, false, d)
- case *map[uintptr]int8:
- var v2 map[uintptr]int8
- v2, changed = fastpathTV.DecMapUintptrInt8V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uintptr]int16:
- fastpathTV.DecMapUintptrInt16V(v, false, d)
- case *map[uintptr]int16:
- var v2 map[uintptr]int16
- v2, changed = fastpathTV.DecMapUintptrInt16V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uintptr]int32:
- fastpathTV.DecMapUintptrInt32V(v, false, d)
- case *map[uintptr]int32:
- var v2 map[uintptr]int32
- v2, changed = fastpathTV.DecMapUintptrInt32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uintptr]int64:
- fastpathTV.DecMapUintptrInt64V(v, false, d)
- case *map[uintptr]int64:
- var v2 map[uintptr]int64
- v2, changed = fastpathTV.DecMapUintptrInt64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uintptr]float32:
- fastpathTV.DecMapUintptrFloat32V(v, false, d)
- case *map[uintptr]float32:
- var v2 map[uintptr]float32
- v2, changed = fastpathTV.DecMapUintptrFloat32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uintptr]float64:
- fastpathTV.DecMapUintptrFloat64V(v, false, d)
- case *map[uintptr]float64:
- var v2 map[uintptr]float64
- v2, changed = fastpathTV.DecMapUintptrFloat64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[uintptr]bool:
- fastpathTV.DecMapUintptrBoolV(v, false, d)
- case *map[uintptr]bool:
- var v2 map[uintptr]bool
- v2, changed = fastpathTV.DecMapUintptrBoolV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int]interface{}:
- fastpathTV.DecMapIntIntfV(v, false, d)
- case *map[int]interface{}:
- var v2 map[int]interface{}
- v2, changed = fastpathTV.DecMapIntIntfV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int]string:
- fastpathTV.DecMapIntStringV(v, false, d)
- case *map[int]string:
- var v2 map[int]string
- v2, changed = fastpathTV.DecMapIntStringV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int]uint:
- fastpathTV.DecMapIntUintV(v, false, d)
- case *map[int]uint:
- var v2 map[int]uint
- v2, changed = fastpathTV.DecMapIntUintV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int]uint8:
- fastpathTV.DecMapIntUint8V(v, false, d)
- case *map[int]uint8:
- var v2 map[int]uint8
- v2, changed = fastpathTV.DecMapIntUint8V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int]uint16:
- fastpathTV.DecMapIntUint16V(v, false, d)
- case *map[int]uint16:
- var v2 map[int]uint16
- v2, changed = fastpathTV.DecMapIntUint16V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int]uint32:
- fastpathTV.DecMapIntUint32V(v, false, d)
- case *map[int]uint32:
- var v2 map[int]uint32
- v2, changed = fastpathTV.DecMapIntUint32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int]uint64:
- fastpathTV.DecMapIntUint64V(v, false, d)
- case *map[int]uint64:
- var v2 map[int]uint64
- v2, changed = fastpathTV.DecMapIntUint64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int]uintptr:
- fastpathTV.DecMapIntUintptrV(v, false, d)
- case *map[int]uintptr:
- var v2 map[int]uintptr
- v2, changed = fastpathTV.DecMapIntUintptrV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int]int:
- fastpathTV.DecMapIntIntV(v, false, d)
- case *map[int]int:
- var v2 map[int]int
- v2, changed = fastpathTV.DecMapIntIntV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int]int8:
- fastpathTV.DecMapIntInt8V(v, false, d)
- case *map[int]int8:
- var v2 map[int]int8
- v2, changed = fastpathTV.DecMapIntInt8V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int]int16:
- fastpathTV.DecMapIntInt16V(v, false, d)
- case *map[int]int16:
- var v2 map[int]int16
- v2, changed = fastpathTV.DecMapIntInt16V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int]int32:
- fastpathTV.DecMapIntInt32V(v, false, d)
- case *map[int]int32:
- var v2 map[int]int32
- v2, changed = fastpathTV.DecMapIntInt32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int]int64:
- fastpathTV.DecMapIntInt64V(v, false, d)
- case *map[int]int64:
- var v2 map[int]int64
- v2, changed = fastpathTV.DecMapIntInt64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int]float32:
- fastpathTV.DecMapIntFloat32V(v, false, d)
- case *map[int]float32:
- var v2 map[int]float32
- v2, changed = fastpathTV.DecMapIntFloat32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int]float64:
- fastpathTV.DecMapIntFloat64V(v, false, d)
- case *map[int]float64:
- var v2 map[int]float64
- v2, changed = fastpathTV.DecMapIntFloat64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int]bool:
- fastpathTV.DecMapIntBoolV(v, false, d)
- case *map[int]bool:
- var v2 map[int]bool
- v2, changed = fastpathTV.DecMapIntBoolV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int8]interface{}:
- fastpathTV.DecMapInt8IntfV(v, false, d)
- case *map[int8]interface{}:
- var v2 map[int8]interface{}
- v2, changed = fastpathTV.DecMapInt8IntfV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int8]string:
- fastpathTV.DecMapInt8StringV(v, false, d)
- case *map[int8]string:
- var v2 map[int8]string
- v2, changed = fastpathTV.DecMapInt8StringV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int8]uint:
- fastpathTV.DecMapInt8UintV(v, false, d)
- case *map[int8]uint:
- var v2 map[int8]uint
- v2, changed = fastpathTV.DecMapInt8UintV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int8]uint8:
- fastpathTV.DecMapInt8Uint8V(v, false, d)
- case *map[int8]uint8:
- var v2 map[int8]uint8
- v2, changed = fastpathTV.DecMapInt8Uint8V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int8]uint16:
- fastpathTV.DecMapInt8Uint16V(v, false, d)
- case *map[int8]uint16:
- var v2 map[int8]uint16
- v2, changed = fastpathTV.DecMapInt8Uint16V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int8]uint32:
- fastpathTV.DecMapInt8Uint32V(v, false, d)
- case *map[int8]uint32:
- var v2 map[int8]uint32
- v2, changed = fastpathTV.DecMapInt8Uint32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int8]uint64:
- fastpathTV.DecMapInt8Uint64V(v, false, d)
- case *map[int8]uint64:
- var v2 map[int8]uint64
- v2, changed = fastpathTV.DecMapInt8Uint64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int8]uintptr:
- fastpathTV.DecMapInt8UintptrV(v, false, d)
- case *map[int8]uintptr:
- var v2 map[int8]uintptr
- v2, changed = fastpathTV.DecMapInt8UintptrV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int8]int:
- fastpathTV.DecMapInt8IntV(v, false, d)
- case *map[int8]int:
- var v2 map[int8]int
- v2, changed = fastpathTV.DecMapInt8IntV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int8]int8:
- fastpathTV.DecMapInt8Int8V(v, false, d)
- case *map[int8]int8:
- var v2 map[int8]int8
- v2, changed = fastpathTV.DecMapInt8Int8V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int8]int16:
- fastpathTV.DecMapInt8Int16V(v, false, d)
- case *map[int8]int16:
- var v2 map[int8]int16
- v2, changed = fastpathTV.DecMapInt8Int16V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int8]int32:
- fastpathTV.DecMapInt8Int32V(v, false, d)
- case *map[int8]int32:
- var v2 map[int8]int32
- v2, changed = fastpathTV.DecMapInt8Int32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int8]int64:
- fastpathTV.DecMapInt8Int64V(v, false, d)
- case *map[int8]int64:
- var v2 map[int8]int64
- v2, changed = fastpathTV.DecMapInt8Int64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int8]float32:
- fastpathTV.DecMapInt8Float32V(v, false, d)
- case *map[int8]float32:
- var v2 map[int8]float32
- v2, changed = fastpathTV.DecMapInt8Float32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int8]float64:
- fastpathTV.DecMapInt8Float64V(v, false, d)
- case *map[int8]float64:
- var v2 map[int8]float64
- v2, changed = fastpathTV.DecMapInt8Float64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int8]bool:
- fastpathTV.DecMapInt8BoolV(v, false, d)
- case *map[int8]bool:
- var v2 map[int8]bool
- v2, changed = fastpathTV.DecMapInt8BoolV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int16]interface{}:
- fastpathTV.DecMapInt16IntfV(v, false, d)
- case *map[int16]interface{}:
- var v2 map[int16]interface{}
- v2, changed = fastpathTV.DecMapInt16IntfV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int16]string:
- fastpathTV.DecMapInt16StringV(v, false, d)
- case *map[int16]string:
- var v2 map[int16]string
- v2, changed = fastpathTV.DecMapInt16StringV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int16]uint:
- fastpathTV.DecMapInt16UintV(v, false, d)
- case *map[int16]uint:
- var v2 map[int16]uint
- v2, changed = fastpathTV.DecMapInt16UintV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int16]uint8:
- fastpathTV.DecMapInt16Uint8V(v, false, d)
- case *map[int16]uint8:
- var v2 map[int16]uint8
- v2, changed = fastpathTV.DecMapInt16Uint8V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int16]uint16:
- fastpathTV.DecMapInt16Uint16V(v, false, d)
- case *map[int16]uint16:
- var v2 map[int16]uint16
- v2, changed = fastpathTV.DecMapInt16Uint16V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int16]uint32:
- fastpathTV.DecMapInt16Uint32V(v, false, d)
- case *map[int16]uint32:
- var v2 map[int16]uint32
- v2, changed = fastpathTV.DecMapInt16Uint32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int16]uint64:
- fastpathTV.DecMapInt16Uint64V(v, false, d)
- case *map[int16]uint64:
- var v2 map[int16]uint64
- v2, changed = fastpathTV.DecMapInt16Uint64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int16]uintptr:
- fastpathTV.DecMapInt16UintptrV(v, false, d)
- case *map[int16]uintptr:
- var v2 map[int16]uintptr
- v2, changed = fastpathTV.DecMapInt16UintptrV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int16]int:
- fastpathTV.DecMapInt16IntV(v, false, d)
- case *map[int16]int:
- var v2 map[int16]int
- v2, changed = fastpathTV.DecMapInt16IntV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int16]int8:
- fastpathTV.DecMapInt16Int8V(v, false, d)
- case *map[int16]int8:
- var v2 map[int16]int8
- v2, changed = fastpathTV.DecMapInt16Int8V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int16]int16:
- fastpathTV.DecMapInt16Int16V(v, false, d)
- case *map[int16]int16:
- var v2 map[int16]int16
- v2, changed = fastpathTV.DecMapInt16Int16V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int16]int32:
- fastpathTV.DecMapInt16Int32V(v, false, d)
- case *map[int16]int32:
- var v2 map[int16]int32
- v2, changed = fastpathTV.DecMapInt16Int32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int16]int64:
- fastpathTV.DecMapInt16Int64V(v, false, d)
- case *map[int16]int64:
- var v2 map[int16]int64
- v2, changed = fastpathTV.DecMapInt16Int64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int16]float32:
- fastpathTV.DecMapInt16Float32V(v, false, d)
- case *map[int16]float32:
- var v2 map[int16]float32
- v2, changed = fastpathTV.DecMapInt16Float32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int16]float64:
- fastpathTV.DecMapInt16Float64V(v, false, d)
- case *map[int16]float64:
- var v2 map[int16]float64
- v2, changed = fastpathTV.DecMapInt16Float64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int16]bool:
- fastpathTV.DecMapInt16BoolV(v, false, d)
- case *map[int16]bool:
- var v2 map[int16]bool
- v2, changed = fastpathTV.DecMapInt16BoolV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int32]interface{}:
- fastpathTV.DecMapInt32IntfV(v, false, d)
- case *map[int32]interface{}:
- var v2 map[int32]interface{}
- v2, changed = fastpathTV.DecMapInt32IntfV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int32]string:
- fastpathTV.DecMapInt32StringV(v, false, d)
- case *map[int32]string:
- var v2 map[int32]string
- v2, changed = fastpathTV.DecMapInt32StringV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int32]uint:
- fastpathTV.DecMapInt32UintV(v, false, d)
- case *map[int32]uint:
- var v2 map[int32]uint
- v2, changed = fastpathTV.DecMapInt32UintV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int32]uint8:
- fastpathTV.DecMapInt32Uint8V(v, false, d)
- case *map[int32]uint8:
- var v2 map[int32]uint8
- v2, changed = fastpathTV.DecMapInt32Uint8V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int32]uint16:
- fastpathTV.DecMapInt32Uint16V(v, false, d)
- case *map[int32]uint16:
- var v2 map[int32]uint16
- v2, changed = fastpathTV.DecMapInt32Uint16V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int32]uint32:
- fastpathTV.DecMapInt32Uint32V(v, false, d)
- case *map[int32]uint32:
- var v2 map[int32]uint32
- v2, changed = fastpathTV.DecMapInt32Uint32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int32]uint64:
- fastpathTV.DecMapInt32Uint64V(v, false, d)
- case *map[int32]uint64:
- var v2 map[int32]uint64
- v2, changed = fastpathTV.DecMapInt32Uint64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int32]uintptr:
- fastpathTV.DecMapInt32UintptrV(v, false, d)
- case *map[int32]uintptr:
- var v2 map[int32]uintptr
- v2, changed = fastpathTV.DecMapInt32UintptrV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int32]int:
- fastpathTV.DecMapInt32IntV(v, false, d)
- case *map[int32]int:
- var v2 map[int32]int
- v2, changed = fastpathTV.DecMapInt32IntV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int32]int8:
- fastpathTV.DecMapInt32Int8V(v, false, d)
- case *map[int32]int8:
- var v2 map[int32]int8
- v2, changed = fastpathTV.DecMapInt32Int8V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int32]int16:
- fastpathTV.DecMapInt32Int16V(v, false, d)
- case *map[int32]int16:
- var v2 map[int32]int16
- v2, changed = fastpathTV.DecMapInt32Int16V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int32]int32:
- fastpathTV.DecMapInt32Int32V(v, false, d)
- case *map[int32]int32:
- var v2 map[int32]int32
- v2, changed = fastpathTV.DecMapInt32Int32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int32]int64:
- fastpathTV.DecMapInt32Int64V(v, false, d)
- case *map[int32]int64:
- var v2 map[int32]int64
- v2, changed = fastpathTV.DecMapInt32Int64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int32]float32:
- fastpathTV.DecMapInt32Float32V(v, false, d)
- case *map[int32]float32:
- var v2 map[int32]float32
- v2, changed = fastpathTV.DecMapInt32Float32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int32]float64:
- fastpathTV.DecMapInt32Float64V(v, false, d)
- case *map[int32]float64:
- var v2 map[int32]float64
- v2, changed = fastpathTV.DecMapInt32Float64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int32]bool:
- fastpathTV.DecMapInt32BoolV(v, false, d)
- case *map[int32]bool:
- var v2 map[int32]bool
- v2, changed = fastpathTV.DecMapInt32BoolV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int64]interface{}:
- fastpathTV.DecMapInt64IntfV(v, false, d)
- case *map[int64]interface{}:
- var v2 map[int64]interface{}
- v2, changed = fastpathTV.DecMapInt64IntfV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int64]string:
- fastpathTV.DecMapInt64StringV(v, false, d)
- case *map[int64]string:
- var v2 map[int64]string
- v2, changed = fastpathTV.DecMapInt64StringV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int64]uint:
- fastpathTV.DecMapInt64UintV(v, false, d)
- case *map[int64]uint:
- var v2 map[int64]uint
- v2, changed = fastpathTV.DecMapInt64UintV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int64]uint8:
- fastpathTV.DecMapInt64Uint8V(v, false, d)
- case *map[int64]uint8:
- var v2 map[int64]uint8
- v2, changed = fastpathTV.DecMapInt64Uint8V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int64]uint16:
- fastpathTV.DecMapInt64Uint16V(v, false, d)
- case *map[int64]uint16:
- var v2 map[int64]uint16
- v2, changed = fastpathTV.DecMapInt64Uint16V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int64]uint32:
- fastpathTV.DecMapInt64Uint32V(v, false, d)
- case *map[int64]uint32:
- var v2 map[int64]uint32
- v2, changed = fastpathTV.DecMapInt64Uint32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int64]uint64:
- fastpathTV.DecMapInt64Uint64V(v, false, d)
- case *map[int64]uint64:
- var v2 map[int64]uint64
- v2, changed = fastpathTV.DecMapInt64Uint64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int64]uintptr:
- fastpathTV.DecMapInt64UintptrV(v, false, d)
- case *map[int64]uintptr:
- var v2 map[int64]uintptr
- v2, changed = fastpathTV.DecMapInt64UintptrV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int64]int:
- fastpathTV.DecMapInt64IntV(v, false, d)
- case *map[int64]int:
- var v2 map[int64]int
- v2, changed = fastpathTV.DecMapInt64IntV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int64]int8:
- fastpathTV.DecMapInt64Int8V(v, false, d)
- case *map[int64]int8:
- var v2 map[int64]int8
- v2, changed = fastpathTV.DecMapInt64Int8V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int64]int16:
- fastpathTV.DecMapInt64Int16V(v, false, d)
- case *map[int64]int16:
- var v2 map[int64]int16
- v2, changed = fastpathTV.DecMapInt64Int16V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int64]int32:
- fastpathTV.DecMapInt64Int32V(v, false, d)
- case *map[int64]int32:
- var v2 map[int64]int32
- v2, changed = fastpathTV.DecMapInt64Int32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int64]int64:
- fastpathTV.DecMapInt64Int64V(v, false, d)
- case *map[int64]int64:
- var v2 map[int64]int64
- v2, changed = fastpathTV.DecMapInt64Int64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int64]float32:
- fastpathTV.DecMapInt64Float32V(v, false, d)
- case *map[int64]float32:
- var v2 map[int64]float32
- v2, changed = fastpathTV.DecMapInt64Float32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int64]float64:
- fastpathTV.DecMapInt64Float64V(v, false, d)
- case *map[int64]float64:
- var v2 map[int64]float64
- v2, changed = fastpathTV.DecMapInt64Float64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[int64]bool:
- fastpathTV.DecMapInt64BoolV(v, false, d)
- case *map[int64]bool:
- var v2 map[int64]bool
- v2, changed = fastpathTV.DecMapInt64BoolV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[bool]interface{}:
- fastpathTV.DecMapBoolIntfV(v, false, d)
- case *map[bool]interface{}:
- var v2 map[bool]interface{}
- v2, changed = fastpathTV.DecMapBoolIntfV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[bool]string:
- fastpathTV.DecMapBoolStringV(v, false, d)
- case *map[bool]string:
- var v2 map[bool]string
- v2, changed = fastpathTV.DecMapBoolStringV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[bool]uint:
- fastpathTV.DecMapBoolUintV(v, false, d)
- case *map[bool]uint:
- var v2 map[bool]uint
- v2, changed = fastpathTV.DecMapBoolUintV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[bool]uint8:
- fastpathTV.DecMapBoolUint8V(v, false, d)
- case *map[bool]uint8:
- var v2 map[bool]uint8
- v2, changed = fastpathTV.DecMapBoolUint8V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[bool]uint16:
- fastpathTV.DecMapBoolUint16V(v, false, d)
- case *map[bool]uint16:
- var v2 map[bool]uint16
- v2, changed = fastpathTV.DecMapBoolUint16V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[bool]uint32:
- fastpathTV.DecMapBoolUint32V(v, false, d)
- case *map[bool]uint32:
- var v2 map[bool]uint32
- v2, changed = fastpathTV.DecMapBoolUint32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[bool]uint64:
- fastpathTV.DecMapBoolUint64V(v, false, d)
- case *map[bool]uint64:
- var v2 map[bool]uint64
- v2, changed = fastpathTV.DecMapBoolUint64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[bool]uintptr:
- fastpathTV.DecMapBoolUintptrV(v, false, d)
- case *map[bool]uintptr:
- var v2 map[bool]uintptr
- v2, changed = fastpathTV.DecMapBoolUintptrV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[bool]int:
- fastpathTV.DecMapBoolIntV(v, false, d)
- case *map[bool]int:
- var v2 map[bool]int
- v2, changed = fastpathTV.DecMapBoolIntV(*v, true, d)
- if changed {
- *v = v2
- }
- case map[bool]int8:
- fastpathTV.DecMapBoolInt8V(v, false, d)
- case *map[bool]int8:
- var v2 map[bool]int8
- v2, changed = fastpathTV.DecMapBoolInt8V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[bool]int16:
- fastpathTV.DecMapBoolInt16V(v, false, d)
- case *map[bool]int16:
- var v2 map[bool]int16
- v2, changed = fastpathTV.DecMapBoolInt16V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[bool]int32:
- fastpathTV.DecMapBoolInt32V(v, false, d)
- case *map[bool]int32:
- var v2 map[bool]int32
- v2, changed = fastpathTV.DecMapBoolInt32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[bool]int64:
- fastpathTV.DecMapBoolInt64V(v, false, d)
- case *map[bool]int64:
- var v2 map[bool]int64
- v2, changed = fastpathTV.DecMapBoolInt64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[bool]float32:
- fastpathTV.DecMapBoolFloat32V(v, false, d)
- case *map[bool]float32:
- var v2 map[bool]float32
- v2, changed = fastpathTV.DecMapBoolFloat32V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[bool]float64:
- fastpathTV.DecMapBoolFloat64V(v, false, d)
- case *map[bool]float64:
- var v2 map[bool]float64
- v2, changed = fastpathTV.DecMapBoolFloat64V(*v, true, d)
- if changed {
- *v = v2
- }
- case map[bool]bool:
- fastpathTV.DecMapBoolBoolV(v, false, d)
- case *map[bool]bool:
- var v2 map[bool]bool
- v2, changed = fastpathTV.DecMapBoolBoolV(*v, true, d)
- if changed {
- *v = v2
- }
- default:
- _ = v // workaround https://github.com/golang/go/issues/12927 seen in go1.4
- return false
- }
- return true
-}
-
-func fastpathDecodeSetZeroTypeSwitch(iv interface{}) bool {
- switch v := iv.(type) {
-
- case *[]interface{}:
- *v = nil
- case *[]string:
- *v = nil
- case *[]float32:
- *v = nil
- case *[]float64:
- *v = nil
- case *[]uint:
- *v = nil
- case *[]uint8:
- *v = nil
- case *[]uint16:
- *v = nil
- case *[]uint32:
- *v = nil
- case *[]uint64:
- *v = nil
- case *[]uintptr:
- *v = nil
- case *[]int:
- *v = nil
- case *[]int8:
- *v = nil
- case *[]int16:
- *v = nil
- case *[]int32:
- *v = nil
- case *[]int64:
- *v = nil
- case *[]bool:
- *v = nil
-
- case *map[interface{}]interface{}:
- *v = nil
- case *map[interface{}]string:
- *v = nil
- case *map[interface{}]uint:
- *v = nil
- case *map[interface{}]uint8:
- *v = nil
- case *map[interface{}]uint16:
- *v = nil
- case *map[interface{}]uint32:
- *v = nil
- case *map[interface{}]uint64:
- *v = nil
- case *map[interface{}]uintptr:
- *v = nil
- case *map[interface{}]int:
- *v = nil
- case *map[interface{}]int8:
- *v = nil
- case *map[interface{}]int16:
- *v = nil
- case *map[interface{}]int32:
- *v = nil
- case *map[interface{}]int64:
- *v = nil
- case *map[interface{}]float32:
- *v = nil
- case *map[interface{}]float64:
- *v = nil
- case *map[interface{}]bool:
- *v = nil
- case *map[string]interface{}:
- *v = nil
- case *map[string]string:
- *v = nil
- case *map[string]uint:
- *v = nil
- case *map[string]uint8:
- *v = nil
- case *map[string]uint16:
- *v = nil
- case *map[string]uint32:
- *v = nil
- case *map[string]uint64:
- *v = nil
- case *map[string]uintptr:
- *v = nil
- case *map[string]int:
- *v = nil
- case *map[string]int8:
- *v = nil
- case *map[string]int16:
- *v = nil
- case *map[string]int32:
- *v = nil
- case *map[string]int64:
- *v = nil
- case *map[string]float32:
- *v = nil
- case *map[string]float64:
- *v = nil
- case *map[string]bool:
- *v = nil
- case *map[float32]interface{}:
- *v = nil
- case *map[float32]string:
- *v = nil
- case *map[float32]uint:
- *v = nil
- case *map[float32]uint8:
- *v = nil
- case *map[float32]uint16:
- *v = nil
- case *map[float32]uint32:
- *v = nil
- case *map[float32]uint64:
- *v = nil
- case *map[float32]uintptr:
- *v = nil
- case *map[float32]int:
- *v = nil
- case *map[float32]int8:
- *v = nil
- case *map[float32]int16:
- *v = nil
- case *map[float32]int32:
- *v = nil
- case *map[float32]int64:
- *v = nil
- case *map[float32]float32:
- *v = nil
- case *map[float32]float64:
- *v = nil
- case *map[float32]bool:
- *v = nil
- case *map[float64]interface{}:
- *v = nil
- case *map[float64]string:
- *v = nil
- case *map[float64]uint:
- *v = nil
- case *map[float64]uint8:
- *v = nil
- case *map[float64]uint16:
- *v = nil
- case *map[float64]uint32:
- *v = nil
- case *map[float64]uint64:
- *v = nil
- case *map[float64]uintptr:
- *v = nil
- case *map[float64]int:
- *v = nil
- case *map[float64]int8:
- *v = nil
- case *map[float64]int16:
- *v = nil
- case *map[float64]int32:
- *v = nil
- case *map[float64]int64:
- *v = nil
- case *map[float64]float32:
- *v = nil
- case *map[float64]float64:
- *v = nil
- case *map[float64]bool:
- *v = nil
- case *map[uint]interface{}:
- *v = nil
- case *map[uint]string:
- *v = nil
- case *map[uint]uint:
- *v = nil
- case *map[uint]uint8:
- *v = nil
- case *map[uint]uint16:
- *v = nil
- case *map[uint]uint32:
- *v = nil
- case *map[uint]uint64:
- *v = nil
- case *map[uint]uintptr:
- *v = nil
- case *map[uint]int:
- *v = nil
- case *map[uint]int8:
- *v = nil
- case *map[uint]int16:
- *v = nil
- case *map[uint]int32:
- *v = nil
- case *map[uint]int64:
- *v = nil
- case *map[uint]float32:
- *v = nil
- case *map[uint]float64:
- *v = nil
- case *map[uint]bool:
- *v = nil
- case *map[uint8]interface{}:
- *v = nil
- case *map[uint8]string:
- *v = nil
- case *map[uint8]uint:
- *v = nil
- case *map[uint8]uint8:
- *v = nil
- case *map[uint8]uint16:
- *v = nil
- case *map[uint8]uint32:
- *v = nil
- case *map[uint8]uint64:
- *v = nil
- case *map[uint8]uintptr:
- *v = nil
- case *map[uint8]int:
- *v = nil
- case *map[uint8]int8:
- *v = nil
- case *map[uint8]int16:
- *v = nil
- case *map[uint8]int32:
- *v = nil
- case *map[uint8]int64:
- *v = nil
- case *map[uint8]float32:
- *v = nil
- case *map[uint8]float64:
- *v = nil
- case *map[uint8]bool:
- *v = nil
- case *map[uint16]interface{}:
- *v = nil
- case *map[uint16]string:
- *v = nil
- case *map[uint16]uint:
- *v = nil
- case *map[uint16]uint8:
- *v = nil
- case *map[uint16]uint16:
- *v = nil
- case *map[uint16]uint32:
- *v = nil
- case *map[uint16]uint64:
- *v = nil
- case *map[uint16]uintptr:
- *v = nil
- case *map[uint16]int:
- *v = nil
- case *map[uint16]int8:
- *v = nil
- case *map[uint16]int16:
- *v = nil
- case *map[uint16]int32:
- *v = nil
- case *map[uint16]int64:
- *v = nil
- case *map[uint16]float32:
- *v = nil
- case *map[uint16]float64:
- *v = nil
- case *map[uint16]bool:
- *v = nil
- case *map[uint32]interface{}:
- *v = nil
- case *map[uint32]string:
- *v = nil
- case *map[uint32]uint:
- *v = nil
- case *map[uint32]uint8:
- *v = nil
- case *map[uint32]uint16:
- *v = nil
- case *map[uint32]uint32:
- *v = nil
- case *map[uint32]uint64:
- *v = nil
- case *map[uint32]uintptr:
- *v = nil
- case *map[uint32]int:
- *v = nil
- case *map[uint32]int8:
- *v = nil
- case *map[uint32]int16:
- *v = nil
- case *map[uint32]int32:
- *v = nil
- case *map[uint32]int64:
- *v = nil
- case *map[uint32]float32:
- *v = nil
- case *map[uint32]float64:
- *v = nil
- case *map[uint32]bool:
- *v = nil
- case *map[uint64]interface{}:
- *v = nil
- case *map[uint64]string:
- *v = nil
- case *map[uint64]uint:
- *v = nil
- case *map[uint64]uint8:
- *v = nil
- case *map[uint64]uint16:
- *v = nil
- case *map[uint64]uint32:
- *v = nil
- case *map[uint64]uint64:
- *v = nil
- case *map[uint64]uintptr:
- *v = nil
- case *map[uint64]int:
- *v = nil
- case *map[uint64]int8:
- *v = nil
- case *map[uint64]int16:
- *v = nil
- case *map[uint64]int32:
- *v = nil
- case *map[uint64]int64:
- *v = nil
- case *map[uint64]float32:
- *v = nil
- case *map[uint64]float64:
- *v = nil
- case *map[uint64]bool:
- *v = nil
- case *map[uintptr]interface{}:
- *v = nil
- case *map[uintptr]string:
- *v = nil
- case *map[uintptr]uint:
- *v = nil
- case *map[uintptr]uint8:
- *v = nil
- case *map[uintptr]uint16:
- *v = nil
- case *map[uintptr]uint32:
- *v = nil
- case *map[uintptr]uint64:
- *v = nil
- case *map[uintptr]uintptr:
- *v = nil
- case *map[uintptr]int:
- *v = nil
- case *map[uintptr]int8:
- *v = nil
- case *map[uintptr]int16:
- *v = nil
- case *map[uintptr]int32:
- *v = nil
- case *map[uintptr]int64:
- *v = nil
- case *map[uintptr]float32:
- *v = nil
- case *map[uintptr]float64:
- *v = nil
- case *map[uintptr]bool:
- *v = nil
- case *map[int]interface{}:
- *v = nil
- case *map[int]string:
- *v = nil
- case *map[int]uint:
- *v = nil
- case *map[int]uint8:
- *v = nil
- case *map[int]uint16:
- *v = nil
- case *map[int]uint32:
- *v = nil
- case *map[int]uint64:
- *v = nil
- case *map[int]uintptr:
- *v = nil
- case *map[int]int:
- *v = nil
- case *map[int]int8:
- *v = nil
- case *map[int]int16:
- *v = nil
- case *map[int]int32:
- *v = nil
- case *map[int]int64:
- *v = nil
- case *map[int]float32:
- *v = nil
- case *map[int]float64:
- *v = nil
- case *map[int]bool:
- *v = nil
- case *map[int8]interface{}:
- *v = nil
- case *map[int8]string:
- *v = nil
- case *map[int8]uint:
- *v = nil
- case *map[int8]uint8:
- *v = nil
- case *map[int8]uint16:
- *v = nil
- case *map[int8]uint32:
- *v = nil
- case *map[int8]uint64:
- *v = nil
- case *map[int8]uintptr:
- *v = nil
- case *map[int8]int:
- *v = nil
- case *map[int8]int8:
- *v = nil
- case *map[int8]int16:
- *v = nil
- case *map[int8]int32:
- *v = nil
- case *map[int8]int64:
- *v = nil
- case *map[int8]float32:
- *v = nil
- case *map[int8]float64:
- *v = nil
- case *map[int8]bool:
- *v = nil
- case *map[int16]interface{}:
- *v = nil
- case *map[int16]string:
- *v = nil
- case *map[int16]uint:
- *v = nil
- case *map[int16]uint8:
- *v = nil
- case *map[int16]uint16:
- *v = nil
- case *map[int16]uint32:
- *v = nil
- case *map[int16]uint64:
- *v = nil
- case *map[int16]uintptr:
- *v = nil
- case *map[int16]int:
- *v = nil
- case *map[int16]int8:
- *v = nil
- case *map[int16]int16:
- *v = nil
- case *map[int16]int32:
- *v = nil
- case *map[int16]int64:
- *v = nil
- case *map[int16]float32:
- *v = nil
- case *map[int16]float64:
- *v = nil
- case *map[int16]bool:
- *v = nil
- case *map[int32]interface{}:
- *v = nil
- case *map[int32]string:
- *v = nil
- case *map[int32]uint:
- *v = nil
- case *map[int32]uint8:
- *v = nil
- case *map[int32]uint16:
- *v = nil
- case *map[int32]uint32:
- *v = nil
- case *map[int32]uint64:
- *v = nil
- case *map[int32]uintptr:
- *v = nil
- case *map[int32]int:
- *v = nil
- case *map[int32]int8:
- *v = nil
- case *map[int32]int16:
- *v = nil
- case *map[int32]int32:
- *v = nil
- case *map[int32]int64:
- *v = nil
- case *map[int32]float32:
- *v = nil
- case *map[int32]float64:
- *v = nil
- case *map[int32]bool:
- *v = nil
- case *map[int64]interface{}:
- *v = nil
- case *map[int64]string:
- *v = nil
- case *map[int64]uint:
- *v = nil
- case *map[int64]uint8:
- *v = nil
- case *map[int64]uint16:
- *v = nil
- case *map[int64]uint32:
- *v = nil
- case *map[int64]uint64:
- *v = nil
- case *map[int64]uintptr:
- *v = nil
- case *map[int64]int:
- *v = nil
- case *map[int64]int8:
- *v = nil
- case *map[int64]int16:
- *v = nil
- case *map[int64]int32:
- *v = nil
- case *map[int64]int64:
- *v = nil
- case *map[int64]float32:
- *v = nil
- case *map[int64]float64:
- *v = nil
- case *map[int64]bool:
- *v = nil
- case *map[bool]interface{}:
- *v = nil
- case *map[bool]string:
- *v = nil
- case *map[bool]uint:
- *v = nil
- case *map[bool]uint8:
- *v = nil
- case *map[bool]uint16:
- *v = nil
- case *map[bool]uint32:
- *v = nil
- case *map[bool]uint64:
- *v = nil
- case *map[bool]uintptr:
- *v = nil
- case *map[bool]int:
- *v = nil
- case *map[bool]int8:
- *v = nil
- case *map[bool]int16:
- *v = nil
- case *map[bool]int32:
- *v = nil
- case *map[bool]int64:
- *v = nil
- case *map[bool]float32:
- *v = nil
- case *map[bool]float64:
- *v = nil
- case *map[bool]bool:
- *v = nil
- default:
- _ = v // workaround https://github.com/golang/go/issues/12927 seen in go1.4
- return false
- }
- return true
-}
-
-// -- -- fast path functions
-
-func (d *Decoder) fastpathDecSliceIntfR(f *codecFnInfo, rv reflect.Value) {
- if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*[]interface{})
- v, changed := fastpathTV.DecSliceIntfV(*vp, !array, d)
- if changed {
- *vp = v
- }
- } else {
- v := rv2i(rv).([]interface{})
- v2, changed := fastpathTV.DecSliceIntfV(v, !array, d)
- if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
- copy(v, v2)
- }
- }
-}
-func (f fastpathT) DecSliceIntfX(vp *[]interface{}, d *Decoder) {
- v, changed := f.DecSliceIntfV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceIntfV(v []interface{}, canChange bool, d *Decoder) (_ []interface{}, changed bool) {
- dd := d.d
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []interface{}{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- d.depthIncr()
- hasLen := containerLenS > 0
- var xlen int
- if hasLen && canChange {
- if containerLenS > cap(v) {
- xlen = decInferLen(containerLenS, d.h.MaxInitLen, 16)
- if xlen <= cap(v) {
- v = v[:uint(xlen)]
- } else {
- v = make([]interface{}, uint(xlen))
- }
- changed = true
- } else if containerLenS != len(v) {
- v = v[:containerLenS]
- changed = true
- }
- }
- var j int
- for j = 0; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ {
- if j == 0 && len(v) == 0 && canChange {
- if hasLen {
- xlen = decInferLen(containerLenS, d.h.MaxInitLen, 16)
- } else {
- xlen = 8
- }
- v = make([]interface{}, uint(xlen))
- changed = true
- }
- // if indefinite, etc, then expand the slice if necessary
- var decodeIntoBlank bool
- if j >= len(v) {
- if canChange {
- v = append(v, nil)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- decodeIntoBlank = true
- }
- }
- slh.ElemContainerState(j)
- if decodeIntoBlank {
- d.swallow()
- } else if dd.TryDecodeAsNil() {
- v[uint(j)] = nil
- } else {
- d.decode(&v[uint(j)])
- }
- }
- if canChange {
- if j < len(v) {
- v = v[:uint(j)]
- changed = true
- } else if j == 0 && v == nil {
- v = make([]interface{}, 0)
- changed = true
- }
- }
- slh.End()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecSliceStringR(f *codecFnInfo, rv reflect.Value) {
- if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*[]string)
- v, changed := fastpathTV.DecSliceStringV(*vp, !array, d)
- if changed {
- *vp = v
- }
- } else {
- v := rv2i(rv).([]string)
- v2, changed := fastpathTV.DecSliceStringV(v, !array, d)
- if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
- copy(v, v2)
- }
- }
-}
-func (f fastpathT) DecSliceStringX(vp *[]string, d *Decoder) {
- v, changed := f.DecSliceStringV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceStringV(v []string, canChange bool, d *Decoder) (_ []string, changed bool) {
- dd := d.d
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []string{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- d.depthIncr()
- hasLen := containerLenS > 0
- var xlen int
- if hasLen && canChange {
- if containerLenS > cap(v) {
- xlen = decInferLen(containerLenS, d.h.MaxInitLen, 16)
- if xlen <= cap(v) {
- v = v[:uint(xlen)]
- } else {
- v = make([]string, uint(xlen))
- }
- changed = true
- } else if containerLenS != len(v) {
- v = v[:containerLenS]
- changed = true
- }
- }
- var j int
- for j = 0; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ {
- if j == 0 && len(v) == 0 && canChange {
- if hasLen {
- xlen = decInferLen(containerLenS, d.h.MaxInitLen, 16)
- } else {
- xlen = 8
- }
- v = make([]string, uint(xlen))
- changed = true
- }
- // if indefinite, etc, then expand the slice if necessary
- var decodeIntoBlank bool
- if j >= len(v) {
- if canChange {
- v = append(v, "")
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- decodeIntoBlank = true
- }
- }
- slh.ElemContainerState(j)
- if decodeIntoBlank {
- d.swallow()
- } else if dd.TryDecodeAsNil() {
- v[uint(j)] = ""
- } else {
- v[uint(j)] = dd.DecodeString()
- }
- }
- if canChange {
- if j < len(v) {
- v = v[:uint(j)]
- changed = true
- } else if j == 0 && v == nil {
- v = make([]string, 0)
- changed = true
- }
- }
- slh.End()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecSliceFloat32R(f *codecFnInfo, rv reflect.Value) {
- if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*[]float32)
- v, changed := fastpathTV.DecSliceFloat32V(*vp, !array, d)
- if changed {
- *vp = v
- }
- } else {
- v := rv2i(rv).([]float32)
- v2, changed := fastpathTV.DecSliceFloat32V(v, !array, d)
- if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
- copy(v, v2)
- }
- }
-}
-func (f fastpathT) DecSliceFloat32X(vp *[]float32, d *Decoder) {
- v, changed := f.DecSliceFloat32V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceFloat32V(v []float32, canChange bool, d *Decoder) (_ []float32, changed bool) {
- dd := d.d
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []float32{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- d.depthIncr()
- hasLen := containerLenS > 0
- var xlen int
- if hasLen && canChange {
- if containerLenS > cap(v) {
- xlen = decInferLen(containerLenS, d.h.MaxInitLen, 4)
- if xlen <= cap(v) {
- v = v[:uint(xlen)]
- } else {
- v = make([]float32, uint(xlen))
- }
- changed = true
- } else if containerLenS != len(v) {
- v = v[:containerLenS]
- changed = true
- }
- }
- var j int
- for j = 0; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ {
- if j == 0 && len(v) == 0 && canChange {
- if hasLen {
- xlen = decInferLen(containerLenS, d.h.MaxInitLen, 4)
- } else {
- xlen = 8
- }
- v = make([]float32, uint(xlen))
- changed = true
- }
- // if indefinite, etc, then expand the slice if necessary
- var decodeIntoBlank bool
- if j >= len(v) {
- if canChange {
- v = append(v, 0)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- decodeIntoBlank = true
- }
- }
- slh.ElemContainerState(j)
- if decodeIntoBlank {
- d.swallow()
- } else if dd.TryDecodeAsNil() {
- v[uint(j)] = 0
- } else {
- v[uint(j)] = float32(chkOvf.Float32V(dd.DecodeFloat64()))
- }
- }
- if canChange {
- if j < len(v) {
- v = v[:uint(j)]
- changed = true
- } else if j == 0 && v == nil {
- v = make([]float32, 0)
- changed = true
- }
- }
- slh.End()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecSliceFloat64R(f *codecFnInfo, rv reflect.Value) {
- if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*[]float64)
- v, changed := fastpathTV.DecSliceFloat64V(*vp, !array, d)
- if changed {
- *vp = v
- }
- } else {
- v := rv2i(rv).([]float64)
- v2, changed := fastpathTV.DecSliceFloat64V(v, !array, d)
- if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
- copy(v, v2)
- }
- }
-}
-func (f fastpathT) DecSliceFloat64X(vp *[]float64, d *Decoder) {
- v, changed := f.DecSliceFloat64V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceFloat64V(v []float64, canChange bool, d *Decoder) (_ []float64, changed bool) {
- dd := d.d
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []float64{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- d.depthIncr()
- hasLen := containerLenS > 0
- var xlen int
- if hasLen && canChange {
- if containerLenS > cap(v) {
- xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8)
- if xlen <= cap(v) {
- v = v[:uint(xlen)]
- } else {
- v = make([]float64, uint(xlen))
- }
- changed = true
- } else if containerLenS != len(v) {
- v = v[:containerLenS]
- changed = true
- }
- }
- var j int
- for j = 0; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ {
- if j == 0 && len(v) == 0 && canChange {
- if hasLen {
- xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8)
- } else {
- xlen = 8
- }
- v = make([]float64, uint(xlen))
- changed = true
- }
- // if indefinite, etc, then expand the slice if necessary
- var decodeIntoBlank bool
- if j >= len(v) {
- if canChange {
- v = append(v, 0)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- decodeIntoBlank = true
- }
- }
- slh.ElemContainerState(j)
- if decodeIntoBlank {
- d.swallow()
- } else if dd.TryDecodeAsNil() {
- v[uint(j)] = 0
- } else {
- v[uint(j)] = dd.DecodeFloat64()
- }
- }
- if canChange {
- if j < len(v) {
- v = v[:uint(j)]
- changed = true
- } else if j == 0 && v == nil {
- v = make([]float64, 0)
- changed = true
- }
- }
- slh.End()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecSliceUintR(f *codecFnInfo, rv reflect.Value) {
- if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*[]uint)
- v, changed := fastpathTV.DecSliceUintV(*vp, !array, d)
- if changed {
- *vp = v
- }
- } else {
- v := rv2i(rv).([]uint)
- v2, changed := fastpathTV.DecSliceUintV(v, !array, d)
- if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
- copy(v, v2)
- }
- }
-}
-func (f fastpathT) DecSliceUintX(vp *[]uint, d *Decoder) {
- v, changed := f.DecSliceUintV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceUintV(v []uint, canChange bool, d *Decoder) (_ []uint, changed bool) {
- dd := d.d
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []uint{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- d.depthIncr()
- hasLen := containerLenS > 0
- var xlen int
- if hasLen && canChange {
- if containerLenS > cap(v) {
- xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8)
- if xlen <= cap(v) {
- v = v[:uint(xlen)]
- } else {
- v = make([]uint, uint(xlen))
- }
- changed = true
- } else if containerLenS != len(v) {
- v = v[:containerLenS]
- changed = true
- }
- }
- var j int
- for j = 0; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ {
- if j == 0 && len(v) == 0 && canChange {
- if hasLen {
- xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8)
- } else {
- xlen = 8
- }
- v = make([]uint, uint(xlen))
- changed = true
- }
- // if indefinite, etc, then expand the slice if necessary
- var decodeIntoBlank bool
- if j >= len(v) {
- if canChange {
- v = append(v, 0)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- decodeIntoBlank = true
- }
- }
- slh.ElemContainerState(j)
- if decodeIntoBlank {
- d.swallow()
- } else if dd.TryDecodeAsNil() {
- v[uint(j)] = 0
- } else {
- v[uint(j)] = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- }
- }
- if canChange {
- if j < len(v) {
- v = v[:uint(j)]
- changed = true
- } else if j == 0 && v == nil {
- v = make([]uint, 0)
- changed = true
- }
- }
- slh.End()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecSliceUint8R(f *codecFnInfo, rv reflect.Value) {
- if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*[]uint8)
- v, changed := fastpathTV.DecSliceUint8V(*vp, !array, d)
- if changed {
- *vp = v
- }
- } else {
- v := rv2i(rv).([]uint8)
- v2, changed := fastpathTV.DecSliceUint8V(v, !array, d)
- if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
- copy(v, v2)
- }
- }
-}
-func (f fastpathT) DecSliceUint8X(vp *[]uint8, d *Decoder) {
- v, changed := f.DecSliceUint8V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceUint8V(v []uint8, canChange bool, d *Decoder) (_ []uint8, changed bool) {
- dd := d.d
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []uint8{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- d.depthIncr()
- hasLen := containerLenS > 0
- var xlen int
- if hasLen && canChange {
- if containerLenS > cap(v) {
- xlen = decInferLen(containerLenS, d.h.MaxInitLen, 1)
- if xlen <= cap(v) {
- v = v[:uint(xlen)]
- } else {
- v = make([]uint8, uint(xlen))
- }
- changed = true
- } else if containerLenS != len(v) {
- v = v[:containerLenS]
- changed = true
- }
- }
- var j int
- for j = 0; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ {
- if j == 0 && len(v) == 0 && canChange {
- if hasLen {
- xlen = decInferLen(containerLenS, d.h.MaxInitLen, 1)
- } else {
- xlen = 8
- }
- v = make([]uint8, uint(xlen))
- changed = true
- }
- // if indefinite, etc, then expand the slice if necessary
- var decodeIntoBlank bool
- if j >= len(v) {
- if canChange {
- v = append(v, 0)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- decodeIntoBlank = true
- }
- }
- slh.ElemContainerState(j)
- if decodeIntoBlank {
- d.swallow()
- } else if dd.TryDecodeAsNil() {
- v[uint(j)] = 0
- } else {
- v[uint(j)] = uint8(chkOvf.UintV(dd.DecodeUint64(), 8))
- }
- }
- if canChange {
- if j < len(v) {
- v = v[:uint(j)]
- changed = true
- } else if j == 0 && v == nil {
- v = make([]uint8, 0)
- changed = true
- }
- }
- slh.End()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecSliceUint16R(f *codecFnInfo, rv reflect.Value) {
- if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*[]uint16)
- v, changed := fastpathTV.DecSliceUint16V(*vp, !array, d)
- if changed {
- *vp = v
- }
- } else {
- v := rv2i(rv).([]uint16)
- v2, changed := fastpathTV.DecSliceUint16V(v, !array, d)
- if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
- copy(v, v2)
- }
- }
-}
-func (f fastpathT) DecSliceUint16X(vp *[]uint16, d *Decoder) {
- v, changed := f.DecSliceUint16V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceUint16V(v []uint16, canChange bool, d *Decoder) (_ []uint16, changed bool) {
- dd := d.d
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []uint16{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- d.depthIncr()
- hasLen := containerLenS > 0
- var xlen int
- if hasLen && canChange {
- if containerLenS > cap(v) {
- xlen = decInferLen(containerLenS, d.h.MaxInitLen, 2)
- if xlen <= cap(v) {
- v = v[:uint(xlen)]
- } else {
- v = make([]uint16, uint(xlen))
- }
- changed = true
- } else if containerLenS != len(v) {
- v = v[:containerLenS]
- changed = true
- }
- }
- var j int
- for j = 0; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ {
- if j == 0 && len(v) == 0 && canChange {
- if hasLen {
- xlen = decInferLen(containerLenS, d.h.MaxInitLen, 2)
- } else {
- xlen = 8
- }
- v = make([]uint16, uint(xlen))
- changed = true
- }
- // if indefinite, etc, then expand the slice if necessary
- var decodeIntoBlank bool
- if j >= len(v) {
- if canChange {
- v = append(v, 0)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- decodeIntoBlank = true
- }
- }
- slh.ElemContainerState(j)
- if decodeIntoBlank {
- d.swallow()
- } else if dd.TryDecodeAsNil() {
- v[uint(j)] = 0
- } else {
- v[uint(j)] = uint16(chkOvf.UintV(dd.DecodeUint64(), 16))
- }
- }
- if canChange {
- if j < len(v) {
- v = v[:uint(j)]
- changed = true
- } else if j == 0 && v == nil {
- v = make([]uint16, 0)
- changed = true
- }
- }
- slh.End()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecSliceUint32R(f *codecFnInfo, rv reflect.Value) {
- if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*[]uint32)
- v, changed := fastpathTV.DecSliceUint32V(*vp, !array, d)
- if changed {
- *vp = v
- }
- } else {
- v := rv2i(rv).([]uint32)
- v2, changed := fastpathTV.DecSliceUint32V(v, !array, d)
- if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
- copy(v, v2)
- }
- }
-}
-func (f fastpathT) DecSliceUint32X(vp *[]uint32, d *Decoder) {
- v, changed := f.DecSliceUint32V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceUint32V(v []uint32, canChange bool, d *Decoder) (_ []uint32, changed bool) {
- dd := d.d
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []uint32{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- d.depthIncr()
- hasLen := containerLenS > 0
- var xlen int
- if hasLen && canChange {
- if containerLenS > cap(v) {
- xlen = decInferLen(containerLenS, d.h.MaxInitLen, 4)
- if xlen <= cap(v) {
- v = v[:uint(xlen)]
- } else {
- v = make([]uint32, uint(xlen))
- }
- changed = true
- } else if containerLenS != len(v) {
- v = v[:containerLenS]
- changed = true
- }
- }
- var j int
- for j = 0; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ {
- if j == 0 && len(v) == 0 && canChange {
- if hasLen {
- xlen = decInferLen(containerLenS, d.h.MaxInitLen, 4)
- } else {
- xlen = 8
- }
- v = make([]uint32, uint(xlen))
- changed = true
- }
- // if indefinite, etc, then expand the slice if necessary
- var decodeIntoBlank bool
- if j >= len(v) {
- if canChange {
- v = append(v, 0)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- decodeIntoBlank = true
- }
- }
- slh.ElemContainerState(j)
- if decodeIntoBlank {
- d.swallow()
- } else if dd.TryDecodeAsNil() {
- v[uint(j)] = 0
- } else {
- v[uint(j)] = uint32(chkOvf.UintV(dd.DecodeUint64(), 32))
- }
- }
- if canChange {
- if j < len(v) {
- v = v[:uint(j)]
- changed = true
- } else if j == 0 && v == nil {
- v = make([]uint32, 0)
- changed = true
- }
- }
- slh.End()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecSliceUint64R(f *codecFnInfo, rv reflect.Value) {
- if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*[]uint64)
- v, changed := fastpathTV.DecSliceUint64V(*vp, !array, d)
- if changed {
- *vp = v
- }
- } else {
- v := rv2i(rv).([]uint64)
- v2, changed := fastpathTV.DecSliceUint64V(v, !array, d)
- if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
- copy(v, v2)
- }
- }
-}
-func (f fastpathT) DecSliceUint64X(vp *[]uint64, d *Decoder) {
- v, changed := f.DecSliceUint64V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceUint64V(v []uint64, canChange bool, d *Decoder) (_ []uint64, changed bool) {
- dd := d.d
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []uint64{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- d.depthIncr()
- hasLen := containerLenS > 0
- var xlen int
- if hasLen && canChange {
- if containerLenS > cap(v) {
- xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8)
- if xlen <= cap(v) {
- v = v[:uint(xlen)]
- } else {
- v = make([]uint64, uint(xlen))
- }
- changed = true
- } else if containerLenS != len(v) {
- v = v[:containerLenS]
- changed = true
- }
- }
- var j int
- for j = 0; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ {
- if j == 0 && len(v) == 0 && canChange {
- if hasLen {
- xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8)
- } else {
- xlen = 8
- }
- v = make([]uint64, uint(xlen))
- changed = true
- }
- // if indefinite, etc, then expand the slice if necessary
- var decodeIntoBlank bool
- if j >= len(v) {
- if canChange {
- v = append(v, 0)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- decodeIntoBlank = true
- }
- }
- slh.ElemContainerState(j)
- if decodeIntoBlank {
- d.swallow()
- } else if dd.TryDecodeAsNil() {
- v[uint(j)] = 0
- } else {
- v[uint(j)] = dd.DecodeUint64()
- }
- }
- if canChange {
- if j < len(v) {
- v = v[:uint(j)]
- changed = true
- } else if j == 0 && v == nil {
- v = make([]uint64, 0)
- changed = true
- }
- }
- slh.End()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecSliceUintptrR(f *codecFnInfo, rv reflect.Value) {
- if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*[]uintptr)
- v, changed := fastpathTV.DecSliceUintptrV(*vp, !array, d)
- if changed {
- *vp = v
- }
- } else {
- v := rv2i(rv).([]uintptr)
- v2, changed := fastpathTV.DecSliceUintptrV(v, !array, d)
- if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
- copy(v, v2)
- }
- }
-}
-func (f fastpathT) DecSliceUintptrX(vp *[]uintptr, d *Decoder) {
- v, changed := f.DecSliceUintptrV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceUintptrV(v []uintptr, canChange bool, d *Decoder) (_ []uintptr, changed bool) {
- dd := d.d
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []uintptr{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- d.depthIncr()
- hasLen := containerLenS > 0
- var xlen int
- if hasLen && canChange {
- if containerLenS > cap(v) {
- xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8)
- if xlen <= cap(v) {
- v = v[:uint(xlen)]
- } else {
- v = make([]uintptr, uint(xlen))
- }
- changed = true
- } else if containerLenS != len(v) {
- v = v[:containerLenS]
- changed = true
- }
- }
- var j int
- for j = 0; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ {
- if j == 0 && len(v) == 0 && canChange {
- if hasLen {
- xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8)
- } else {
- xlen = 8
- }
- v = make([]uintptr, uint(xlen))
- changed = true
- }
- // if indefinite, etc, then expand the slice if necessary
- var decodeIntoBlank bool
- if j >= len(v) {
- if canChange {
- v = append(v, 0)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- decodeIntoBlank = true
- }
- }
- slh.ElemContainerState(j)
- if decodeIntoBlank {
- d.swallow()
- } else if dd.TryDecodeAsNil() {
- v[uint(j)] = 0
- } else {
- v[uint(j)] = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- }
- }
- if canChange {
- if j < len(v) {
- v = v[:uint(j)]
- changed = true
- } else if j == 0 && v == nil {
- v = make([]uintptr, 0)
- changed = true
- }
- }
- slh.End()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecSliceIntR(f *codecFnInfo, rv reflect.Value) {
- if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*[]int)
- v, changed := fastpathTV.DecSliceIntV(*vp, !array, d)
- if changed {
- *vp = v
- }
- } else {
- v := rv2i(rv).([]int)
- v2, changed := fastpathTV.DecSliceIntV(v, !array, d)
- if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
- copy(v, v2)
- }
- }
-}
-func (f fastpathT) DecSliceIntX(vp *[]int, d *Decoder) {
- v, changed := f.DecSliceIntV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceIntV(v []int, canChange bool, d *Decoder) (_ []int, changed bool) {
- dd := d.d
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []int{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- d.depthIncr()
- hasLen := containerLenS > 0
- var xlen int
- if hasLen && canChange {
- if containerLenS > cap(v) {
- xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8)
- if xlen <= cap(v) {
- v = v[:uint(xlen)]
- } else {
- v = make([]int, uint(xlen))
- }
- changed = true
- } else if containerLenS != len(v) {
- v = v[:containerLenS]
- changed = true
- }
- }
- var j int
- for j = 0; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ {
- if j == 0 && len(v) == 0 && canChange {
- if hasLen {
- xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8)
- } else {
- xlen = 8
- }
- v = make([]int, uint(xlen))
- changed = true
- }
- // if indefinite, etc, then expand the slice if necessary
- var decodeIntoBlank bool
- if j >= len(v) {
- if canChange {
- v = append(v, 0)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- decodeIntoBlank = true
- }
- }
- slh.ElemContainerState(j)
- if decodeIntoBlank {
- d.swallow()
- } else if dd.TryDecodeAsNil() {
- v[uint(j)] = 0
- } else {
- v[uint(j)] = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize))
- }
- }
- if canChange {
- if j < len(v) {
- v = v[:uint(j)]
- changed = true
- } else if j == 0 && v == nil {
- v = make([]int, 0)
- changed = true
- }
- }
- slh.End()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecSliceInt8R(f *codecFnInfo, rv reflect.Value) {
- if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*[]int8)
- v, changed := fastpathTV.DecSliceInt8V(*vp, !array, d)
- if changed {
- *vp = v
- }
- } else {
- v := rv2i(rv).([]int8)
- v2, changed := fastpathTV.DecSliceInt8V(v, !array, d)
- if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
- copy(v, v2)
- }
- }
-}
-func (f fastpathT) DecSliceInt8X(vp *[]int8, d *Decoder) {
- v, changed := f.DecSliceInt8V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceInt8V(v []int8, canChange bool, d *Decoder) (_ []int8, changed bool) {
- dd := d.d
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []int8{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- d.depthIncr()
- hasLen := containerLenS > 0
- var xlen int
- if hasLen && canChange {
- if containerLenS > cap(v) {
- xlen = decInferLen(containerLenS, d.h.MaxInitLen, 1)
- if xlen <= cap(v) {
- v = v[:uint(xlen)]
- } else {
- v = make([]int8, uint(xlen))
- }
- changed = true
- } else if containerLenS != len(v) {
- v = v[:containerLenS]
- changed = true
- }
- }
- var j int
- for j = 0; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ {
- if j == 0 && len(v) == 0 && canChange {
- if hasLen {
- xlen = decInferLen(containerLenS, d.h.MaxInitLen, 1)
- } else {
- xlen = 8
- }
- v = make([]int8, uint(xlen))
- changed = true
- }
- // if indefinite, etc, then expand the slice if necessary
- var decodeIntoBlank bool
- if j >= len(v) {
- if canChange {
- v = append(v, 0)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- decodeIntoBlank = true
- }
- }
- slh.ElemContainerState(j)
- if decodeIntoBlank {
- d.swallow()
- } else if dd.TryDecodeAsNil() {
- v[uint(j)] = 0
- } else {
- v[uint(j)] = int8(chkOvf.IntV(dd.DecodeInt64(), 8))
- }
- }
- if canChange {
- if j < len(v) {
- v = v[:uint(j)]
- changed = true
- } else if j == 0 && v == nil {
- v = make([]int8, 0)
- changed = true
- }
- }
- slh.End()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecSliceInt16R(f *codecFnInfo, rv reflect.Value) {
- if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*[]int16)
- v, changed := fastpathTV.DecSliceInt16V(*vp, !array, d)
- if changed {
- *vp = v
- }
- } else {
- v := rv2i(rv).([]int16)
- v2, changed := fastpathTV.DecSliceInt16V(v, !array, d)
- if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
- copy(v, v2)
- }
- }
-}
-func (f fastpathT) DecSliceInt16X(vp *[]int16, d *Decoder) {
- v, changed := f.DecSliceInt16V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceInt16V(v []int16, canChange bool, d *Decoder) (_ []int16, changed bool) {
- dd := d.d
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []int16{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- d.depthIncr()
- hasLen := containerLenS > 0
- var xlen int
- if hasLen && canChange {
- if containerLenS > cap(v) {
- xlen = decInferLen(containerLenS, d.h.MaxInitLen, 2)
- if xlen <= cap(v) {
- v = v[:uint(xlen)]
- } else {
- v = make([]int16, uint(xlen))
- }
- changed = true
- } else if containerLenS != len(v) {
- v = v[:containerLenS]
- changed = true
- }
- }
- var j int
- for j = 0; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ {
- if j == 0 && len(v) == 0 && canChange {
- if hasLen {
- xlen = decInferLen(containerLenS, d.h.MaxInitLen, 2)
- } else {
- xlen = 8
- }
- v = make([]int16, uint(xlen))
- changed = true
- }
- // if indefinite, etc, then expand the slice if necessary
- var decodeIntoBlank bool
- if j >= len(v) {
- if canChange {
- v = append(v, 0)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- decodeIntoBlank = true
- }
- }
- slh.ElemContainerState(j)
- if decodeIntoBlank {
- d.swallow()
- } else if dd.TryDecodeAsNil() {
- v[uint(j)] = 0
- } else {
- v[uint(j)] = int16(chkOvf.IntV(dd.DecodeInt64(), 16))
- }
- }
- if canChange {
- if j < len(v) {
- v = v[:uint(j)]
- changed = true
- } else if j == 0 && v == nil {
- v = make([]int16, 0)
- changed = true
- }
- }
- slh.End()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecSliceInt32R(f *codecFnInfo, rv reflect.Value) {
- if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*[]int32)
- v, changed := fastpathTV.DecSliceInt32V(*vp, !array, d)
- if changed {
- *vp = v
- }
- } else {
- v := rv2i(rv).([]int32)
- v2, changed := fastpathTV.DecSliceInt32V(v, !array, d)
- if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
- copy(v, v2)
- }
- }
-}
-func (f fastpathT) DecSliceInt32X(vp *[]int32, d *Decoder) {
- v, changed := f.DecSliceInt32V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceInt32V(v []int32, canChange bool, d *Decoder) (_ []int32, changed bool) {
- dd := d.d
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []int32{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- d.depthIncr()
- hasLen := containerLenS > 0
- var xlen int
- if hasLen && canChange {
- if containerLenS > cap(v) {
- xlen = decInferLen(containerLenS, d.h.MaxInitLen, 4)
- if xlen <= cap(v) {
- v = v[:uint(xlen)]
- } else {
- v = make([]int32, uint(xlen))
- }
- changed = true
- } else if containerLenS != len(v) {
- v = v[:containerLenS]
- changed = true
- }
- }
- var j int
- for j = 0; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ {
- if j == 0 && len(v) == 0 && canChange {
- if hasLen {
- xlen = decInferLen(containerLenS, d.h.MaxInitLen, 4)
- } else {
- xlen = 8
- }
- v = make([]int32, uint(xlen))
- changed = true
- }
- // if indefinite, etc, then expand the slice if necessary
- var decodeIntoBlank bool
- if j >= len(v) {
- if canChange {
- v = append(v, 0)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- decodeIntoBlank = true
- }
- }
- slh.ElemContainerState(j)
- if decodeIntoBlank {
- d.swallow()
- } else if dd.TryDecodeAsNil() {
- v[uint(j)] = 0
- } else {
- v[uint(j)] = int32(chkOvf.IntV(dd.DecodeInt64(), 32))
- }
- }
- if canChange {
- if j < len(v) {
- v = v[:uint(j)]
- changed = true
- } else if j == 0 && v == nil {
- v = make([]int32, 0)
- changed = true
- }
- }
- slh.End()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecSliceInt64R(f *codecFnInfo, rv reflect.Value) {
- if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*[]int64)
- v, changed := fastpathTV.DecSliceInt64V(*vp, !array, d)
- if changed {
- *vp = v
- }
- } else {
- v := rv2i(rv).([]int64)
- v2, changed := fastpathTV.DecSliceInt64V(v, !array, d)
- if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
- copy(v, v2)
- }
- }
-}
-func (f fastpathT) DecSliceInt64X(vp *[]int64, d *Decoder) {
- v, changed := f.DecSliceInt64V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceInt64V(v []int64, canChange bool, d *Decoder) (_ []int64, changed bool) {
- dd := d.d
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []int64{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- d.depthIncr()
- hasLen := containerLenS > 0
- var xlen int
- if hasLen && canChange {
- if containerLenS > cap(v) {
- xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8)
- if xlen <= cap(v) {
- v = v[:uint(xlen)]
- } else {
- v = make([]int64, uint(xlen))
- }
- changed = true
- } else if containerLenS != len(v) {
- v = v[:containerLenS]
- changed = true
- }
- }
- var j int
- for j = 0; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ {
- if j == 0 && len(v) == 0 && canChange {
- if hasLen {
- xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8)
- } else {
- xlen = 8
- }
- v = make([]int64, uint(xlen))
- changed = true
- }
- // if indefinite, etc, then expand the slice if necessary
- var decodeIntoBlank bool
- if j >= len(v) {
- if canChange {
- v = append(v, 0)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- decodeIntoBlank = true
- }
- }
- slh.ElemContainerState(j)
- if decodeIntoBlank {
- d.swallow()
- } else if dd.TryDecodeAsNil() {
- v[uint(j)] = 0
- } else {
- v[uint(j)] = dd.DecodeInt64()
- }
- }
- if canChange {
- if j < len(v) {
- v = v[:uint(j)]
- changed = true
- } else if j == 0 && v == nil {
- v = make([]int64, 0)
- changed = true
- }
- }
- slh.End()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecSliceBoolR(f *codecFnInfo, rv reflect.Value) {
- if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*[]bool)
- v, changed := fastpathTV.DecSliceBoolV(*vp, !array, d)
- if changed {
- *vp = v
- }
- } else {
- v := rv2i(rv).([]bool)
- v2, changed := fastpathTV.DecSliceBoolV(v, !array, d)
- if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
- copy(v, v2)
- }
- }
-}
-func (f fastpathT) DecSliceBoolX(vp *[]bool, d *Decoder) {
- v, changed := f.DecSliceBoolV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecSliceBoolV(v []bool, canChange bool, d *Decoder) (_ []bool, changed bool) {
- dd := d.d
- slh, containerLenS := d.decSliceHelperStart()
- if containerLenS == 0 {
- if canChange {
- if v == nil {
- v = []bool{}
- } else if len(v) != 0 {
- v = v[:0]
- }
- changed = true
- }
- slh.End()
- return v, changed
- }
- d.depthIncr()
- hasLen := containerLenS > 0
- var xlen int
- if hasLen && canChange {
- if containerLenS > cap(v) {
- xlen = decInferLen(containerLenS, d.h.MaxInitLen, 1)
- if xlen <= cap(v) {
- v = v[:uint(xlen)]
- } else {
- v = make([]bool, uint(xlen))
- }
- changed = true
- } else if containerLenS != len(v) {
- v = v[:containerLenS]
- changed = true
- }
- }
- var j int
- for j = 0; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ {
- if j == 0 && len(v) == 0 && canChange {
- if hasLen {
- xlen = decInferLen(containerLenS, d.h.MaxInitLen, 1)
- } else {
- xlen = 8
- }
- v = make([]bool, uint(xlen))
- changed = true
- }
- // if indefinite, etc, then expand the slice if necessary
- var decodeIntoBlank bool
- if j >= len(v) {
- if canChange {
- v = append(v, false)
- changed = true
- } else {
- d.arrayCannotExpand(len(v), j+1)
- decodeIntoBlank = true
- }
- }
- slh.ElemContainerState(j)
- if decodeIntoBlank {
- d.swallow()
- } else if dd.TryDecodeAsNil() {
- v[uint(j)] = false
- } else {
- v[uint(j)] = dd.DecodeBool()
- }
- }
- if canChange {
- if j < len(v) {
- v = v[:uint(j)]
- changed = true
- } else if j == 0 && v == nil {
- v = make([]bool, 0)
- changed = true
- }
- }
- slh.End()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapIntfIntfR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[interface{}]interface{})
- v, changed := fastpathTV.DecMapIntfIntfV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapIntfIntfV(rv2i(rv).(map[interface{}]interface{}), false, d)
- }
-}
-func (f fastpathT) DecMapIntfIntfX(vp *map[interface{}]interface{}, d *Decoder) {
- v, changed := f.DecMapIntfIntfV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfIntfV(v map[interface{}]interface{}, canChange bool,
- d *Decoder) (_ map[interface{}]interface{}, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 32)
- v = make(map[interface{}]interface{}, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset
- var mk interface{}
- var mv interface{}
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = nil
- }
- continue
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapIntfStringR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[interface{}]string)
- v, changed := fastpathTV.DecMapIntfStringV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapIntfStringV(rv2i(rv).(map[interface{}]string), false, d)
- }
-}
-func (f fastpathT) DecMapIntfStringX(vp *map[interface{}]string, d *Decoder) {
- v, changed := f.DecMapIntfStringV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfStringV(v map[interface{}]string, canChange bool,
- d *Decoder) (_ map[interface{}]string, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 32)
- v = make(map[interface{}]string, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk interface{}
- var mv string
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = ""
- }
- continue
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapIntfUintR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[interface{}]uint)
- v, changed := fastpathTV.DecMapIntfUintV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapIntfUintV(rv2i(rv).(map[interface{}]uint), false, d)
- }
-}
-func (f fastpathT) DecMapIntfUintX(vp *map[interface{}]uint, d *Decoder) {
- v, changed := f.DecMapIntfUintV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfUintV(v map[interface{}]uint, canChange bool,
- d *Decoder) (_ map[interface{}]uint, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[interface{}]uint, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk interface{}
- var mv uint
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapIntfUint8R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[interface{}]uint8)
- v, changed := fastpathTV.DecMapIntfUint8V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapIntfUint8V(rv2i(rv).(map[interface{}]uint8), false, d)
- }
-}
-func (f fastpathT) DecMapIntfUint8X(vp *map[interface{}]uint8, d *Decoder) {
- v, changed := f.DecMapIntfUint8V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfUint8V(v map[interface{}]uint8, canChange bool,
- d *Decoder) (_ map[interface{}]uint8, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 17)
- v = make(map[interface{}]uint8, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk interface{}
- var mv uint8
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapIntfUint16R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[interface{}]uint16)
- v, changed := fastpathTV.DecMapIntfUint16V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapIntfUint16V(rv2i(rv).(map[interface{}]uint16), false, d)
- }
-}
-func (f fastpathT) DecMapIntfUint16X(vp *map[interface{}]uint16, d *Decoder) {
- v, changed := f.DecMapIntfUint16V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfUint16V(v map[interface{}]uint16, canChange bool,
- d *Decoder) (_ map[interface{}]uint16, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 18)
- v = make(map[interface{}]uint16, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk interface{}
- var mv uint16
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapIntfUint32R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[interface{}]uint32)
- v, changed := fastpathTV.DecMapIntfUint32V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapIntfUint32V(rv2i(rv).(map[interface{}]uint32), false, d)
- }
-}
-func (f fastpathT) DecMapIntfUint32X(vp *map[interface{}]uint32, d *Decoder) {
- v, changed := f.DecMapIntfUint32V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfUint32V(v map[interface{}]uint32, canChange bool,
- d *Decoder) (_ map[interface{}]uint32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 20)
- v = make(map[interface{}]uint32, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk interface{}
- var mv uint32
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapIntfUint64R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[interface{}]uint64)
- v, changed := fastpathTV.DecMapIntfUint64V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapIntfUint64V(rv2i(rv).(map[interface{}]uint64), false, d)
- }
-}
-func (f fastpathT) DecMapIntfUint64X(vp *map[interface{}]uint64, d *Decoder) {
- v, changed := f.DecMapIntfUint64V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfUint64V(v map[interface{}]uint64, canChange bool,
- d *Decoder) (_ map[interface{}]uint64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[interface{}]uint64, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk interface{}
- var mv uint64
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = dd.DecodeUint64()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapIntfUintptrR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[interface{}]uintptr)
- v, changed := fastpathTV.DecMapIntfUintptrV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapIntfUintptrV(rv2i(rv).(map[interface{}]uintptr), false, d)
- }
-}
-func (f fastpathT) DecMapIntfUintptrX(vp *map[interface{}]uintptr, d *Decoder) {
- v, changed := f.DecMapIntfUintptrV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfUintptrV(v map[interface{}]uintptr, canChange bool,
- d *Decoder) (_ map[interface{}]uintptr, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[interface{}]uintptr, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk interface{}
- var mv uintptr
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapIntfIntR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[interface{}]int)
- v, changed := fastpathTV.DecMapIntfIntV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapIntfIntV(rv2i(rv).(map[interface{}]int), false, d)
- }
-}
-func (f fastpathT) DecMapIntfIntX(vp *map[interface{}]int, d *Decoder) {
- v, changed := f.DecMapIntfIntV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfIntV(v map[interface{}]int, canChange bool,
- d *Decoder) (_ map[interface{}]int, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[interface{}]int, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk interface{}
- var mv int
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapIntfInt8R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[interface{}]int8)
- v, changed := fastpathTV.DecMapIntfInt8V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapIntfInt8V(rv2i(rv).(map[interface{}]int8), false, d)
- }
-}
-func (f fastpathT) DecMapIntfInt8X(vp *map[interface{}]int8, d *Decoder) {
- v, changed := f.DecMapIntfInt8V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfInt8V(v map[interface{}]int8, canChange bool,
- d *Decoder) (_ map[interface{}]int8, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 17)
- v = make(map[interface{}]int8, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk interface{}
- var mv int8
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapIntfInt16R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[interface{}]int16)
- v, changed := fastpathTV.DecMapIntfInt16V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapIntfInt16V(rv2i(rv).(map[interface{}]int16), false, d)
- }
-}
-func (f fastpathT) DecMapIntfInt16X(vp *map[interface{}]int16, d *Decoder) {
- v, changed := f.DecMapIntfInt16V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfInt16V(v map[interface{}]int16, canChange bool,
- d *Decoder) (_ map[interface{}]int16, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 18)
- v = make(map[interface{}]int16, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk interface{}
- var mv int16
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapIntfInt32R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[interface{}]int32)
- v, changed := fastpathTV.DecMapIntfInt32V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapIntfInt32V(rv2i(rv).(map[interface{}]int32), false, d)
- }
-}
-func (f fastpathT) DecMapIntfInt32X(vp *map[interface{}]int32, d *Decoder) {
- v, changed := f.DecMapIntfInt32V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfInt32V(v map[interface{}]int32, canChange bool,
- d *Decoder) (_ map[interface{}]int32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 20)
- v = make(map[interface{}]int32, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk interface{}
- var mv int32
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapIntfInt64R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[interface{}]int64)
- v, changed := fastpathTV.DecMapIntfInt64V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapIntfInt64V(rv2i(rv).(map[interface{}]int64), false, d)
- }
-}
-func (f fastpathT) DecMapIntfInt64X(vp *map[interface{}]int64, d *Decoder) {
- v, changed := f.DecMapIntfInt64V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfInt64V(v map[interface{}]int64, canChange bool,
- d *Decoder) (_ map[interface{}]int64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[interface{}]int64, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk interface{}
- var mv int64
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = dd.DecodeInt64()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapIntfFloat32R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[interface{}]float32)
- v, changed := fastpathTV.DecMapIntfFloat32V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapIntfFloat32V(rv2i(rv).(map[interface{}]float32), false, d)
- }
-}
-func (f fastpathT) DecMapIntfFloat32X(vp *map[interface{}]float32, d *Decoder) {
- v, changed := f.DecMapIntfFloat32V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfFloat32V(v map[interface{}]float32, canChange bool,
- d *Decoder) (_ map[interface{}]float32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 20)
- v = make(map[interface{}]float32, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk interface{}
- var mv float32
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = float32(chkOvf.Float32V(dd.DecodeFloat64()))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapIntfFloat64R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[interface{}]float64)
- v, changed := fastpathTV.DecMapIntfFloat64V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapIntfFloat64V(rv2i(rv).(map[interface{}]float64), false, d)
- }
-}
-func (f fastpathT) DecMapIntfFloat64X(vp *map[interface{}]float64, d *Decoder) {
- v, changed := f.DecMapIntfFloat64V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfFloat64V(v map[interface{}]float64, canChange bool,
- d *Decoder) (_ map[interface{}]float64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[interface{}]float64, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk interface{}
- var mv float64
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = dd.DecodeFloat64()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapIntfBoolR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[interface{}]bool)
- v, changed := fastpathTV.DecMapIntfBoolV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapIntfBoolV(rv2i(rv).(map[interface{}]bool), false, d)
- }
-}
-func (f fastpathT) DecMapIntfBoolX(vp *map[interface{}]bool, d *Decoder) {
- v, changed := f.DecMapIntfBoolV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntfBoolV(v map[interface{}]bool, canChange bool,
- d *Decoder) (_ map[interface{}]bool, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 17)
- v = make(map[interface{}]bool, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk interface{}
- var mv bool
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = nil
- d.decode(&mk)
- if bv, bok := mk.([]byte); bok {
- mk = d.string(bv)
- }
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = false
- }
- continue
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapStringIntfR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[string]interface{})
- v, changed := fastpathTV.DecMapStringIntfV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapStringIntfV(rv2i(rv).(map[string]interface{}), false, d)
- }
-}
-func (f fastpathT) DecMapStringIntfX(vp *map[string]interface{}, d *Decoder) {
- v, changed := f.DecMapStringIntfV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringIntfV(v map[string]interface{}, canChange bool,
- d *Decoder) (_ map[string]interface{}, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 32)
- v = make(map[string]interface{}, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset
- var mk string
- var mv interface{}
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeString()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = nil
- }
- continue
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapStringStringR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[string]string)
- v, changed := fastpathTV.DecMapStringStringV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapStringStringV(rv2i(rv).(map[string]string), false, d)
- }
-}
-func (f fastpathT) DecMapStringStringX(vp *map[string]string, d *Decoder) {
- v, changed := f.DecMapStringStringV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringStringV(v map[string]string, canChange bool,
- d *Decoder) (_ map[string]string, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 32)
- v = make(map[string]string, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk string
- var mv string
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeString()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = ""
- }
- continue
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapStringUintR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[string]uint)
- v, changed := fastpathTV.DecMapStringUintV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapStringUintV(rv2i(rv).(map[string]uint), false, d)
- }
-}
-func (f fastpathT) DecMapStringUintX(vp *map[string]uint, d *Decoder) {
- v, changed := f.DecMapStringUintV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringUintV(v map[string]uint, canChange bool,
- d *Decoder) (_ map[string]uint, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[string]uint, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk string
- var mv uint
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeString()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapStringUint8R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[string]uint8)
- v, changed := fastpathTV.DecMapStringUint8V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapStringUint8V(rv2i(rv).(map[string]uint8), false, d)
- }
-}
-func (f fastpathT) DecMapStringUint8X(vp *map[string]uint8, d *Decoder) {
- v, changed := f.DecMapStringUint8V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringUint8V(v map[string]uint8, canChange bool,
- d *Decoder) (_ map[string]uint8, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 17)
- v = make(map[string]uint8, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk string
- var mv uint8
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeString()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapStringUint16R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[string]uint16)
- v, changed := fastpathTV.DecMapStringUint16V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapStringUint16V(rv2i(rv).(map[string]uint16), false, d)
- }
-}
-func (f fastpathT) DecMapStringUint16X(vp *map[string]uint16, d *Decoder) {
- v, changed := f.DecMapStringUint16V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringUint16V(v map[string]uint16, canChange bool,
- d *Decoder) (_ map[string]uint16, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 18)
- v = make(map[string]uint16, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk string
- var mv uint16
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeString()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapStringUint32R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[string]uint32)
- v, changed := fastpathTV.DecMapStringUint32V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapStringUint32V(rv2i(rv).(map[string]uint32), false, d)
- }
-}
-func (f fastpathT) DecMapStringUint32X(vp *map[string]uint32, d *Decoder) {
- v, changed := f.DecMapStringUint32V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringUint32V(v map[string]uint32, canChange bool,
- d *Decoder) (_ map[string]uint32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 20)
- v = make(map[string]uint32, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk string
- var mv uint32
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeString()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapStringUint64R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[string]uint64)
- v, changed := fastpathTV.DecMapStringUint64V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapStringUint64V(rv2i(rv).(map[string]uint64), false, d)
- }
-}
-func (f fastpathT) DecMapStringUint64X(vp *map[string]uint64, d *Decoder) {
- v, changed := f.DecMapStringUint64V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringUint64V(v map[string]uint64, canChange bool,
- d *Decoder) (_ map[string]uint64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[string]uint64, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk string
- var mv uint64
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeString()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = dd.DecodeUint64()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapStringUintptrR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[string]uintptr)
- v, changed := fastpathTV.DecMapStringUintptrV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapStringUintptrV(rv2i(rv).(map[string]uintptr), false, d)
- }
-}
-func (f fastpathT) DecMapStringUintptrX(vp *map[string]uintptr, d *Decoder) {
- v, changed := f.DecMapStringUintptrV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringUintptrV(v map[string]uintptr, canChange bool,
- d *Decoder) (_ map[string]uintptr, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[string]uintptr, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk string
- var mv uintptr
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeString()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapStringIntR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[string]int)
- v, changed := fastpathTV.DecMapStringIntV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapStringIntV(rv2i(rv).(map[string]int), false, d)
- }
-}
-func (f fastpathT) DecMapStringIntX(vp *map[string]int, d *Decoder) {
- v, changed := f.DecMapStringIntV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringIntV(v map[string]int, canChange bool,
- d *Decoder) (_ map[string]int, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[string]int, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk string
- var mv int
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeString()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapStringInt8R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[string]int8)
- v, changed := fastpathTV.DecMapStringInt8V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapStringInt8V(rv2i(rv).(map[string]int8), false, d)
- }
-}
-func (f fastpathT) DecMapStringInt8X(vp *map[string]int8, d *Decoder) {
- v, changed := f.DecMapStringInt8V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringInt8V(v map[string]int8, canChange bool,
- d *Decoder) (_ map[string]int8, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 17)
- v = make(map[string]int8, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk string
- var mv int8
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeString()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapStringInt16R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[string]int16)
- v, changed := fastpathTV.DecMapStringInt16V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapStringInt16V(rv2i(rv).(map[string]int16), false, d)
- }
-}
-func (f fastpathT) DecMapStringInt16X(vp *map[string]int16, d *Decoder) {
- v, changed := f.DecMapStringInt16V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringInt16V(v map[string]int16, canChange bool,
- d *Decoder) (_ map[string]int16, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 18)
- v = make(map[string]int16, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk string
- var mv int16
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeString()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapStringInt32R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[string]int32)
- v, changed := fastpathTV.DecMapStringInt32V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapStringInt32V(rv2i(rv).(map[string]int32), false, d)
- }
-}
-func (f fastpathT) DecMapStringInt32X(vp *map[string]int32, d *Decoder) {
- v, changed := f.DecMapStringInt32V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringInt32V(v map[string]int32, canChange bool,
- d *Decoder) (_ map[string]int32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 20)
- v = make(map[string]int32, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk string
- var mv int32
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeString()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapStringInt64R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[string]int64)
- v, changed := fastpathTV.DecMapStringInt64V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapStringInt64V(rv2i(rv).(map[string]int64), false, d)
- }
-}
-func (f fastpathT) DecMapStringInt64X(vp *map[string]int64, d *Decoder) {
- v, changed := f.DecMapStringInt64V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringInt64V(v map[string]int64, canChange bool,
- d *Decoder) (_ map[string]int64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[string]int64, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk string
- var mv int64
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeString()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = dd.DecodeInt64()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapStringFloat32R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[string]float32)
- v, changed := fastpathTV.DecMapStringFloat32V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapStringFloat32V(rv2i(rv).(map[string]float32), false, d)
- }
-}
-func (f fastpathT) DecMapStringFloat32X(vp *map[string]float32, d *Decoder) {
- v, changed := f.DecMapStringFloat32V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringFloat32V(v map[string]float32, canChange bool,
- d *Decoder) (_ map[string]float32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 20)
- v = make(map[string]float32, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk string
- var mv float32
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeString()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = float32(chkOvf.Float32V(dd.DecodeFloat64()))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapStringFloat64R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[string]float64)
- v, changed := fastpathTV.DecMapStringFloat64V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapStringFloat64V(rv2i(rv).(map[string]float64), false, d)
- }
-}
-func (f fastpathT) DecMapStringFloat64X(vp *map[string]float64, d *Decoder) {
- v, changed := f.DecMapStringFloat64V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringFloat64V(v map[string]float64, canChange bool,
- d *Decoder) (_ map[string]float64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[string]float64, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk string
- var mv float64
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeString()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = dd.DecodeFloat64()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapStringBoolR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[string]bool)
- v, changed := fastpathTV.DecMapStringBoolV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapStringBoolV(rv2i(rv).(map[string]bool), false, d)
- }
-}
-func (f fastpathT) DecMapStringBoolX(vp *map[string]bool, d *Decoder) {
- v, changed := f.DecMapStringBoolV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapStringBoolV(v map[string]bool, canChange bool,
- d *Decoder) (_ map[string]bool, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 17)
- v = make(map[string]bool, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk string
- var mv bool
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeString()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = false
- }
- continue
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapFloat32IntfR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[float32]interface{})
- v, changed := fastpathTV.DecMapFloat32IntfV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapFloat32IntfV(rv2i(rv).(map[float32]interface{}), false, d)
- }
-}
-func (f fastpathT) DecMapFloat32IntfX(vp *map[float32]interface{}, d *Decoder) {
- v, changed := f.DecMapFloat32IntfV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32IntfV(v map[float32]interface{}, canChange bool,
- d *Decoder) (_ map[float32]interface{}, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 20)
- v = make(map[float32]interface{}, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset
- var mk float32
- var mv interface{}
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = float32(chkOvf.Float32V(dd.DecodeFloat64()))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = nil
- }
- continue
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapFloat32StringR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[float32]string)
- v, changed := fastpathTV.DecMapFloat32StringV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapFloat32StringV(rv2i(rv).(map[float32]string), false, d)
- }
-}
-func (f fastpathT) DecMapFloat32StringX(vp *map[float32]string, d *Decoder) {
- v, changed := f.DecMapFloat32StringV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32StringV(v map[float32]string, canChange bool,
- d *Decoder) (_ map[float32]string, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 20)
- v = make(map[float32]string, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk float32
- var mv string
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = float32(chkOvf.Float32V(dd.DecodeFloat64()))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = ""
- }
- continue
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapFloat32UintR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[float32]uint)
- v, changed := fastpathTV.DecMapFloat32UintV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapFloat32UintV(rv2i(rv).(map[float32]uint), false, d)
- }
-}
-func (f fastpathT) DecMapFloat32UintX(vp *map[float32]uint, d *Decoder) {
- v, changed := f.DecMapFloat32UintV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32UintV(v map[float32]uint, canChange bool,
- d *Decoder) (_ map[float32]uint, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[float32]uint, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk float32
- var mv uint
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = float32(chkOvf.Float32V(dd.DecodeFloat64()))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapFloat32Uint8R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[float32]uint8)
- v, changed := fastpathTV.DecMapFloat32Uint8V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapFloat32Uint8V(rv2i(rv).(map[float32]uint8), false, d)
- }
-}
-func (f fastpathT) DecMapFloat32Uint8X(vp *map[float32]uint8, d *Decoder) {
- v, changed := f.DecMapFloat32Uint8V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32Uint8V(v map[float32]uint8, canChange bool,
- d *Decoder) (_ map[float32]uint8, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[float32]uint8, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk float32
- var mv uint8
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = float32(chkOvf.Float32V(dd.DecodeFloat64()))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapFloat32Uint16R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[float32]uint16)
- v, changed := fastpathTV.DecMapFloat32Uint16V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapFloat32Uint16V(rv2i(rv).(map[float32]uint16), false, d)
- }
-}
-func (f fastpathT) DecMapFloat32Uint16X(vp *map[float32]uint16, d *Decoder) {
- v, changed := f.DecMapFloat32Uint16V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32Uint16V(v map[float32]uint16, canChange bool,
- d *Decoder) (_ map[float32]uint16, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 6)
- v = make(map[float32]uint16, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk float32
- var mv uint16
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = float32(chkOvf.Float32V(dd.DecodeFloat64()))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapFloat32Uint32R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[float32]uint32)
- v, changed := fastpathTV.DecMapFloat32Uint32V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapFloat32Uint32V(rv2i(rv).(map[float32]uint32), false, d)
- }
-}
-func (f fastpathT) DecMapFloat32Uint32X(vp *map[float32]uint32, d *Decoder) {
- v, changed := f.DecMapFloat32Uint32V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32Uint32V(v map[float32]uint32, canChange bool,
- d *Decoder) (_ map[float32]uint32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 8)
- v = make(map[float32]uint32, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk float32
- var mv uint32
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = float32(chkOvf.Float32V(dd.DecodeFloat64()))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapFloat32Uint64R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[float32]uint64)
- v, changed := fastpathTV.DecMapFloat32Uint64V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapFloat32Uint64V(rv2i(rv).(map[float32]uint64), false, d)
- }
-}
-func (f fastpathT) DecMapFloat32Uint64X(vp *map[float32]uint64, d *Decoder) {
- v, changed := f.DecMapFloat32Uint64V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32Uint64V(v map[float32]uint64, canChange bool,
- d *Decoder) (_ map[float32]uint64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[float32]uint64, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk float32
- var mv uint64
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = float32(chkOvf.Float32V(dd.DecodeFloat64()))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = dd.DecodeUint64()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapFloat32UintptrR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[float32]uintptr)
- v, changed := fastpathTV.DecMapFloat32UintptrV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapFloat32UintptrV(rv2i(rv).(map[float32]uintptr), false, d)
- }
-}
-func (f fastpathT) DecMapFloat32UintptrX(vp *map[float32]uintptr, d *Decoder) {
- v, changed := f.DecMapFloat32UintptrV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32UintptrV(v map[float32]uintptr, canChange bool,
- d *Decoder) (_ map[float32]uintptr, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[float32]uintptr, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk float32
- var mv uintptr
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = float32(chkOvf.Float32V(dd.DecodeFloat64()))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapFloat32IntR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[float32]int)
- v, changed := fastpathTV.DecMapFloat32IntV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapFloat32IntV(rv2i(rv).(map[float32]int), false, d)
- }
-}
-func (f fastpathT) DecMapFloat32IntX(vp *map[float32]int, d *Decoder) {
- v, changed := f.DecMapFloat32IntV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32IntV(v map[float32]int, canChange bool,
- d *Decoder) (_ map[float32]int, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[float32]int, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk float32
- var mv int
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = float32(chkOvf.Float32V(dd.DecodeFloat64()))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapFloat32Int8R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[float32]int8)
- v, changed := fastpathTV.DecMapFloat32Int8V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapFloat32Int8V(rv2i(rv).(map[float32]int8), false, d)
- }
-}
-func (f fastpathT) DecMapFloat32Int8X(vp *map[float32]int8, d *Decoder) {
- v, changed := f.DecMapFloat32Int8V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32Int8V(v map[float32]int8, canChange bool,
- d *Decoder) (_ map[float32]int8, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[float32]int8, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk float32
- var mv int8
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = float32(chkOvf.Float32V(dd.DecodeFloat64()))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapFloat32Int16R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[float32]int16)
- v, changed := fastpathTV.DecMapFloat32Int16V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapFloat32Int16V(rv2i(rv).(map[float32]int16), false, d)
- }
-}
-func (f fastpathT) DecMapFloat32Int16X(vp *map[float32]int16, d *Decoder) {
- v, changed := f.DecMapFloat32Int16V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32Int16V(v map[float32]int16, canChange bool,
- d *Decoder) (_ map[float32]int16, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 6)
- v = make(map[float32]int16, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk float32
- var mv int16
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = float32(chkOvf.Float32V(dd.DecodeFloat64()))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapFloat32Int32R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[float32]int32)
- v, changed := fastpathTV.DecMapFloat32Int32V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapFloat32Int32V(rv2i(rv).(map[float32]int32), false, d)
- }
-}
-func (f fastpathT) DecMapFloat32Int32X(vp *map[float32]int32, d *Decoder) {
- v, changed := f.DecMapFloat32Int32V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32Int32V(v map[float32]int32, canChange bool,
- d *Decoder) (_ map[float32]int32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 8)
- v = make(map[float32]int32, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk float32
- var mv int32
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = float32(chkOvf.Float32V(dd.DecodeFloat64()))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapFloat32Int64R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[float32]int64)
- v, changed := fastpathTV.DecMapFloat32Int64V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapFloat32Int64V(rv2i(rv).(map[float32]int64), false, d)
- }
-}
-func (f fastpathT) DecMapFloat32Int64X(vp *map[float32]int64, d *Decoder) {
- v, changed := f.DecMapFloat32Int64V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32Int64V(v map[float32]int64, canChange bool,
- d *Decoder) (_ map[float32]int64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[float32]int64, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk float32
- var mv int64
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = float32(chkOvf.Float32V(dd.DecodeFloat64()))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = dd.DecodeInt64()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapFloat32Float32R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[float32]float32)
- v, changed := fastpathTV.DecMapFloat32Float32V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapFloat32Float32V(rv2i(rv).(map[float32]float32), false, d)
- }
-}
-func (f fastpathT) DecMapFloat32Float32X(vp *map[float32]float32, d *Decoder) {
- v, changed := f.DecMapFloat32Float32V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32Float32V(v map[float32]float32, canChange bool,
- d *Decoder) (_ map[float32]float32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 8)
- v = make(map[float32]float32, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk float32
- var mv float32
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = float32(chkOvf.Float32V(dd.DecodeFloat64()))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = float32(chkOvf.Float32V(dd.DecodeFloat64()))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapFloat32Float64R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[float32]float64)
- v, changed := fastpathTV.DecMapFloat32Float64V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapFloat32Float64V(rv2i(rv).(map[float32]float64), false, d)
- }
-}
-func (f fastpathT) DecMapFloat32Float64X(vp *map[float32]float64, d *Decoder) {
- v, changed := f.DecMapFloat32Float64V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32Float64V(v map[float32]float64, canChange bool,
- d *Decoder) (_ map[float32]float64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[float32]float64, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk float32
- var mv float64
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = float32(chkOvf.Float32V(dd.DecodeFloat64()))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = dd.DecodeFloat64()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapFloat32BoolR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[float32]bool)
- v, changed := fastpathTV.DecMapFloat32BoolV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapFloat32BoolV(rv2i(rv).(map[float32]bool), false, d)
- }
-}
-func (f fastpathT) DecMapFloat32BoolX(vp *map[float32]bool, d *Decoder) {
- v, changed := f.DecMapFloat32BoolV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat32BoolV(v map[float32]bool, canChange bool,
- d *Decoder) (_ map[float32]bool, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[float32]bool, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk float32
- var mv bool
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = float32(chkOvf.Float32V(dd.DecodeFloat64()))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = false
- }
- continue
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapFloat64IntfR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[float64]interface{})
- v, changed := fastpathTV.DecMapFloat64IntfV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapFloat64IntfV(rv2i(rv).(map[float64]interface{}), false, d)
- }
-}
-func (f fastpathT) DecMapFloat64IntfX(vp *map[float64]interface{}, d *Decoder) {
- v, changed := f.DecMapFloat64IntfV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64IntfV(v map[float64]interface{}, canChange bool,
- d *Decoder) (_ map[float64]interface{}, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[float64]interface{}, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset
- var mk float64
- var mv interface{}
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeFloat64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = nil
- }
- continue
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapFloat64StringR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[float64]string)
- v, changed := fastpathTV.DecMapFloat64StringV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapFloat64StringV(rv2i(rv).(map[float64]string), false, d)
- }
-}
-func (f fastpathT) DecMapFloat64StringX(vp *map[float64]string, d *Decoder) {
- v, changed := f.DecMapFloat64StringV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64StringV(v map[float64]string, canChange bool,
- d *Decoder) (_ map[float64]string, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[float64]string, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk float64
- var mv string
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeFloat64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = ""
- }
- continue
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapFloat64UintR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[float64]uint)
- v, changed := fastpathTV.DecMapFloat64UintV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapFloat64UintV(rv2i(rv).(map[float64]uint), false, d)
- }
-}
-func (f fastpathT) DecMapFloat64UintX(vp *map[float64]uint, d *Decoder) {
- v, changed := f.DecMapFloat64UintV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64UintV(v map[float64]uint, canChange bool,
- d *Decoder) (_ map[float64]uint, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[float64]uint, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk float64
- var mv uint
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeFloat64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapFloat64Uint8R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[float64]uint8)
- v, changed := fastpathTV.DecMapFloat64Uint8V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapFloat64Uint8V(rv2i(rv).(map[float64]uint8), false, d)
- }
-}
-func (f fastpathT) DecMapFloat64Uint8X(vp *map[float64]uint8, d *Decoder) {
- v, changed := f.DecMapFloat64Uint8V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64Uint8V(v map[float64]uint8, canChange bool,
- d *Decoder) (_ map[float64]uint8, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[float64]uint8, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk float64
- var mv uint8
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeFloat64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapFloat64Uint16R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[float64]uint16)
- v, changed := fastpathTV.DecMapFloat64Uint16V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapFloat64Uint16V(rv2i(rv).(map[float64]uint16), false, d)
- }
-}
-func (f fastpathT) DecMapFloat64Uint16X(vp *map[float64]uint16, d *Decoder) {
- v, changed := f.DecMapFloat64Uint16V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64Uint16V(v map[float64]uint16, canChange bool,
- d *Decoder) (_ map[float64]uint16, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[float64]uint16, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk float64
- var mv uint16
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeFloat64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapFloat64Uint32R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[float64]uint32)
- v, changed := fastpathTV.DecMapFloat64Uint32V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapFloat64Uint32V(rv2i(rv).(map[float64]uint32), false, d)
- }
-}
-func (f fastpathT) DecMapFloat64Uint32X(vp *map[float64]uint32, d *Decoder) {
- v, changed := f.DecMapFloat64Uint32V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64Uint32V(v map[float64]uint32, canChange bool,
- d *Decoder) (_ map[float64]uint32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[float64]uint32, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk float64
- var mv uint32
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeFloat64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapFloat64Uint64R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[float64]uint64)
- v, changed := fastpathTV.DecMapFloat64Uint64V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapFloat64Uint64V(rv2i(rv).(map[float64]uint64), false, d)
- }
-}
-func (f fastpathT) DecMapFloat64Uint64X(vp *map[float64]uint64, d *Decoder) {
- v, changed := f.DecMapFloat64Uint64V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64Uint64V(v map[float64]uint64, canChange bool,
- d *Decoder) (_ map[float64]uint64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[float64]uint64, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk float64
- var mv uint64
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeFloat64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = dd.DecodeUint64()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapFloat64UintptrR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[float64]uintptr)
- v, changed := fastpathTV.DecMapFloat64UintptrV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapFloat64UintptrV(rv2i(rv).(map[float64]uintptr), false, d)
- }
-}
-func (f fastpathT) DecMapFloat64UintptrX(vp *map[float64]uintptr, d *Decoder) {
- v, changed := f.DecMapFloat64UintptrV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64UintptrV(v map[float64]uintptr, canChange bool,
- d *Decoder) (_ map[float64]uintptr, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[float64]uintptr, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk float64
- var mv uintptr
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeFloat64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapFloat64IntR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[float64]int)
- v, changed := fastpathTV.DecMapFloat64IntV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapFloat64IntV(rv2i(rv).(map[float64]int), false, d)
- }
-}
-func (f fastpathT) DecMapFloat64IntX(vp *map[float64]int, d *Decoder) {
- v, changed := f.DecMapFloat64IntV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64IntV(v map[float64]int, canChange bool,
- d *Decoder) (_ map[float64]int, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[float64]int, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk float64
- var mv int
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeFloat64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapFloat64Int8R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[float64]int8)
- v, changed := fastpathTV.DecMapFloat64Int8V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapFloat64Int8V(rv2i(rv).(map[float64]int8), false, d)
- }
-}
-func (f fastpathT) DecMapFloat64Int8X(vp *map[float64]int8, d *Decoder) {
- v, changed := f.DecMapFloat64Int8V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64Int8V(v map[float64]int8, canChange bool,
- d *Decoder) (_ map[float64]int8, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[float64]int8, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk float64
- var mv int8
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeFloat64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapFloat64Int16R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[float64]int16)
- v, changed := fastpathTV.DecMapFloat64Int16V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapFloat64Int16V(rv2i(rv).(map[float64]int16), false, d)
- }
-}
-func (f fastpathT) DecMapFloat64Int16X(vp *map[float64]int16, d *Decoder) {
- v, changed := f.DecMapFloat64Int16V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64Int16V(v map[float64]int16, canChange bool,
- d *Decoder) (_ map[float64]int16, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[float64]int16, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk float64
- var mv int16
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeFloat64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapFloat64Int32R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[float64]int32)
- v, changed := fastpathTV.DecMapFloat64Int32V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapFloat64Int32V(rv2i(rv).(map[float64]int32), false, d)
- }
-}
-func (f fastpathT) DecMapFloat64Int32X(vp *map[float64]int32, d *Decoder) {
- v, changed := f.DecMapFloat64Int32V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64Int32V(v map[float64]int32, canChange bool,
- d *Decoder) (_ map[float64]int32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[float64]int32, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk float64
- var mv int32
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeFloat64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapFloat64Int64R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[float64]int64)
- v, changed := fastpathTV.DecMapFloat64Int64V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapFloat64Int64V(rv2i(rv).(map[float64]int64), false, d)
- }
-}
-func (f fastpathT) DecMapFloat64Int64X(vp *map[float64]int64, d *Decoder) {
- v, changed := f.DecMapFloat64Int64V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64Int64V(v map[float64]int64, canChange bool,
- d *Decoder) (_ map[float64]int64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[float64]int64, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk float64
- var mv int64
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeFloat64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = dd.DecodeInt64()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapFloat64Float32R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[float64]float32)
- v, changed := fastpathTV.DecMapFloat64Float32V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapFloat64Float32V(rv2i(rv).(map[float64]float32), false, d)
- }
-}
-func (f fastpathT) DecMapFloat64Float32X(vp *map[float64]float32, d *Decoder) {
- v, changed := f.DecMapFloat64Float32V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64Float32V(v map[float64]float32, canChange bool,
- d *Decoder) (_ map[float64]float32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[float64]float32, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk float64
- var mv float32
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeFloat64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = float32(chkOvf.Float32V(dd.DecodeFloat64()))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapFloat64Float64R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[float64]float64)
- v, changed := fastpathTV.DecMapFloat64Float64V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapFloat64Float64V(rv2i(rv).(map[float64]float64), false, d)
- }
-}
-func (f fastpathT) DecMapFloat64Float64X(vp *map[float64]float64, d *Decoder) {
- v, changed := f.DecMapFloat64Float64V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64Float64V(v map[float64]float64, canChange bool,
- d *Decoder) (_ map[float64]float64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[float64]float64, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk float64
- var mv float64
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeFloat64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = dd.DecodeFloat64()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapFloat64BoolR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[float64]bool)
- v, changed := fastpathTV.DecMapFloat64BoolV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapFloat64BoolV(rv2i(rv).(map[float64]bool), false, d)
- }
-}
-func (f fastpathT) DecMapFloat64BoolX(vp *map[float64]bool, d *Decoder) {
- v, changed := f.DecMapFloat64BoolV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapFloat64BoolV(v map[float64]bool, canChange bool,
- d *Decoder) (_ map[float64]bool, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[float64]bool, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk float64
- var mv bool
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeFloat64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = false
- }
- continue
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUintIntfR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint]interface{})
- v, changed := fastpathTV.DecMapUintIntfV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUintIntfV(rv2i(rv).(map[uint]interface{}), false, d)
- }
-}
-func (f fastpathT) DecMapUintIntfX(vp *map[uint]interface{}, d *Decoder) {
- v, changed := f.DecMapUintIntfV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintIntfV(v map[uint]interface{}, canChange bool,
- d *Decoder) (_ map[uint]interface{}, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[uint]interface{}, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset
- var mk uint
- var mv interface{}
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = nil
- }
- continue
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUintStringR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint]string)
- v, changed := fastpathTV.DecMapUintStringV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUintStringV(rv2i(rv).(map[uint]string), false, d)
- }
-}
-func (f fastpathT) DecMapUintStringX(vp *map[uint]string, d *Decoder) {
- v, changed := f.DecMapUintStringV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintStringV(v map[uint]string, canChange bool,
- d *Decoder) (_ map[uint]string, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[uint]string, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint
- var mv string
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = ""
- }
- continue
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUintUintR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint]uint)
- v, changed := fastpathTV.DecMapUintUintV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUintUintV(rv2i(rv).(map[uint]uint), false, d)
- }
-}
-func (f fastpathT) DecMapUintUintX(vp *map[uint]uint, d *Decoder) {
- v, changed := f.DecMapUintUintV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintUintV(v map[uint]uint, canChange bool,
- d *Decoder) (_ map[uint]uint, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uint]uint, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint
- var mv uint
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUintUint8R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint]uint8)
- v, changed := fastpathTV.DecMapUintUint8V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUintUint8V(rv2i(rv).(map[uint]uint8), false, d)
- }
-}
-func (f fastpathT) DecMapUintUint8X(vp *map[uint]uint8, d *Decoder) {
- v, changed := f.DecMapUintUint8V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintUint8V(v map[uint]uint8, canChange bool,
- d *Decoder) (_ map[uint]uint8, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uint]uint8, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint
- var mv uint8
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUintUint16R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint]uint16)
- v, changed := fastpathTV.DecMapUintUint16V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUintUint16V(rv2i(rv).(map[uint]uint16), false, d)
- }
-}
-func (f fastpathT) DecMapUintUint16X(vp *map[uint]uint16, d *Decoder) {
- v, changed := f.DecMapUintUint16V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintUint16V(v map[uint]uint16, canChange bool,
- d *Decoder) (_ map[uint]uint16, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[uint]uint16, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint
- var mv uint16
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUintUint32R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint]uint32)
- v, changed := fastpathTV.DecMapUintUint32V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUintUint32V(rv2i(rv).(map[uint]uint32), false, d)
- }
-}
-func (f fastpathT) DecMapUintUint32X(vp *map[uint]uint32, d *Decoder) {
- v, changed := f.DecMapUintUint32V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintUint32V(v map[uint]uint32, canChange bool,
- d *Decoder) (_ map[uint]uint32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uint]uint32, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint
- var mv uint32
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUintUint64R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint]uint64)
- v, changed := fastpathTV.DecMapUintUint64V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUintUint64V(rv2i(rv).(map[uint]uint64), false, d)
- }
-}
-func (f fastpathT) DecMapUintUint64X(vp *map[uint]uint64, d *Decoder) {
- v, changed := f.DecMapUintUint64V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintUint64V(v map[uint]uint64, canChange bool,
- d *Decoder) (_ map[uint]uint64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uint]uint64, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint
- var mv uint64
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = dd.DecodeUint64()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUintUintptrR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint]uintptr)
- v, changed := fastpathTV.DecMapUintUintptrV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUintUintptrV(rv2i(rv).(map[uint]uintptr), false, d)
- }
-}
-func (f fastpathT) DecMapUintUintptrX(vp *map[uint]uintptr, d *Decoder) {
- v, changed := f.DecMapUintUintptrV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintUintptrV(v map[uint]uintptr, canChange bool,
- d *Decoder) (_ map[uint]uintptr, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uint]uintptr, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint
- var mv uintptr
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUintIntR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint]int)
- v, changed := fastpathTV.DecMapUintIntV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUintIntV(rv2i(rv).(map[uint]int), false, d)
- }
-}
-func (f fastpathT) DecMapUintIntX(vp *map[uint]int, d *Decoder) {
- v, changed := f.DecMapUintIntV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintIntV(v map[uint]int, canChange bool,
- d *Decoder) (_ map[uint]int, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uint]int, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint
- var mv int
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUintInt8R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint]int8)
- v, changed := fastpathTV.DecMapUintInt8V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUintInt8V(rv2i(rv).(map[uint]int8), false, d)
- }
-}
-func (f fastpathT) DecMapUintInt8X(vp *map[uint]int8, d *Decoder) {
- v, changed := f.DecMapUintInt8V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintInt8V(v map[uint]int8, canChange bool,
- d *Decoder) (_ map[uint]int8, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uint]int8, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint
- var mv int8
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUintInt16R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint]int16)
- v, changed := fastpathTV.DecMapUintInt16V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUintInt16V(rv2i(rv).(map[uint]int16), false, d)
- }
-}
-func (f fastpathT) DecMapUintInt16X(vp *map[uint]int16, d *Decoder) {
- v, changed := f.DecMapUintInt16V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintInt16V(v map[uint]int16, canChange bool,
- d *Decoder) (_ map[uint]int16, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[uint]int16, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint
- var mv int16
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUintInt32R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint]int32)
- v, changed := fastpathTV.DecMapUintInt32V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUintInt32V(rv2i(rv).(map[uint]int32), false, d)
- }
-}
-func (f fastpathT) DecMapUintInt32X(vp *map[uint]int32, d *Decoder) {
- v, changed := f.DecMapUintInt32V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintInt32V(v map[uint]int32, canChange bool,
- d *Decoder) (_ map[uint]int32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uint]int32, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint
- var mv int32
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUintInt64R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint]int64)
- v, changed := fastpathTV.DecMapUintInt64V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUintInt64V(rv2i(rv).(map[uint]int64), false, d)
- }
-}
-func (f fastpathT) DecMapUintInt64X(vp *map[uint]int64, d *Decoder) {
- v, changed := f.DecMapUintInt64V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintInt64V(v map[uint]int64, canChange bool,
- d *Decoder) (_ map[uint]int64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uint]int64, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint
- var mv int64
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = dd.DecodeInt64()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUintFloat32R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint]float32)
- v, changed := fastpathTV.DecMapUintFloat32V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUintFloat32V(rv2i(rv).(map[uint]float32), false, d)
- }
-}
-func (f fastpathT) DecMapUintFloat32X(vp *map[uint]float32, d *Decoder) {
- v, changed := f.DecMapUintFloat32V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintFloat32V(v map[uint]float32, canChange bool,
- d *Decoder) (_ map[uint]float32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uint]float32, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint
- var mv float32
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = float32(chkOvf.Float32V(dd.DecodeFloat64()))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUintFloat64R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint]float64)
- v, changed := fastpathTV.DecMapUintFloat64V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUintFloat64V(rv2i(rv).(map[uint]float64), false, d)
- }
-}
-func (f fastpathT) DecMapUintFloat64X(vp *map[uint]float64, d *Decoder) {
- v, changed := f.DecMapUintFloat64V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintFloat64V(v map[uint]float64, canChange bool,
- d *Decoder) (_ map[uint]float64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uint]float64, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint
- var mv float64
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = dd.DecodeFloat64()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUintBoolR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint]bool)
- v, changed := fastpathTV.DecMapUintBoolV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUintBoolV(rv2i(rv).(map[uint]bool), false, d)
- }
-}
-func (f fastpathT) DecMapUintBoolX(vp *map[uint]bool, d *Decoder) {
- v, changed := f.DecMapUintBoolV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintBoolV(v map[uint]bool, canChange bool,
- d *Decoder) (_ map[uint]bool, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uint]bool, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint
- var mv bool
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = false
- }
- continue
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint8IntfR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint8]interface{})
- v, changed := fastpathTV.DecMapUint8IntfV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint8IntfV(rv2i(rv).(map[uint8]interface{}), false, d)
- }
-}
-func (f fastpathT) DecMapUint8IntfX(vp *map[uint8]interface{}, d *Decoder) {
- v, changed := f.DecMapUint8IntfV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8IntfV(v map[uint8]interface{}, canChange bool,
- d *Decoder) (_ map[uint8]interface{}, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 17)
- v = make(map[uint8]interface{}, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset
- var mk uint8
- var mv interface{}
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = nil
- }
- continue
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint8StringR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint8]string)
- v, changed := fastpathTV.DecMapUint8StringV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint8StringV(rv2i(rv).(map[uint8]string), false, d)
- }
-}
-func (f fastpathT) DecMapUint8StringX(vp *map[uint8]string, d *Decoder) {
- v, changed := f.DecMapUint8StringV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8StringV(v map[uint8]string, canChange bool,
- d *Decoder) (_ map[uint8]string, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 17)
- v = make(map[uint8]string, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint8
- var mv string
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = ""
- }
- continue
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint8UintR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint8]uint)
- v, changed := fastpathTV.DecMapUint8UintV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint8UintV(rv2i(rv).(map[uint8]uint), false, d)
- }
-}
-func (f fastpathT) DecMapUint8UintX(vp *map[uint8]uint, d *Decoder) {
- v, changed := f.DecMapUint8UintV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8UintV(v map[uint8]uint, canChange bool,
- d *Decoder) (_ map[uint8]uint, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uint8]uint, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint8
- var mv uint
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint8Uint8R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint8]uint8)
- v, changed := fastpathTV.DecMapUint8Uint8V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint8Uint8V(rv2i(rv).(map[uint8]uint8), false, d)
- }
-}
-func (f fastpathT) DecMapUint8Uint8X(vp *map[uint8]uint8, d *Decoder) {
- v, changed := f.DecMapUint8Uint8V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8Uint8V(v map[uint8]uint8, canChange bool,
- d *Decoder) (_ map[uint8]uint8, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 2)
- v = make(map[uint8]uint8, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint8
- var mv uint8
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint8Uint16R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint8]uint16)
- v, changed := fastpathTV.DecMapUint8Uint16V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint8Uint16V(rv2i(rv).(map[uint8]uint16), false, d)
- }
-}
-func (f fastpathT) DecMapUint8Uint16X(vp *map[uint8]uint16, d *Decoder) {
- v, changed := f.DecMapUint8Uint16V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8Uint16V(v map[uint8]uint16, canChange bool,
- d *Decoder) (_ map[uint8]uint16, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 3)
- v = make(map[uint8]uint16, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint8
- var mv uint16
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint8Uint32R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint8]uint32)
- v, changed := fastpathTV.DecMapUint8Uint32V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint8Uint32V(rv2i(rv).(map[uint8]uint32), false, d)
- }
-}
-func (f fastpathT) DecMapUint8Uint32X(vp *map[uint8]uint32, d *Decoder) {
- v, changed := f.DecMapUint8Uint32V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8Uint32V(v map[uint8]uint32, canChange bool,
- d *Decoder) (_ map[uint8]uint32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[uint8]uint32, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint8
- var mv uint32
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint8Uint64R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint8]uint64)
- v, changed := fastpathTV.DecMapUint8Uint64V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint8Uint64V(rv2i(rv).(map[uint8]uint64), false, d)
- }
-}
-func (f fastpathT) DecMapUint8Uint64X(vp *map[uint8]uint64, d *Decoder) {
- v, changed := f.DecMapUint8Uint64V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8Uint64V(v map[uint8]uint64, canChange bool,
- d *Decoder) (_ map[uint8]uint64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uint8]uint64, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint8
- var mv uint64
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = dd.DecodeUint64()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint8UintptrR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint8]uintptr)
- v, changed := fastpathTV.DecMapUint8UintptrV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint8UintptrV(rv2i(rv).(map[uint8]uintptr), false, d)
- }
-}
-func (f fastpathT) DecMapUint8UintptrX(vp *map[uint8]uintptr, d *Decoder) {
- v, changed := f.DecMapUint8UintptrV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8UintptrV(v map[uint8]uintptr, canChange bool,
- d *Decoder) (_ map[uint8]uintptr, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uint8]uintptr, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint8
- var mv uintptr
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint8IntR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint8]int)
- v, changed := fastpathTV.DecMapUint8IntV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint8IntV(rv2i(rv).(map[uint8]int), false, d)
- }
-}
-func (f fastpathT) DecMapUint8IntX(vp *map[uint8]int, d *Decoder) {
- v, changed := f.DecMapUint8IntV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8IntV(v map[uint8]int, canChange bool,
- d *Decoder) (_ map[uint8]int, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uint8]int, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint8
- var mv int
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint8Int8R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint8]int8)
- v, changed := fastpathTV.DecMapUint8Int8V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint8Int8V(rv2i(rv).(map[uint8]int8), false, d)
- }
-}
-func (f fastpathT) DecMapUint8Int8X(vp *map[uint8]int8, d *Decoder) {
- v, changed := f.DecMapUint8Int8V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8Int8V(v map[uint8]int8, canChange bool,
- d *Decoder) (_ map[uint8]int8, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 2)
- v = make(map[uint8]int8, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint8
- var mv int8
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint8Int16R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint8]int16)
- v, changed := fastpathTV.DecMapUint8Int16V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint8Int16V(rv2i(rv).(map[uint8]int16), false, d)
- }
-}
-func (f fastpathT) DecMapUint8Int16X(vp *map[uint8]int16, d *Decoder) {
- v, changed := f.DecMapUint8Int16V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8Int16V(v map[uint8]int16, canChange bool,
- d *Decoder) (_ map[uint8]int16, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 3)
- v = make(map[uint8]int16, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint8
- var mv int16
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint8Int32R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint8]int32)
- v, changed := fastpathTV.DecMapUint8Int32V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint8Int32V(rv2i(rv).(map[uint8]int32), false, d)
- }
-}
-func (f fastpathT) DecMapUint8Int32X(vp *map[uint8]int32, d *Decoder) {
- v, changed := f.DecMapUint8Int32V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8Int32V(v map[uint8]int32, canChange bool,
- d *Decoder) (_ map[uint8]int32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[uint8]int32, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint8
- var mv int32
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint8Int64R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint8]int64)
- v, changed := fastpathTV.DecMapUint8Int64V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint8Int64V(rv2i(rv).(map[uint8]int64), false, d)
- }
-}
-func (f fastpathT) DecMapUint8Int64X(vp *map[uint8]int64, d *Decoder) {
- v, changed := f.DecMapUint8Int64V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8Int64V(v map[uint8]int64, canChange bool,
- d *Decoder) (_ map[uint8]int64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uint8]int64, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint8
- var mv int64
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = dd.DecodeInt64()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint8Float32R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint8]float32)
- v, changed := fastpathTV.DecMapUint8Float32V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint8Float32V(rv2i(rv).(map[uint8]float32), false, d)
- }
-}
-func (f fastpathT) DecMapUint8Float32X(vp *map[uint8]float32, d *Decoder) {
- v, changed := f.DecMapUint8Float32V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8Float32V(v map[uint8]float32, canChange bool,
- d *Decoder) (_ map[uint8]float32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[uint8]float32, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint8
- var mv float32
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = float32(chkOvf.Float32V(dd.DecodeFloat64()))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint8Float64R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint8]float64)
- v, changed := fastpathTV.DecMapUint8Float64V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint8Float64V(rv2i(rv).(map[uint8]float64), false, d)
- }
-}
-func (f fastpathT) DecMapUint8Float64X(vp *map[uint8]float64, d *Decoder) {
- v, changed := f.DecMapUint8Float64V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8Float64V(v map[uint8]float64, canChange bool,
- d *Decoder) (_ map[uint8]float64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uint8]float64, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint8
- var mv float64
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = dd.DecodeFloat64()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint8BoolR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint8]bool)
- v, changed := fastpathTV.DecMapUint8BoolV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint8BoolV(rv2i(rv).(map[uint8]bool), false, d)
- }
-}
-func (f fastpathT) DecMapUint8BoolX(vp *map[uint8]bool, d *Decoder) {
- v, changed := f.DecMapUint8BoolV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint8BoolV(v map[uint8]bool, canChange bool,
- d *Decoder) (_ map[uint8]bool, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 2)
- v = make(map[uint8]bool, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint8
- var mv bool
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = false
- }
- continue
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint16IntfR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint16]interface{})
- v, changed := fastpathTV.DecMapUint16IntfV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint16IntfV(rv2i(rv).(map[uint16]interface{}), false, d)
- }
-}
-func (f fastpathT) DecMapUint16IntfX(vp *map[uint16]interface{}, d *Decoder) {
- v, changed := f.DecMapUint16IntfV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16IntfV(v map[uint16]interface{}, canChange bool,
- d *Decoder) (_ map[uint16]interface{}, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 18)
- v = make(map[uint16]interface{}, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset
- var mk uint16
- var mv interface{}
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = nil
- }
- continue
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint16StringR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint16]string)
- v, changed := fastpathTV.DecMapUint16StringV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint16StringV(rv2i(rv).(map[uint16]string), false, d)
- }
-}
-func (f fastpathT) DecMapUint16StringX(vp *map[uint16]string, d *Decoder) {
- v, changed := f.DecMapUint16StringV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16StringV(v map[uint16]string, canChange bool,
- d *Decoder) (_ map[uint16]string, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 18)
- v = make(map[uint16]string, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint16
- var mv string
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = ""
- }
- continue
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint16UintR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint16]uint)
- v, changed := fastpathTV.DecMapUint16UintV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint16UintV(rv2i(rv).(map[uint16]uint), false, d)
- }
-}
-func (f fastpathT) DecMapUint16UintX(vp *map[uint16]uint, d *Decoder) {
- v, changed := f.DecMapUint16UintV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16UintV(v map[uint16]uint, canChange bool,
- d *Decoder) (_ map[uint16]uint, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[uint16]uint, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint16
- var mv uint
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint16Uint8R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint16]uint8)
- v, changed := fastpathTV.DecMapUint16Uint8V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint16Uint8V(rv2i(rv).(map[uint16]uint8), false, d)
- }
-}
-func (f fastpathT) DecMapUint16Uint8X(vp *map[uint16]uint8, d *Decoder) {
- v, changed := f.DecMapUint16Uint8V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16Uint8V(v map[uint16]uint8, canChange bool,
- d *Decoder) (_ map[uint16]uint8, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 3)
- v = make(map[uint16]uint8, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint16
- var mv uint8
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint16Uint16R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint16]uint16)
- v, changed := fastpathTV.DecMapUint16Uint16V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint16Uint16V(rv2i(rv).(map[uint16]uint16), false, d)
- }
-}
-func (f fastpathT) DecMapUint16Uint16X(vp *map[uint16]uint16, d *Decoder) {
- v, changed := f.DecMapUint16Uint16V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16Uint16V(v map[uint16]uint16, canChange bool,
- d *Decoder) (_ map[uint16]uint16, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 4)
- v = make(map[uint16]uint16, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint16
- var mv uint16
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint16Uint32R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint16]uint32)
- v, changed := fastpathTV.DecMapUint16Uint32V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint16Uint32V(rv2i(rv).(map[uint16]uint32), false, d)
- }
-}
-func (f fastpathT) DecMapUint16Uint32X(vp *map[uint16]uint32, d *Decoder) {
- v, changed := f.DecMapUint16Uint32V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16Uint32V(v map[uint16]uint32, canChange bool,
- d *Decoder) (_ map[uint16]uint32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 6)
- v = make(map[uint16]uint32, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint16
- var mv uint32
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint16Uint64R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint16]uint64)
- v, changed := fastpathTV.DecMapUint16Uint64V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint16Uint64V(rv2i(rv).(map[uint16]uint64), false, d)
- }
-}
-func (f fastpathT) DecMapUint16Uint64X(vp *map[uint16]uint64, d *Decoder) {
- v, changed := f.DecMapUint16Uint64V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16Uint64V(v map[uint16]uint64, canChange bool,
- d *Decoder) (_ map[uint16]uint64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[uint16]uint64, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint16
- var mv uint64
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = dd.DecodeUint64()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint16UintptrR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint16]uintptr)
- v, changed := fastpathTV.DecMapUint16UintptrV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint16UintptrV(rv2i(rv).(map[uint16]uintptr), false, d)
- }
-}
-func (f fastpathT) DecMapUint16UintptrX(vp *map[uint16]uintptr, d *Decoder) {
- v, changed := f.DecMapUint16UintptrV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16UintptrV(v map[uint16]uintptr, canChange bool,
- d *Decoder) (_ map[uint16]uintptr, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[uint16]uintptr, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint16
- var mv uintptr
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint16IntR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint16]int)
- v, changed := fastpathTV.DecMapUint16IntV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint16IntV(rv2i(rv).(map[uint16]int), false, d)
- }
-}
-func (f fastpathT) DecMapUint16IntX(vp *map[uint16]int, d *Decoder) {
- v, changed := f.DecMapUint16IntV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16IntV(v map[uint16]int, canChange bool,
- d *Decoder) (_ map[uint16]int, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[uint16]int, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint16
- var mv int
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint16Int8R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint16]int8)
- v, changed := fastpathTV.DecMapUint16Int8V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint16Int8V(rv2i(rv).(map[uint16]int8), false, d)
- }
-}
-func (f fastpathT) DecMapUint16Int8X(vp *map[uint16]int8, d *Decoder) {
- v, changed := f.DecMapUint16Int8V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16Int8V(v map[uint16]int8, canChange bool,
- d *Decoder) (_ map[uint16]int8, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 3)
- v = make(map[uint16]int8, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint16
- var mv int8
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint16Int16R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint16]int16)
- v, changed := fastpathTV.DecMapUint16Int16V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint16Int16V(rv2i(rv).(map[uint16]int16), false, d)
- }
-}
-func (f fastpathT) DecMapUint16Int16X(vp *map[uint16]int16, d *Decoder) {
- v, changed := f.DecMapUint16Int16V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16Int16V(v map[uint16]int16, canChange bool,
- d *Decoder) (_ map[uint16]int16, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 4)
- v = make(map[uint16]int16, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint16
- var mv int16
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint16Int32R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint16]int32)
- v, changed := fastpathTV.DecMapUint16Int32V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint16Int32V(rv2i(rv).(map[uint16]int32), false, d)
- }
-}
-func (f fastpathT) DecMapUint16Int32X(vp *map[uint16]int32, d *Decoder) {
- v, changed := f.DecMapUint16Int32V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16Int32V(v map[uint16]int32, canChange bool,
- d *Decoder) (_ map[uint16]int32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 6)
- v = make(map[uint16]int32, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint16
- var mv int32
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint16Int64R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint16]int64)
- v, changed := fastpathTV.DecMapUint16Int64V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint16Int64V(rv2i(rv).(map[uint16]int64), false, d)
- }
-}
-func (f fastpathT) DecMapUint16Int64X(vp *map[uint16]int64, d *Decoder) {
- v, changed := f.DecMapUint16Int64V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16Int64V(v map[uint16]int64, canChange bool,
- d *Decoder) (_ map[uint16]int64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[uint16]int64, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint16
- var mv int64
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = dd.DecodeInt64()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint16Float32R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint16]float32)
- v, changed := fastpathTV.DecMapUint16Float32V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint16Float32V(rv2i(rv).(map[uint16]float32), false, d)
- }
-}
-func (f fastpathT) DecMapUint16Float32X(vp *map[uint16]float32, d *Decoder) {
- v, changed := f.DecMapUint16Float32V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16Float32V(v map[uint16]float32, canChange bool,
- d *Decoder) (_ map[uint16]float32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 6)
- v = make(map[uint16]float32, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint16
- var mv float32
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = float32(chkOvf.Float32V(dd.DecodeFloat64()))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint16Float64R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint16]float64)
- v, changed := fastpathTV.DecMapUint16Float64V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint16Float64V(rv2i(rv).(map[uint16]float64), false, d)
- }
-}
-func (f fastpathT) DecMapUint16Float64X(vp *map[uint16]float64, d *Decoder) {
- v, changed := f.DecMapUint16Float64V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16Float64V(v map[uint16]float64, canChange bool,
- d *Decoder) (_ map[uint16]float64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[uint16]float64, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint16
- var mv float64
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = dd.DecodeFloat64()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint16BoolR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint16]bool)
- v, changed := fastpathTV.DecMapUint16BoolV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint16BoolV(rv2i(rv).(map[uint16]bool), false, d)
- }
-}
-func (f fastpathT) DecMapUint16BoolX(vp *map[uint16]bool, d *Decoder) {
- v, changed := f.DecMapUint16BoolV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint16BoolV(v map[uint16]bool, canChange bool,
- d *Decoder) (_ map[uint16]bool, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 3)
- v = make(map[uint16]bool, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint16
- var mv bool
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = false
- }
- continue
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint32IntfR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint32]interface{})
- v, changed := fastpathTV.DecMapUint32IntfV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint32IntfV(rv2i(rv).(map[uint32]interface{}), false, d)
- }
-}
-func (f fastpathT) DecMapUint32IntfX(vp *map[uint32]interface{}, d *Decoder) {
- v, changed := f.DecMapUint32IntfV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32IntfV(v map[uint32]interface{}, canChange bool,
- d *Decoder) (_ map[uint32]interface{}, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 20)
- v = make(map[uint32]interface{}, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset
- var mk uint32
- var mv interface{}
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = nil
- }
- continue
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint32StringR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint32]string)
- v, changed := fastpathTV.DecMapUint32StringV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint32StringV(rv2i(rv).(map[uint32]string), false, d)
- }
-}
-func (f fastpathT) DecMapUint32StringX(vp *map[uint32]string, d *Decoder) {
- v, changed := f.DecMapUint32StringV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32StringV(v map[uint32]string, canChange bool,
- d *Decoder) (_ map[uint32]string, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 20)
- v = make(map[uint32]string, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint32
- var mv string
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = ""
- }
- continue
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint32UintR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint32]uint)
- v, changed := fastpathTV.DecMapUint32UintV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint32UintV(rv2i(rv).(map[uint32]uint), false, d)
- }
-}
-func (f fastpathT) DecMapUint32UintX(vp *map[uint32]uint, d *Decoder) {
- v, changed := f.DecMapUint32UintV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32UintV(v map[uint32]uint, canChange bool,
- d *Decoder) (_ map[uint32]uint, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uint32]uint, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint32
- var mv uint
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint32Uint8R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint32]uint8)
- v, changed := fastpathTV.DecMapUint32Uint8V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint32Uint8V(rv2i(rv).(map[uint32]uint8), false, d)
- }
-}
-func (f fastpathT) DecMapUint32Uint8X(vp *map[uint32]uint8, d *Decoder) {
- v, changed := f.DecMapUint32Uint8V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32Uint8V(v map[uint32]uint8, canChange bool,
- d *Decoder) (_ map[uint32]uint8, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[uint32]uint8, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint32
- var mv uint8
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint32Uint16R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint32]uint16)
- v, changed := fastpathTV.DecMapUint32Uint16V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint32Uint16V(rv2i(rv).(map[uint32]uint16), false, d)
- }
-}
-func (f fastpathT) DecMapUint32Uint16X(vp *map[uint32]uint16, d *Decoder) {
- v, changed := f.DecMapUint32Uint16V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32Uint16V(v map[uint32]uint16, canChange bool,
- d *Decoder) (_ map[uint32]uint16, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 6)
- v = make(map[uint32]uint16, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint32
- var mv uint16
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint32Uint32R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint32]uint32)
- v, changed := fastpathTV.DecMapUint32Uint32V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint32Uint32V(rv2i(rv).(map[uint32]uint32), false, d)
- }
-}
-func (f fastpathT) DecMapUint32Uint32X(vp *map[uint32]uint32, d *Decoder) {
- v, changed := f.DecMapUint32Uint32V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32Uint32V(v map[uint32]uint32, canChange bool,
- d *Decoder) (_ map[uint32]uint32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 8)
- v = make(map[uint32]uint32, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint32
- var mv uint32
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint32Uint64R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint32]uint64)
- v, changed := fastpathTV.DecMapUint32Uint64V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint32Uint64V(rv2i(rv).(map[uint32]uint64), false, d)
- }
-}
-func (f fastpathT) DecMapUint32Uint64X(vp *map[uint32]uint64, d *Decoder) {
- v, changed := f.DecMapUint32Uint64V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32Uint64V(v map[uint32]uint64, canChange bool,
- d *Decoder) (_ map[uint32]uint64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uint32]uint64, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint32
- var mv uint64
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = dd.DecodeUint64()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint32UintptrR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint32]uintptr)
- v, changed := fastpathTV.DecMapUint32UintptrV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint32UintptrV(rv2i(rv).(map[uint32]uintptr), false, d)
- }
-}
-func (f fastpathT) DecMapUint32UintptrX(vp *map[uint32]uintptr, d *Decoder) {
- v, changed := f.DecMapUint32UintptrV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32UintptrV(v map[uint32]uintptr, canChange bool,
- d *Decoder) (_ map[uint32]uintptr, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uint32]uintptr, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint32
- var mv uintptr
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint32IntR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint32]int)
- v, changed := fastpathTV.DecMapUint32IntV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint32IntV(rv2i(rv).(map[uint32]int), false, d)
- }
-}
-func (f fastpathT) DecMapUint32IntX(vp *map[uint32]int, d *Decoder) {
- v, changed := f.DecMapUint32IntV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32IntV(v map[uint32]int, canChange bool,
- d *Decoder) (_ map[uint32]int, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uint32]int, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint32
- var mv int
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint32Int8R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint32]int8)
- v, changed := fastpathTV.DecMapUint32Int8V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint32Int8V(rv2i(rv).(map[uint32]int8), false, d)
- }
-}
-func (f fastpathT) DecMapUint32Int8X(vp *map[uint32]int8, d *Decoder) {
- v, changed := f.DecMapUint32Int8V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32Int8V(v map[uint32]int8, canChange bool,
- d *Decoder) (_ map[uint32]int8, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[uint32]int8, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint32
- var mv int8
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint32Int16R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint32]int16)
- v, changed := fastpathTV.DecMapUint32Int16V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint32Int16V(rv2i(rv).(map[uint32]int16), false, d)
- }
-}
-func (f fastpathT) DecMapUint32Int16X(vp *map[uint32]int16, d *Decoder) {
- v, changed := f.DecMapUint32Int16V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32Int16V(v map[uint32]int16, canChange bool,
- d *Decoder) (_ map[uint32]int16, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 6)
- v = make(map[uint32]int16, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint32
- var mv int16
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint32Int32R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint32]int32)
- v, changed := fastpathTV.DecMapUint32Int32V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint32Int32V(rv2i(rv).(map[uint32]int32), false, d)
- }
-}
-func (f fastpathT) DecMapUint32Int32X(vp *map[uint32]int32, d *Decoder) {
- v, changed := f.DecMapUint32Int32V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32Int32V(v map[uint32]int32, canChange bool,
- d *Decoder) (_ map[uint32]int32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 8)
- v = make(map[uint32]int32, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint32
- var mv int32
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint32Int64R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint32]int64)
- v, changed := fastpathTV.DecMapUint32Int64V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint32Int64V(rv2i(rv).(map[uint32]int64), false, d)
- }
-}
-func (f fastpathT) DecMapUint32Int64X(vp *map[uint32]int64, d *Decoder) {
- v, changed := f.DecMapUint32Int64V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32Int64V(v map[uint32]int64, canChange bool,
- d *Decoder) (_ map[uint32]int64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uint32]int64, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint32
- var mv int64
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = dd.DecodeInt64()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint32Float32R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint32]float32)
- v, changed := fastpathTV.DecMapUint32Float32V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint32Float32V(rv2i(rv).(map[uint32]float32), false, d)
- }
-}
-func (f fastpathT) DecMapUint32Float32X(vp *map[uint32]float32, d *Decoder) {
- v, changed := f.DecMapUint32Float32V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32Float32V(v map[uint32]float32, canChange bool,
- d *Decoder) (_ map[uint32]float32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 8)
- v = make(map[uint32]float32, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint32
- var mv float32
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = float32(chkOvf.Float32V(dd.DecodeFloat64()))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint32Float64R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint32]float64)
- v, changed := fastpathTV.DecMapUint32Float64V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint32Float64V(rv2i(rv).(map[uint32]float64), false, d)
- }
-}
-func (f fastpathT) DecMapUint32Float64X(vp *map[uint32]float64, d *Decoder) {
- v, changed := f.DecMapUint32Float64V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32Float64V(v map[uint32]float64, canChange bool,
- d *Decoder) (_ map[uint32]float64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uint32]float64, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint32
- var mv float64
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = dd.DecodeFloat64()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint32BoolR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint32]bool)
- v, changed := fastpathTV.DecMapUint32BoolV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint32BoolV(rv2i(rv).(map[uint32]bool), false, d)
- }
-}
-func (f fastpathT) DecMapUint32BoolX(vp *map[uint32]bool, d *Decoder) {
- v, changed := f.DecMapUint32BoolV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint32BoolV(v map[uint32]bool, canChange bool,
- d *Decoder) (_ map[uint32]bool, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[uint32]bool, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint32
- var mv bool
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = false
- }
- continue
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint64IntfR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint64]interface{})
- v, changed := fastpathTV.DecMapUint64IntfV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint64IntfV(rv2i(rv).(map[uint64]interface{}), false, d)
- }
-}
-func (f fastpathT) DecMapUint64IntfX(vp *map[uint64]interface{}, d *Decoder) {
- v, changed := f.DecMapUint64IntfV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64IntfV(v map[uint64]interface{}, canChange bool,
- d *Decoder) (_ map[uint64]interface{}, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[uint64]interface{}, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset
- var mk uint64
- var mv interface{}
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeUint64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = nil
- }
- continue
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint64StringR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint64]string)
- v, changed := fastpathTV.DecMapUint64StringV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint64StringV(rv2i(rv).(map[uint64]string), false, d)
- }
-}
-func (f fastpathT) DecMapUint64StringX(vp *map[uint64]string, d *Decoder) {
- v, changed := f.DecMapUint64StringV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64StringV(v map[uint64]string, canChange bool,
- d *Decoder) (_ map[uint64]string, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[uint64]string, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint64
- var mv string
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeUint64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = ""
- }
- continue
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint64UintR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint64]uint)
- v, changed := fastpathTV.DecMapUint64UintV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint64UintV(rv2i(rv).(map[uint64]uint), false, d)
- }
-}
-func (f fastpathT) DecMapUint64UintX(vp *map[uint64]uint, d *Decoder) {
- v, changed := f.DecMapUint64UintV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64UintV(v map[uint64]uint, canChange bool,
- d *Decoder) (_ map[uint64]uint, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uint64]uint, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint64
- var mv uint
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeUint64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint64Uint8R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint64]uint8)
- v, changed := fastpathTV.DecMapUint64Uint8V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint64Uint8V(rv2i(rv).(map[uint64]uint8), false, d)
- }
-}
-func (f fastpathT) DecMapUint64Uint8X(vp *map[uint64]uint8, d *Decoder) {
- v, changed := f.DecMapUint64Uint8V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64Uint8V(v map[uint64]uint8, canChange bool,
- d *Decoder) (_ map[uint64]uint8, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uint64]uint8, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint64
- var mv uint8
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeUint64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint64Uint16R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint64]uint16)
- v, changed := fastpathTV.DecMapUint64Uint16V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint64Uint16V(rv2i(rv).(map[uint64]uint16), false, d)
- }
-}
-func (f fastpathT) DecMapUint64Uint16X(vp *map[uint64]uint16, d *Decoder) {
- v, changed := f.DecMapUint64Uint16V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64Uint16V(v map[uint64]uint16, canChange bool,
- d *Decoder) (_ map[uint64]uint16, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[uint64]uint16, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint64
- var mv uint16
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeUint64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint64Uint32R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint64]uint32)
- v, changed := fastpathTV.DecMapUint64Uint32V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint64Uint32V(rv2i(rv).(map[uint64]uint32), false, d)
- }
-}
-func (f fastpathT) DecMapUint64Uint32X(vp *map[uint64]uint32, d *Decoder) {
- v, changed := f.DecMapUint64Uint32V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64Uint32V(v map[uint64]uint32, canChange bool,
- d *Decoder) (_ map[uint64]uint32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uint64]uint32, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint64
- var mv uint32
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeUint64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint64Uint64R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint64]uint64)
- v, changed := fastpathTV.DecMapUint64Uint64V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint64Uint64V(rv2i(rv).(map[uint64]uint64), false, d)
- }
-}
-func (f fastpathT) DecMapUint64Uint64X(vp *map[uint64]uint64, d *Decoder) {
- v, changed := f.DecMapUint64Uint64V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64Uint64V(v map[uint64]uint64, canChange bool,
- d *Decoder) (_ map[uint64]uint64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uint64]uint64, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint64
- var mv uint64
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeUint64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = dd.DecodeUint64()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint64UintptrR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint64]uintptr)
- v, changed := fastpathTV.DecMapUint64UintptrV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint64UintptrV(rv2i(rv).(map[uint64]uintptr), false, d)
- }
-}
-func (f fastpathT) DecMapUint64UintptrX(vp *map[uint64]uintptr, d *Decoder) {
- v, changed := f.DecMapUint64UintptrV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64UintptrV(v map[uint64]uintptr, canChange bool,
- d *Decoder) (_ map[uint64]uintptr, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uint64]uintptr, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint64
- var mv uintptr
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeUint64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint64IntR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint64]int)
- v, changed := fastpathTV.DecMapUint64IntV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint64IntV(rv2i(rv).(map[uint64]int), false, d)
- }
-}
-func (f fastpathT) DecMapUint64IntX(vp *map[uint64]int, d *Decoder) {
- v, changed := f.DecMapUint64IntV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64IntV(v map[uint64]int, canChange bool,
- d *Decoder) (_ map[uint64]int, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uint64]int, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint64
- var mv int
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeUint64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint64Int8R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint64]int8)
- v, changed := fastpathTV.DecMapUint64Int8V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint64Int8V(rv2i(rv).(map[uint64]int8), false, d)
- }
-}
-func (f fastpathT) DecMapUint64Int8X(vp *map[uint64]int8, d *Decoder) {
- v, changed := f.DecMapUint64Int8V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64Int8V(v map[uint64]int8, canChange bool,
- d *Decoder) (_ map[uint64]int8, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uint64]int8, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint64
- var mv int8
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeUint64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint64Int16R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint64]int16)
- v, changed := fastpathTV.DecMapUint64Int16V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint64Int16V(rv2i(rv).(map[uint64]int16), false, d)
- }
-}
-func (f fastpathT) DecMapUint64Int16X(vp *map[uint64]int16, d *Decoder) {
- v, changed := f.DecMapUint64Int16V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64Int16V(v map[uint64]int16, canChange bool,
- d *Decoder) (_ map[uint64]int16, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[uint64]int16, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint64
- var mv int16
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeUint64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint64Int32R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint64]int32)
- v, changed := fastpathTV.DecMapUint64Int32V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint64Int32V(rv2i(rv).(map[uint64]int32), false, d)
- }
-}
-func (f fastpathT) DecMapUint64Int32X(vp *map[uint64]int32, d *Decoder) {
- v, changed := f.DecMapUint64Int32V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64Int32V(v map[uint64]int32, canChange bool,
- d *Decoder) (_ map[uint64]int32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uint64]int32, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint64
- var mv int32
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeUint64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint64Int64R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint64]int64)
- v, changed := fastpathTV.DecMapUint64Int64V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint64Int64V(rv2i(rv).(map[uint64]int64), false, d)
- }
-}
-func (f fastpathT) DecMapUint64Int64X(vp *map[uint64]int64, d *Decoder) {
- v, changed := f.DecMapUint64Int64V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64Int64V(v map[uint64]int64, canChange bool,
- d *Decoder) (_ map[uint64]int64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uint64]int64, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint64
- var mv int64
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeUint64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = dd.DecodeInt64()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint64Float32R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint64]float32)
- v, changed := fastpathTV.DecMapUint64Float32V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint64Float32V(rv2i(rv).(map[uint64]float32), false, d)
- }
-}
-func (f fastpathT) DecMapUint64Float32X(vp *map[uint64]float32, d *Decoder) {
- v, changed := f.DecMapUint64Float32V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64Float32V(v map[uint64]float32, canChange bool,
- d *Decoder) (_ map[uint64]float32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uint64]float32, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint64
- var mv float32
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeUint64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = float32(chkOvf.Float32V(dd.DecodeFloat64()))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint64Float64R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint64]float64)
- v, changed := fastpathTV.DecMapUint64Float64V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint64Float64V(rv2i(rv).(map[uint64]float64), false, d)
- }
-}
-func (f fastpathT) DecMapUint64Float64X(vp *map[uint64]float64, d *Decoder) {
- v, changed := f.DecMapUint64Float64V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64Float64V(v map[uint64]float64, canChange bool,
- d *Decoder) (_ map[uint64]float64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uint64]float64, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint64
- var mv float64
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeUint64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = dd.DecodeFloat64()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUint64BoolR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uint64]bool)
- v, changed := fastpathTV.DecMapUint64BoolV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUint64BoolV(rv2i(rv).(map[uint64]bool), false, d)
- }
-}
-func (f fastpathT) DecMapUint64BoolX(vp *map[uint64]bool, d *Decoder) {
- v, changed := f.DecMapUint64BoolV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUint64BoolV(v map[uint64]bool, canChange bool,
- d *Decoder) (_ map[uint64]bool, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uint64]bool, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uint64
- var mv bool
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeUint64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = false
- }
- continue
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUintptrIntfR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uintptr]interface{})
- v, changed := fastpathTV.DecMapUintptrIntfV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUintptrIntfV(rv2i(rv).(map[uintptr]interface{}), false, d)
- }
-}
-func (f fastpathT) DecMapUintptrIntfX(vp *map[uintptr]interface{}, d *Decoder) {
- v, changed := f.DecMapUintptrIntfV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrIntfV(v map[uintptr]interface{}, canChange bool,
- d *Decoder) (_ map[uintptr]interface{}, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[uintptr]interface{}, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset
- var mk uintptr
- var mv interface{}
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = nil
- }
- continue
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUintptrStringR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uintptr]string)
- v, changed := fastpathTV.DecMapUintptrStringV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUintptrStringV(rv2i(rv).(map[uintptr]string), false, d)
- }
-}
-func (f fastpathT) DecMapUintptrStringX(vp *map[uintptr]string, d *Decoder) {
- v, changed := f.DecMapUintptrStringV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrStringV(v map[uintptr]string, canChange bool,
- d *Decoder) (_ map[uintptr]string, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[uintptr]string, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uintptr
- var mv string
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = ""
- }
- continue
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUintptrUintR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uintptr]uint)
- v, changed := fastpathTV.DecMapUintptrUintV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUintptrUintV(rv2i(rv).(map[uintptr]uint), false, d)
- }
-}
-func (f fastpathT) DecMapUintptrUintX(vp *map[uintptr]uint, d *Decoder) {
- v, changed := f.DecMapUintptrUintV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrUintV(v map[uintptr]uint, canChange bool,
- d *Decoder) (_ map[uintptr]uint, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uintptr]uint, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uintptr
- var mv uint
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUintptrUint8R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uintptr]uint8)
- v, changed := fastpathTV.DecMapUintptrUint8V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUintptrUint8V(rv2i(rv).(map[uintptr]uint8), false, d)
- }
-}
-func (f fastpathT) DecMapUintptrUint8X(vp *map[uintptr]uint8, d *Decoder) {
- v, changed := f.DecMapUintptrUint8V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrUint8V(v map[uintptr]uint8, canChange bool,
- d *Decoder) (_ map[uintptr]uint8, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uintptr]uint8, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uintptr
- var mv uint8
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUintptrUint16R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uintptr]uint16)
- v, changed := fastpathTV.DecMapUintptrUint16V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUintptrUint16V(rv2i(rv).(map[uintptr]uint16), false, d)
- }
-}
-func (f fastpathT) DecMapUintptrUint16X(vp *map[uintptr]uint16, d *Decoder) {
- v, changed := f.DecMapUintptrUint16V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrUint16V(v map[uintptr]uint16, canChange bool,
- d *Decoder) (_ map[uintptr]uint16, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[uintptr]uint16, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uintptr
- var mv uint16
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUintptrUint32R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uintptr]uint32)
- v, changed := fastpathTV.DecMapUintptrUint32V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUintptrUint32V(rv2i(rv).(map[uintptr]uint32), false, d)
- }
-}
-func (f fastpathT) DecMapUintptrUint32X(vp *map[uintptr]uint32, d *Decoder) {
- v, changed := f.DecMapUintptrUint32V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrUint32V(v map[uintptr]uint32, canChange bool,
- d *Decoder) (_ map[uintptr]uint32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uintptr]uint32, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uintptr
- var mv uint32
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUintptrUint64R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uintptr]uint64)
- v, changed := fastpathTV.DecMapUintptrUint64V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUintptrUint64V(rv2i(rv).(map[uintptr]uint64), false, d)
- }
-}
-func (f fastpathT) DecMapUintptrUint64X(vp *map[uintptr]uint64, d *Decoder) {
- v, changed := f.DecMapUintptrUint64V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrUint64V(v map[uintptr]uint64, canChange bool,
- d *Decoder) (_ map[uintptr]uint64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uintptr]uint64, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uintptr
- var mv uint64
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = dd.DecodeUint64()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUintptrUintptrR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uintptr]uintptr)
- v, changed := fastpathTV.DecMapUintptrUintptrV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUintptrUintptrV(rv2i(rv).(map[uintptr]uintptr), false, d)
- }
-}
-func (f fastpathT) DecMapUintptrUintptrX(vp *map[uintptr]uintptr, d *Decoder) {
- v, changed := f.DecMapUintptrUintptrV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrUintptrV(v map[uintptr]uintptr, canChange bool,
- d *Decoder) (_ map[uintptr]uintptr, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uintptr]uintptr, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uintptr
- var mv uintptr
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUintptrIntR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uintptr]int)
- v, changed := fastpathTV.DecMapUintptrIntV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUintptrIntV(rv2i(rv).(map[uintptr]int), false, d)
- }
-}
-func (f fastpathT) DecMapUintptrIntX(vp *map[uintptr]int, d *Decoder) {
- v, changed := f.DecMapUintptrIntV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrIntV(v map[uintptr]int, canChange bool,
- d *Decoder) (_ map[uintptr]int, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uintptr]int, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uintptr
- var mv int
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUintptrInt8R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uintptr]int8)
- v, changed := fastpathTV.DecMapUintptrInt8V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUintptrInt8V(rv2i(rv).(map[uintptr]int8), false, d)
- }
-}
-func (f fastpathT) DecMapUintptrInt8X(vp *map[uintptr]int8, d *Decoder) {
- v, changed := f.DecMapUintptrInt8V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrInt8V(v map[uintptr]int8, canChange bool,
- d *Decoder) (_ map[uintptr]int8, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uintptr]int8, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uintptr
- var mv int8
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUintptrInt16R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uintptr]int16)
- v, changed := fastpathTV.DecMapUintptrInt16V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUintptrInt16V(rv2i(rv).(map[uintptr]int16), false, d)
- }
-}
-func (f fastpathT) DecMapUintptrInt16X(vp *map[uintptr]int16, d *Decoder) {
- v, changed := f.DecMapUintptrInt16V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrInt16V(v map[uintptr]int16, canChange bool,
- d *Decoder) (_ map[uintptr]int16, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[uintptr]int16, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uintptr
- var mv int16
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUintptrInt32R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uintptr]int32)
- v, changed := fastpathTV.DecMapUintptrInt32V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUintptrInt32V(rv2i(rv).(map[uintptr]int32), false, d)
- }
-}
-func (f fastpathT) DecMapUintptrInt32X(vp *map[uintptr]int32, d *Decoder) {
- v, changed := f.DecMapUintptrInt32V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrInt32V(v map[uintptr]int32, canChange bool,
- d *Decoder) (_ map[uintptr]int32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uintptr]int32, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uintptr
- var mv int32
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUintptrInt64R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uintptr]int64)
- v, changed := fastpathTV.DecMapUintptrInt64V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUintptrInt64V(rv2i(rv).(map[uintptr]int64), false, d)
- }
-}
-func (f fastpathT) DecMapUintptrInt64X(vp *map[uintptr]int64, d *Decoder) {
- v, changed := f.DecMapUintptrInt64V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrInt64V(v map[uintptr]int64, canChange bool,
- d *Decoder) (_ map[uintptr]int64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uintptr]int64, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uintptr
- var mv int64
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = dd.DecodeInt64()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUintptrFloat32R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uintptr]float32)
- v, changed := fastpathTV.DecMapUintptrFloat32V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUintptrFloat32V(rv2i(rv).(map[uintptr]float32), false, d)
- }
-}
-func (f fastpathT) DecMapUintptrFloat32X(vp *map[uintptr]float32, d *Decoder) {
- v, changed := f.DecMapUintptrFloat32V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrFloat32V(v map[uintptr]float32, canChange bool,
- d *Decoder) (_ map[uintptr]float32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[uintptr]float32, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uintptr
- var mv float32
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = float32(chkOvf.Float32V(dd.DecodeFloat64()))
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUintptrFloat64R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uintptr]float64)
- v, changed := fastpathTV.DecMapUintptrFloat64V(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUintptrFloat64V(rv2i(rv).(map[uintptr]float64), false, d)
- }
-}
-func (f fastpathT) DecMapUintptrFloat64X(vp *map[uintptr]float64, d *Decoder) {
- v, changed := f.DecMapUintptrFloat64V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrFloat64V(v map[uintptr]float64, canChange bool,
- d *Decoder) (_ map[uintptr]float64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[uintptr]float64, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uintptr
- var mv float64
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = dd.DecodeFloat64()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapUintptrBoolR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[uintptr]bool)
- v, changed := fastpathTV.DecMapUintptrBoolV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapUintptrBoolV(rv2i(rv).(map[uintptr]bool), false, d)
- }
-}
-func (f fastpathT) DecMapUintptrBoolX(vp *map[uintptr]bool, d *Decoder) {
- v, changed := f.DecMapUintptrBoolV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapUintptrBoolV(v map[uintptr]bool, canChange bool,
- d *Decoder) (_ map[uintptr]bool, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[uintptr]bool, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk uintptr
- var mv bool
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = false
- }
- continue
- }
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapIntIntfR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int]interface{})
- v, changed := fastpathTV.DecMapIntIntfV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapIntIntfV(rv2i(rv).(map[int]interface{}), false, d)
- }
-}
-func (f fastpathT) DecMapIntIntfX(vp *map[int]interface{}, d *Decoder) {
- v, changed := f.DecMapIntIntfV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntIntfV(v map[int]interface{}, canChange bool,
- d *Decoder) (_ map[int]interface{}, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[int]interface{}, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset
- var mk int
- var mv interface{}
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = nil
- }
- continue
- }
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapIntStringR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int]string)
- v, changed := fastpathTV.DecMapIntStringV(*vp, true, d)
- if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapIntStringV(rv2i(rv).(map[int]string), false, d)
- }
-}
-func (f fastpathT) DecMapIntStringX(vp *map[int]string, d *Decoder) {
- v, changed := f.DecMapIntStringV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntStringV(v map[int]string, canChange bool,
- d *Decoder) (_ map[int]string, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[int]string, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk int
- var mv string
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = ""
- }
- continue
- }
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
- }
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapIntUintR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int]uint)
- v, changed := fastpathTV.DecMapIntUintV(*vp, true, d)
+ case map[int64]uint:
+ fastpathTV.DecMapInt64UintV(v, false, d)
+ case *map[int64]uint:
+ var v2 map[int64]uint
+ v2, changed = fastpathTV.DecMapInt64UintV(*v, true, d)
if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapIntUintV(rv2i(rv).(map[int]uint), false, d)
- }
-}
-func (f fastpathT) DecMapIntUintX(vp *map[int]uint, d *Decoder) {
- v, changed := f.DecMapIntUintV(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntUintV(v map[int]uint, canChange bool,
- d *Decoder) (_ map[int]uint, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[int]uint, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk int
- var mv uint
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if v != nil {
- v[mk] = mv
+ *v = v2
}
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapIntUint8R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int]uint8)
- v, changed := fastpathTV.DecMapIntUint8V(*vp, true, d)
+ case map[int64]uint8:
+ fastpathTV.DecMapInt64Uint8V(v, false, d)
+ case *map[int64]uint8:
+ var v2 map[int64]uint8
+ v2, changed = fastpathTV.DecMapInt64Uint8V(*v, true, d)
if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapIntUint8V(rv2i(rv).(map[int]uint8), false, d)
- }
-}
-func (f fastpathT) DecMapIntUint8X(vp *map[int]uint8, d *Decoder) {
- v, changed := f.DecMapIntUint8V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntUint8V(v map[int]uint8, canChange bool,
- d *Decoder) (_ map[int]uint8, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[int]uint8, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk int
- var mv uint8
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8))
- if v != nil {
- v[mk] = mv
+ *v = v2
}
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapIntUint16R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int]uint16)
- v, changed := fastpathTV.DecMapIntUint16V(*vp, true, d)
+ case map[int64]uint64:
+ fastpathTV.DecMapInt64Uint64V(v, false, d)
+ case *map[int64]uint64:
+ var v2 map[int64]uint64
+ v2, changed = fastpathTV.DecMapInt64Uint64V(*v, true, d)
if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapIntUint16V(rv2i(rv).(map[int]uint16), false, d)
- }
-}
-func (f fastpathT) DecMapIntUint16X(vp *map[int]uint16, d *Decoder) {
- v, changed := f.DecMapIntUint16V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntUint16V(v map[int]uint16, canChange bool,
- d *Decoder) (_ map[int]uint16, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[int]uint16, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk int
- var mv uint16
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16))
- if v != nil {
- v[mk] = mv
+ *v = v2
}
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapIntUint32R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int]uint32)
- v, changed := fastpathTV.DecMapIntUint32V(*vp, true, d)
+ case map[int64]uintptr:
+ fastpathTV.DecMapInt64UintptrV(v, false, d)
+ case *map[int64]uintptr:
+ var v2 map[int64]uintptr
+ v2, changed = fastpathTV.DecMapInt64UintptrV(*v, true, d)
if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapIntUint32V(rv2i(rv).(map[int]uint32), false, d)
- }
-}
-func (f fastpathT) DecMapIntUint32X(vp *map[int]uint32, d *Decoder) {
- v, changed := f.DecMapIntUint32V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntUint32V(v map[int]uint32, canChange bool,
- d *Decoder) (_ map[int]uint32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[int]uint32, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk int
- var mv uint32
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
- }
- mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32))
- if v != nil {
- v[mk] = mv
+ *v = v2
}
- }
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
-}
-
-func (d *Decoder) fastpathDecMapIntUint64R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int]uint64)
- v, changed := fastpathTV.DecMapIntUint64V(*vp, true, d)
+ case map[int64]int:
+ fastpathTV.DecMapInt64IntV(v, false, d)
+ case *map[int64]int:
+ var v2 map[int64]int
+ v2, changed = fastpathTV.DecMapInt64IntV(*v, true, d)
if changed {
- *vp = v
- }
- } else {
- fastpathTV.DecMapIntUint64V(rv2i(rv).(map[int]uint64), false, d)
- }
-}
-func (f fastpathT) DecMapIntUint64X(vp *map[int]uint64, d *Decoder) {
- v, changed := f.DecMapIntUint64V(*vp, true, d)
- if changed {
- *vp = v
- }
-}
-func (_ fastpathT) DecMapIntUint64V(v map[int]uint64, canChange bool,
- d *Decoder) (_ map[int]uint64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[int]uint64, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
- return v, changed
- }
- d.depthIncr()
- var mk int
- var mv uint64
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
+ *v = v2
}
- mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize))
- if esep {
- dd.ReadMapElemValue()
+ case map[int64]int64:
+ fastpathTV.DecMapInt64Int64V(v, false, d)
+ case *map[int64]int64:
+ var v2 map[int64]int64
+ v2, changed = fastpathTV.DecMapInt64Int64V(*v, true, d)
+ if changed {
+ *v = v2
}
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
- } else {
- v[mk] = 0
- }
- continue
+ case map[int64]float32:
+ fastpathTV.DecMapInt64Float32V(v, false, d)
+ case *map[int64]float32:
+ var v2 map[int64]float32
+ v2, changed = fastpathTV.DecMapInt64Float32V(*v, true, d)
+ if changed {
+ *v = v2
}
- mv = dd.DecodeUint64()
- if v != nil {
- v[mk] = mv
+ case map[int64]float64:
+ fastpathTV.DecMapInt64Float64V(v, false, d)
+ case *map[int64]float64:
+ var v2 map[int64]float64
+ v2, changed = fastpathTV.DecMapInt64Float64V(*v, true, d)
+ if changed {
+ *v = v2
+ }
+ case map[int64]bool:
+ fastpathTV.DecMapInt64BoolV(v, false, d)
+ case *map[int64]bool:
+ var v2 map[int64]bool
+ v2, changed = fastpathTV.DecMapInt64BoolV(*v, true, d)
+ if changed {
+ *v = v2
}
+ default:
+ _ = v // workaround https://github.com/golang/go/issues/12927 seen in go1.4
+ return false
}
- dd.ReadMapEnd()
- d.depthDecr()
- return v, changed
+ return true
}
-func (d *Decoder) fastpathDecMapIntUintptrR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int]uintptr)
- v, changed := fastpathTV.DecMapIntUintptrV(*vp, true, d)
- if changed {
+func fastpathDecodeSetZeroTypeSwitch(iv interface{}) bool {
+ switch v := iv.(type) {
+
+ case *[]interface{}:
+ *v = nil
+ case *[]string:
+ *v = nil
+ case *[][]byte:
+ *v = nil
+ case *[]float32:
+ *v = nil
+ case *[]float64:
+ *v = nil
+ case *[]uint:
+ *v = nil
+ case *[]uint8:
+ *v = nil
+ case *[]uint16:
+ *v = nil
+ case *[]uint32:
+ *v = nil
+ case *[]uint64:
+ *v = nil
+ case *[]uintptr:
+ *v = nil
+ case *[]int:
+ *v = nil
+ case *[]int8:
+ *v = nil
+ case *[]int16:
+ *v = nil
+ case *[]int32:
+ *v = nil
+ case *[]int64:
+ *v = nil
+ case *[]bool:
+ *v = nil
+
+ case *map[string]interface{}:
+ *v = nil
+ case *map[string]string:
+ *v = nil
+ case *map[string][]byte:
+ *v = nil
+ case *map[string]uint:
+ *v = nil
+ case *map[string]uint8:
+ *v = nil
+ case *map[string]uint64:
+ *v = nil
+ case *map[string]uintptr:
+ *v = nil
+ case *map[string]int:
+ *v = nil
+ case *map[string]int64:
+ *v = nil
+ case *map[string]float32:
+ *v = nil
+ case *map[string]float64:
+ *v = nil
+ case *map[string]bool:
+ *v = nil
+ case *map[uint]interface{}:
+ *v = nil
+ case *map[uint]string:
+ *v = nil
+ case *map[uint][]byte:
+ *v = nil
+ case *map[uint]uint:
+ *v = nil
+ case *map[uint]uint8:
+ *v = nil
+ case *map[uint]uint64:
+ *v = nil
+ case *map[uint]uintptr:
+ *v = nil
+ case *map[uint]int:
+ *v = nil
+ case *map[uint]int64:
+ *v = nil
+ case *map[uint]float32:
+ *v = nil
+ case *map[uint]float64:
+ *v = nil
+ case *map[uint]bool:
+ *v = nil
+ case *map[uint8]interface{}:
+ *v = nil
+ case *map[uint8]string:
+ *v = nil
+ case *map[uint8][]byte:
+ *v = nil
+ case *map[uint8]uint:
+ *v = nil
+ case *map[uint8]uint8:
+ *v = nil
+ case *map[uint8]uint64:
+ *v = nil
+ case *map[uint8]uintptr:
+ *v = nil
+ case *map[uint8]int:
+ *v = nil
+ case *map[uint8]int64:
+ *v = nil
+ case *map[uint8]float32:
+ *v = nil
+ case *map[uint8]float64:
+ *v = nil
+ case *map[uint8]bool:
+ *v = nil
+ case *map[uint64]interface{}:
+ *v = nil
+ case *map[uint64]string:
+ *v = nil
+ case *map[uint64][]byte:
+ *v = nil
+ case *map[uint64]uint:
+ *v = nil
+ case *map[uint64]uint8:
+ *v = nil
+ case *map[uint64]uint64:
+ *v = nil
+ case *map[uint64]uintptr:
+ *v = nil
+ case *map[uint64]int:
+ *v = nil
+ case *map[uint64]int64:
+ *v = nil
+ case *map[uint64]float32:
+ *v = nil
+ case *map[uint64]float64:
+ *v = nil
+ case *map[uint64]bool:
+ *v = nil
+ case *map[int]interface{}:
+ *v = nil
+ case *map[int]string:
+ *v = nil
+ case *map[int][]byte:
+ *v = nil
+ case *map[int]uint:
+ *v = nil
+ case *map[int]uint8:
+ *v = nil
+ case *map[int]uint64:
+ *v = nil
+ case *map[int]uintptr:
+ *v = nil
+ case *map[int]int:
+ *v = nil
+ case *map[int]int64:
+ *v = nil
+ case *map[int]float32:
+ *v = nil
+ case *map[int]float64:
+ *v = nil
+ case *map[int]bool:
+ *v = nil
+ case *map[int64]interface{}:
+ *v = nil
+ case *map[int64]string:
+ *v = nil
+ case *map[int64][]byte:
+ *v = nil
+ case *map[int64]uint:
+ *v = nil
+ case *map[int64]uint8:
+ *v = nil
+ case *map[int64]uint64:
+ *v = nil
+ case *map[int64]uintptr:
+ *v = nil
+ case *map[int64]int:
+ *v = nil
+ case *map[int64]int64:
+ *v = nil
+ case *map[int64]float32:
+ *v = nil
+ case *map[int64]float64:
+ *v = nil
+ case *map[int64]bool:
+ *v = nil
+ default:
+ _ = v // workaround https://github.com/golang/go/issues/12927 seen in go1.4
+ return false
+ }
+ return true
+}
+
+// -- -- fast path functions
+
+func (d *Decoder) fastpathDecSliceIntfR(f *codecFnInfo, rv reflect.Value) {
+ if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr {
+ vp := rv2i(rv).(*[]interface{})
+ if v, changed := fastpathTV.DecSliceIntfV(*vp, !array, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapIntUintptrV(rv2i(rv).(map[int]uintptr), false, d)
+ v := rv2i(rv).([]interface{})
+ v2, changed := fastpathTV.DecSliceIntfV(v, !array, d)
+ if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
+ copy(v, v2)
+ }
}
}
-func (f fastpathT) DecMapIntUintptrX(vp *map[int]uintptr, d *Decoder) {
- v, changed := f.DecMapIntUintptrV(*vp, true, d)
- if changed {
+func (f fastpathT) DecSliceIntfX(vp *[]interface{}, d *Decoder) {
+ if v, changed := f.DecSliceIntfV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapIntUintptrV(v map[int]uintptr, canChange bool,
- d *Decoder) (_ map[int]uintptr, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[int]uintptr, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
+func (fastpathT) DecSliceIntfV(v []interface{}, canChange bool, d *Decoder) (_ []interface{}, changed bool) {
+ slh, containerLenS := d.decSliceHelperStart()
+ if containerLenS == 0 {
+ if canChange {
+ if v == nil {
+ v = []interface{}{}
+ } else if len(v) != 0 {
+ v = v[:0]
+ }
+ changed = true
+ }
+ slh.End()
return v, changed
}
- d.depthIncr()
- var mk int
- var mv uintptr
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
+ hasLen := containerLenS > 0
+ var xlen int
+ if hasLen && canChange {
+ if containerLenS > cap(v) {
+ xlen = decInferLen(containerLenS, d.h.MaxInitLen, 16)
+ if xlen <= cap(v) {
+ v = v[:uint(xlen)]
+ } else {
+ v = make([]interface{}, uint(xlen))
+ }
+ changed = true
+ } else if containerLenS != len(v) {
+ v = v[:containerLenS]
+ changed = true
}
- mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize))
- if esep {
- dd.ReadMapElemValue()
+ }
+ var j int
+ for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.d.CheckBreak()); j++ {
+ if j == 0 && len(v) == 0 && canChange {
+ if hasLen {
+ xlen = decInferLen(containerLenS, d.h.MaxInitLen, 16)
+ } else {
+ xlen = 8
+ }
+ v = make([]interface{}, uint(xlen))
+ changed = true
}
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
+ var decodeIntoBlank bool
+ if j >= len(v) {
+ if canChange {
+ v = append(v, nil)
+ changed = true
} else {
- v[mk] = 0
+ d.arrayCannotExpand(len(v), j+1)
+ decodeIntoBlank = true
}
- continue
}
- mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if v != nil {
- v[mk] = mv
+ slh.ElemContainerState(j)
+ if decodeIntoBlank {
+ d.swallow()
+ } else if d.d.TryDecodeAsNil() {
+ v[uint(j)] = nil
+ } else {
+ d.decode(&v[uint(j)])
+ }
+ }
+ if canChange {
+ if j < len(v) {
+ v = v[:uint(j)]
+ changed = true
+ } else if j == 0 && v == nil {
+ v = make([]interface{}, 0)
+ changed = true
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ slh.End()
return v, changed
}
-func (d *Decoder) fastpathDecMapIntIntR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int]int)
- v, changed := fastpathTV.DecMapIntIntV(*vp, true, d)
- if changed {
+func (d *Decoder) fastpathDecSliceStringR(f *codecFnInfo, rv reflect.Value) {
+ if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr {
+ vp := rv2i(rv).(*[]string)
+ if v, changed := fastpathTV.DecSliceStringV(*vp, !array, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapIntIntV(rv2i(rv).(map[int]int), false, d)
+ v := rv2i(rv).([]string)
+ v2, changed := fastpathTV.DecSliceStringV(v, !array, d)
+ if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
+ copy(v, v2)
+ }
}
}
-func (f fastpathT) DecMapIntIntX(vp *map[int]int, d *Decoder) {
- v, changed := f.DecMapIntIntV(*vp, true, d)
- if changed {
+func (f fastpathT) DecSliceStringX(vp *[]string, d *Decoder) {
+ if v, changed := f.DecSliceStringV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapIntIntV(v map[int]int, canChange bool,
- d *Decoder) (_ map[int]int, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[int]int, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
+func (fastpathT) DecSliceStringV(v []string, canChange bool, d *Decoder) (_ []string, changed bool) {
+ slh, containerLenS := d.decSliceHelperStart()
+ if containerLenS == 0 {
+ if canChange {
+ if v == nil {
+ v = []string{}
+ } else if len(v) != 0 {
+ v = v[:0]
+ }
+ changed = true
+ }
+ slh.End()
return v, changed
}
- d.depthIncr()
- var mk int
- var mv int
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
+ hasLen := containerLenS > 0
+ var xlen int
+ if hasLen && canChange {
+ if containerLenS > cap(v) {
+ xlen = decInferLen(containerLenS, d.h.MaxInitLen, 16)
+ if xlen <= cap(v) {
+ v = v[:uint(xlen)]
+ } else {
+ v = make([]string, uint(xlen))
+ }
+ changed = true
+ } else if containerLenS != len(v) {
+ v = v[:containerLenS]
+ changed = true
}
- mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize))
- if esep {
- dd.ReadMapElemValue()
+ }
+ var j int
+ for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.d.CheckBreak()); j++ {
+ if j == 0 && len(v) == 0 && canChange {
+ if hasLen {
+ xlen = decInferLen(containerLenS, d.h.MaxInitLen, 16)
+ } else {
+ xlen = 8
+ }
+ v = make([]string, uint(xlen))
+ changed = true
}
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
+ var decodeIntoBlank bool
+ if j >= len(v) {
+ if canChange {
+ v = append(v, "")
+ changed = true
} else {
- v[mk] = 0
+ d.arrayCannotExpand(len(v), j+1)
+ decodeIntoBlank = true
}
- continue
}
- mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize))
- if v != nil {
- v[mk] = mv
+ slh.ElemContainerState(j)
+ if decodeIntoBlank {
+ d.swallow()
+ } else if d.d.TryDecodeAsNil() {
+ v[uint(j)] = ""
+ } else {
+ v[uint(j)] = d.d.DecodeString()
+ }
+ }
+ if canChange {
+ if j < len(v) {
+ v = v[:uint(j)]
+ changed = true
+ } else if j == 0 && v == nil {
+ v = make([]string, 0)
+ changed = true
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ slh.End()
return v, changed
}
-func (d *Decoder) fastpathDecMapIntInt8R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int]int8)
- v, changed := fastpathTV.DecMapIntInt8V(*vp, true, d)
- if changed {
+func (d *Decoder) fastpathDecSliceBytesR(f *codecFnInfo, rv reflect.Value) {
+ if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr {
+ vp := rv2i(rv).(*[][]byte)
+ if v, changed := fastpathTV.DecSliceBytesV(*vp, !array, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapIntInt8V(rv2i(rv).(map[int]int8), false, d)
+ v := rv2i(rv).([][]byte)
+ v2, changed := fastpathTV.DecSliceBytesV(v, !array, d)
+ if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
+ copy(v, v2)
+ }
}
}
-func (f fastpathT) DecMapIntInt8X(vp *map[int]int8, d *Decoder) {
- v, changed := f.DecMapIntInt8V(*vp, true, d)
- if changed {
+func (f fastpathT) DecSliceBytesX(vp *[][]byte, d *Decoder) {
+ if v, changed := f.DecSliceBytesV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapIntInt8V(v map[int]int8, canChange bool,
- d *Decoder) (_ map[int]int8, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[int]int8, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
+func (fastpathT) DecSliceBytesV(v [][]byte, canChange bool, d *Decoder) (_ [][]byte, changed bool) {
+ slh, containerLenS := d.decSliceHelperStart()
+ if containerLenS == 0 {
+ if canChange {
+ if v == nil {
+ v = [][]byte{}
+ } else if len(v) != 0 {
+ v = v[:0]
+ }
+ changed = true
+ }
+ slh.End()
return v, changed
}
- d.depthIncr()
- var mk int
- var mv int8
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
+ hasLen := containerLenS > 0
+ var xlen int
+ if hasLen && canChange {
+ if containerLenS > cap(v) {
+ xlen = decInferLen(containerLenS, d.h.MaxInitLen, 24)
+ if xlen <= cap(v) {
+ v = v[:uint(xlen)]
+ } else {
+ v = make([][]byte, uint(xlen))
+ }
+ changed = true
+ } else if containerLenS != len(v) {
+ v = v[:containerLenS]
+ changed = true
}
- mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize))
- if esep {
- dd.ReadMapElemValue()
+ }
+ var j int
+ for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.d.CheckBreak()); j++ {
+ if j == 0 && len(v) == 0 && canChange {
+ if hasLen {
+ xlen = decInferLen(containerLenS, d.h.MaxInitLen, 24)
+ } else {
+ xlen = 8
+ }
+ v = make([][]byte, uint(xlen))
+ changed = true
}
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
+ var decodeIntoBlank bool
+ if j >= len(v) {
+ if canChange {
+ v = append(v, nil)
+ changed = true
} else {
- v[mk] = 0
+ d.arrayCannotExpand(len(v), j+1)
+ decodeIntoBlank = true
}
- continue
}
- mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8))
- if v != nil {
- v[mk] = mv
+ slh.ElemContainerState(j)
+ if decodeIntoBlank {
+ d.swallow()
+ } else if d.d.TryDecodeAsNil() {
+ v[uint(j)] = nil
+ } else {
+ v[uint(j)] = d.d.DecodeBytes(nil, false)
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ if canChange {
+ if j < len(v) {
+ v = v[:uint(j)]
+ changed = true
+ } else if j == 0 && v == nil {
+ v = make([][]byte, 0)
+ changed = true
+ }
+ }
+ slh.End()
return v, changed
}
-func (d *Decoder) fastpathDecMapIntInt16R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int]int16)
- v, changed := fastpathTV.DecMapIntInt16V(*vp, true, d)
- if changed {
+func (d *Decoder) fastpathDecSliceFloat32R(f *codecFnInfo, rv reflect.Value) {
+ if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr {
+ vp := rv2i(rv).(*[]float32)
+ if v, changed := fastpathTV.DecSliceFloat32V(*vp, !array, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapIntInt16V(rv2i(rv).(map[int]int16), false, d)
+ v := rv2i(rv).([]float32)
+ v2, changed := fastpathTV.DecSliceFloat32V(v, !array, d)
+ if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
+ copy(v, v2)
+ }
}
}
-func (f fastpathT) DecMapIntInt16X(vp *map[int]int16, d *Decoder) {
- v, changed := f.DecMapIntInt16V(*vp, true, d)
- if changed {
+func (f fastpathT) DecSliceFloat32X(vp *[]float32, d *Decoder) {
+ if v, changed := f.DecSliceFloat32V(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapIntInt16V(v map[int]int16, canChange bool,
- d *Decoder) (_ map[int]int16, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[int]int16, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
+func (fastpathT) DecSliceFloat32V(v []float32, canChange bool, d *Decoder) (_ []float32, changed bool) {
+ slh, containerLenS := d.decSliceHelperStart()
+ if containerLenS == 0 {
+ if canChange {
+ if v == nil {
+ v = []float32{}
+ } else if len(v) != 0 {
+ v = v[:0]
+ }
+ changed = true
+ }
+ slh.End()
return v, changed
}
- d.depthIncr()
- var mk int
- var mv int16
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
+ hasLen := containerLenS > 0
+ var xlen int
+ if hasLen && canChange {
+ if containerLenS > cap(v) {
+ xlen = decInferLen(containerLenS, d.h.MaxInitLen, 4)
+ if xlen <= cap(v) {
+ v = v[:uint(xlen)]
+ } else {
+ v = make([]float32, uint(xlen))
+ }
+ changed = true
+ } else if containerLenS != len(v) {
+ v = v[:containerLenS]
+ changed = true
}
- mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize))
- if esep {
- dd.ReadMapElemValue()
+ }
+ var j int
+ for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.d.CheckBreak()); j++ {
+ if j == 0 && len(v) == 0 && canChange {
+ if hasLen {
+ xlen = decInferLen(containerLenS, d.h.MaxInitLen, 4)
+ } else {
+ xlen = 8
+ }
+ v = make([]float32, uint(xlen))
+ changed = true
}
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
+ var decodeIntoBlank bool
+ if j >= len(v) {
+ if canChange {
+ v = append(v, 0)
+ changed = true
} else {
- v[mk] = 0
+ d.arrayCannotExpand(len(v), j+1)
+ decodeIntoBlank = true
}
- continue
}
- mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16))
- if v != nil {
- v[mk] = mv
+ slh.ElemContainerState(j)
+ if decodeIntoBlank {
+ d.swallow()
+ } else if d.d.TryDecodeAsNil() {
+ v[uint(j)] = 0
+ } else {
+ v[uint(j)] = float32(d.decodeFloat32())
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ if canChange {
+ if j < len(v) {
+ v = v[:uint(j)]
+ changed = true
+ } else if j == 0 && v == nil {
+ v = make([]float32, 0)
+ changed = true
+ }
+ }
+ slh.End()
return v, changed
}
-func (d *Decoder) fastpathDecMapIntInt32R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int]int32)
- v, changed := fastpathTV.DecMapIntInt32V(*vp, true, d)
- if changed {
+func (d *Decoder) fastpathDecSliceFloat64R(f *codecFnInfo, rv reflect.Value) {
+ if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr {
+ vp := rv2i(rv).(*[]float64)
+ if v, changed := fastpathTV.DecSliceFloat64V(*vp, !array, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapIntInt32V(rv2i(rv).(map[int]int32), false, d)
+ v := rv2i(rv).([]float64)
+ v2, changed := fastpathTV.DecSliceFloat64V(v, !array, d)
+ if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
+ copy(v, v2)
+ }
}
}
-func (f fastpathT) DecMapIntInt32X(vp *map[int]int32, d *Decoder) {
- v, changed := f.DecMapIntInt32V(*vp, true, d)
- if changed {
+func (f fastpathT) DecSliceFloat64X(vp *[]float64, d *Decoder) {
+ if v, changed := f.DecSliceFloat64V(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapIntInt32V(v map[int]int32, canChange bool,
- d *Decoder) (_ map[int]int32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[int]int32, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
+func (fastpathT) DecSliceFloat64V(v []float64, canChange bool, d *Decoder) (_ []float64, changed bool) {
+ slh, containerLenS := d.decSliceHelperStart()
+ if containerLenS == 0 {
+ if canChange {
+ if v == nil {
+ v = []float64{}
+ } else if len(v) != 0 {
+ v = v[:0]
+ }
+ changed = true
+ }
+ slh.End()
return v, changed
}
- d.depthIncr()
- var mk int
- var mv int32
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
+ hasLen := containerLenS > 0
+ var xlen int
+ if hasLen && canChange {
+ if containerLenS > cap(v) {
+ xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8)
+ if xlen <= cap(v) {
+ v = v[:uint(xlen)]
+ } else {
+ v = make([]float64, uint(xlen))
+ }
+ changed = true
+ } else if containerLenS != len(v) {
+ v = v[:containerLenS]
+ changed = true
}
- mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize))
- if esep {
- dd.ReadMapElemValue()
+ }
+ var j int
+ for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.d.CheckBreak()); j++ {
+ if j == 0 && len(v) == 0 && canChange {
+ if hasLen {
+ xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8)
+ } else {
+ xlen = 8
+ }
+ v = make([]float64, uint(xlen))
+ changed = true
}
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
+ var decodeIntoBlank bool
+ if j >= len(v) {
+ if canChange {
+ v = append(v, 0)
+ changed = true
} else {
- v[mk] = 0
+ d.arrayCannotExpand(len(v), j+1)
+ decodeIntoBlank = true
}
- continue
}
- mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32))
- if v != nil {
- v[mk] = mv
+ slh.ElemContainerState(j)
+ if decodeIntoBlank {
+ d.swallow()
+ } else if d.d.TryDecodeAsNil() {
+ v[uint(j)] = 0
+ } else {
+ v[uint(j)] = d.d.DecodeFloat64()
+ }
+ }
+ if canChange {
+ if j < len(v) {
+ v = v[:uint(j)]
+ changed = true
+ } else if j == 0 && v == nil {
+ v = make([]float64, 0)
+ changed = true
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ slh.End()
return v, changed
}
-func (d *Decoder) fastpathDecMapIntInt64R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int]int64)
- v, changed := fastpathTV.DecMapIntInt64V(*vp, true, d)
- if changed {
+func (d *Decoder) fastpathDecSliceUintR(f *codecFnInfo, rv reflect.Value) {
+ if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr {
+ vp := rv2i(rv).(*[]uint)
+ if v, changed := fastpathTV.DecSliceUintV(*vp, !array, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapIntInt64V(rv2i(rv).(map[int]int64), false, d)
+ v := rv2i(rv).([]uint)
+ v2, changed := fastpathTV.DecSliceUintV(v, !array, d)
+ if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
+ copy(v, v2)
+ }
}
}
-func (f fastpathT) DecMapIntInt64X(vp *map[int]int64, d *Decoder) {
- v, changed := f.DecMapIntInt64V(*vp, true, d)
- if changed {
+func (f fastpathT) DecSliceUintX(vp *[]uint, d *Decoder) {
+ if v, changed := f.DecSliceUintV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapIntInt64V(v map[int]int64, canChange bool,
- d *Decoder) (_ map[int]int64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[int]int64, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
+func (fastpathT) DecSliceUintV(v []uint, canChange bool, d *Decoder) (_ []uint, changed bool) {
+ slh, containerLenS := d.decSliceHelperStart()
+ if containerLenS == 0 {
+ if canChange {
+ if v == nil {
+ v = []uint{}
+ } else if len(v) != 0 {
+ v = v[:0]
+ }
+ changed = true
+ }
+ slh.End()
return v, changed
}
- d.depthIncr()
- var mk int
- var mv int64
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
+ hasLen := containerLenS > 0
+ var xlen int
+ if hasLen && canChange {
+ if containerLenS > cap(v) {
+ xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8)
+ if xlen <= cap(v) {
+ v = v[:uint(xlen)]
+ } else {
+ v = make([]uint, uint(xlen))
+ }
+ changed = true
+ } else if containerLenS != len(v) {
+ v = v[:containerLenS]
+ changed = true
}
- mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize))
- if esep {
- dd.ReadMapElemValue()
+ }
+ var j int
+ for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.d.CheckBreak()); j++ {
+ if j == 0 && len(v) == 0 && canChange {
+ if hasLen {
+ xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8)
+ } else {
+ xlen = 8
+ }
+ v = make([]uint, uint(xlen))
+ changed = true
}
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
+ var decodeIntoBlank bool
+ if j >= len(v) {
+ if canChange {
+ v = append(v, 0)
+ changed = true
} else {
- v[mk] = 0
+ d.arrayCannotExpand(len(v), j+1)
+ decodeIntoBlank = true
}
- continue
}
- mv = dd.DecodeInt64()
- if v != nil {
- v[mk] = mv
+ slh.ElemContainerState(j)
+ if decodeIntoBlank {
+ d.swallow()
+ } else if d.d.TryDecodeAsNil() {
+ v[uint(j)] = 0
+ } else {
+ v[uint(j)] = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize))
+ }
+ }
+ if canChange {
+ if j < len(v) {
+ v = v[:uint(j)]
+ changed = true
+ } else if j == 0 && v == nil {
+ v = make([]uint, 0)
+ changed = true
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ slh.End()
return v, changed
}
-func (d *Decoder) fastpathDecMapIntFloat32R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int]float32)
- v, changed := fastpathTV.DecMapIntFloat32V(*vp, true, d)
- if changed {
+func (d *Decoder) fastpathDecSliceUint8R(f *codecFnInfo, rv reflect.Value) {
+ if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr {
+ vp := rv2i(rv).(*[]uint8)
+ if v, changed := fastpathTV.DecSliceUint8V(*vp, !array, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapIntFloat32V(rv2i(rv).(map[int]float32), false, d)
+ v := rv2i(rv).([]uint8)
+ v2, changed := fastpathTV.DecSliceUint8V(v, !array, d)
+ if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
+ copy(v, v2)
+ }
}
}
-func (f fastpathT) DecMapIntFloat32X(vp *map[int]float32, d *Decoder) {
- v, changed := f.DecMapIntFloat32V(*vp, true, d)
- if changed {
+func (f fastpathT) DecSliceUint8X(vp *[]uint8, d *Decoder) {
+ if v, changed := f.DecSliceUint8V(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapIntFloat32V(v map[int]float32, canChange bool,
- d *Decoder) (_ map[int]float32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[int]float32, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
+func (fastpathT) DecSliceUint8V(v []uint8, canChange bool, d *Decoder) (_ []uint8, changed bool) {
+ slh, containerLenS := d.decSliceHelperStart()
+ if containerLenS == 0 {
+ if canChange {
+ if v == nil {
+ v = []uint8{}
+ } else if len(v) != 0 {
+ v = v[:0]
+ }
+ changed = true
+ }
+ slh.End()
return v, changed
}
- d.depthIncr()
- var mk int
- var mv float32
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
+ hasLen := containerLenS > 0
+ var xlen int
+ if hasLen && canChange {
+ if containerLenS > cap(v) {
+ xlen = decInferLen(containerLenS, d.h.MaxInitLen, 1)
+ if xlen <= cap(v) {
+ v = v[:uint(xlen)]
+ } else {
+ v = make([]uint8, uint(xlen))
+ }
+ changed = true
+ } else if containerLenS != len(v) {
+ v = v[:containerLenS]
+ changed = true
}
- mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize))
- if esep {
- dd.ReadMapElemValue()
+ }
+ var j int
+ for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.d.CheckBreak()); j++ {
+ if j == 0 && len(v) == 0 && canChange {
+ if hasLen {
+ xlen = decInferLen(containerLenS, d.h.MaxInitLen, 1)
+ } else {
+ xlen = 8
+ }
+ v = make([]uint8, uint(xlen))
+ changed = true
}
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
+ var decodeIntoBlank bool
+ if j >= len(v) {
+ if canChange {
+ v = append(v, 0)
+ changed = true
} else {
- v[mk] = 0
+ d.arrayCannotExpand(len(v), j+1)
+ decodeIntoBlank = true
}
- continue
}
- mv = float32(chkOvf.Float32V(dd.DecodeFloat64()))
- if v != nil {
- v[mk] = mv
+ slh.ElemContainerState(j)
+ if decodeIntoBlank {
+ d.swallow()
+ } else if d.d.TryDecodeAsNil() {
+ v[uint(j)] = 0
+ } else {
+ v[uint(j)] = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8))
+ }
+ }
+ if canChange {
+ if j < len(v) {
+ v = v[:uint(j)]
+ changed = true
+ } else if j == 0 && v == nil {
+ v = make([]uint8, 0)
+ changed = true
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ slh.End()
return v, changed
}
-func (d *Decoder) fastpathDecMapIntFloat64R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int]float64)
- v, changed := fastpathTV.DecMapIntFloat64V(*vp, true, d)
- if changed {
+func (d *Decoder) fastpathDecSliceUint16R(f *codecFnInfo, rv reflect.Value) {
+ if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr {
+ vp := rv2i(rv).(*[]uint16)
+ if v, changed := fastpathTV.DecSliceUint16V(*vp, !array, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapIntFloat64V(rv2i(rv).(map[int]float64), false, d)
+ v := rv2i(rv).([]uint16)
+ v2, changed := fastpathTV.DecSliceUint16V(v, !array, d)
+ if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
+ copy(v, v2)
+ }
}
}
-func (f fastpathT) DecMapIntFloat64X(vp *map[int]float64, d *Decoder) {
- v, changed := f.DecMapIntFloat64V(*vp, true, d)
- if changed {
+func (f fastpathT) DecSliceUint16X(vp *[]uint16, d *Decoder) {
+ if v, changed := f.DecSliceUint16V(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapIntFloat64V(v map[int]float64, canChange bool,
- d *Decoder) (_ map[int]float64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[int]float64, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
+func (fastpathT) DecSliceUint16V(v []uint16, canChange bool, d *Decoder) (_ []uint16, changed bool) {
+ slh, containerLenS := d.decSliceHelperStart()
+ if containerLenS == 0 {
+ if canChange {
+ if v == nil {
+ v = []uint16{}
+ } else if len(v) != 0 {
+ v = v[:0]
+ }
+ changed = true
+ }
+ slh.End()
return v, changed
}
- d.depthIncr()
- var mk int
- var mv float64
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
+ hasLen := containerLenS > 0
+ var xlen int
+ if hasLen && canChange {
+ if containerLenS > cap(v) {
+ xlen = decInferLen(containerLenS, d.h.MaxInitLen, 2)
+ if xlen <= cap(v) {
+ v = v[:uint(xlen)]
+ } else {
+ v = make([]uint16, uint(xlen))
+ }
+ changed = true
+ } else if containerLenS != len(v) {
+ v = v[:containerLenS]
+ changed = true
}
- mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize))
- if esep {
- dd.ReadMapElemValue()
+ }
+ var j int
+ for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.d.CheckBreak()); j++ {
+ if j == 0 && len(v) == 0 && canChange {
+ if hasLen {
+ xlen = decInferLen(containerLenS, d.h.MaxInitLen, 2)
+ } else {
+ xlen = 8
+ }
+ v = make([]uint16, uint(xlen))
+ changed = true
}
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
+ var decodeIntoBlank bool
+ if j >= len(v) {
+ if canChange {
+ v = append(v, 0)
+ changed = true
} else {
- v[mk] = 0
+ d.arrayCannotExpand(len(v), j+1)
+ decodeIntoBlank = true
}
- continue
}
- mv = dd.DecodeFloat64()
- if v != nil {
- v[mk] = mv
+ slh.ElemContainerState(j)
+ if decodeIntoBlank {
+ d.swallow()
+ } else if d.d.TryDecodeAsNil() {
+ v[uint(j)] = 0
+ } else {
+ v[uint(j)] = uint16(chkOvf.UintV(d.d.DecodeUint64(), 16))
+ }
+ }
+ if canChange {
+ if j < len(v) {
+ v = v[:uint(j)]
+ changed = true
+ } else if j == 0 && v == nil {
+ v = make([]uint16, 0)
+ changed = true
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ slh.End()
return v, changed
}
-func (d *Decoder) fastpathDecMapIntBoolR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int]bool)
- v, changed := fastpathTV.DecMapIntBoolV(*vp, true, d)
- if changed {
+func (d *Decoder) fastpathDecSliceUint32R(f *codecFnInfo, rv reflect.Value) {
+ if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr {
+ vp := rv2i(rv).(*[]uint32)
+ if v, changed := fastpathTV.DecSliceUint32V(*vp, !array, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapIntBoolV(rv2i(rv).(map[int]bool), false, d)
+ v := rv2i(rv).([]uint32)
+ v2, changed := fastpathTV.DecSliceUint32V(v, !array, d)
+ if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
+ copy(v, v2)
+ }
}
}
-func (f fastpathT) DecMapIntBoolX(vp *map[int]bool, d *Decoder) {
- v, changed := f.DecMapIntBoolV(*vp, true, d)
- if changed {
+func (f fastpathT) DecSliceUint32X(vp *[]uint32, d *Decoder) {
+ if v, changed := f.DecSliceUint32V(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapIntBoolV(v map[int]bool, canChange bool,
- d *Decoder) (_ map[int]bool, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[int]bool, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
+func (fastpathT) DecSliceUint32V(v []uint32, canChange bool, d *Decoder) (_ []uint32, changed bool) {
+ slh, containerLenS := d.decSliceHelperStart()
+ if containerLenS == 0 {
+ if canChange {
+ if v == nil {
+ v = []uint32{}
+ } else if len(v) != 0 {
+ v = v[:0]
+ }
+ changed = true
+ }
+ slh.End()
return v, changed
}
- d.depthIncr()
- var mk int
- var mv bool
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
+ hasLen := containerLenS > 0
+ var xlen int
+ if hasLen && canChange {
+ if containerLenS > cap(v) {
+ xlen = decInferLen(containerLenS, d.h.MaxInitLen, 4)
+ if xlen <= cap(v) {
+ v = v[:uint(xlen)]
+ } else {
+ v = make([]uint32, uint(xlen))
+ }
+ changed = true
+ } else if containerLenS != len(v) {
+ v = v[:containerLenS]
+ changed = true
}
- mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize))
- if esep {
- dd.ReadMapElemValue()
+ }
+ var j int
+ for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.d.CheckBreak()); j++ {
+ if j == 0 && len(v) == 0 && canChange {
+ if hasLen {
+ xlen = decInferLen(containerLenS, d.h.MaxInitLen, 4)
+ } else {
+ xlen = 8
+ }
+ v = make([]uint32, uint(xlen))
+ changed = true
}
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
+ var decodeIntoBlank bool
+ if j >= len(v) {
+ if canChange {
+ v = append(v, 0)
+ changed = true
} else {
- v[mk] = false
+ d.arrayCannotExpand(len(v), j+1)
+ decodeIntoBlank = true
}
- continue
}
- mv = dd.DecodeBool()
- if v != nil {
- v[mk] = mv
+ slh.ElemContainerState(j)
+ if decodeIntoBlank {
+ d.swallow()
+ } else if d.d.TryDecodeAsNil() {
+ v[uint(j)] = 0
+ } else {
+ v[uint(j)] = uint32(chkOvf.UintV(d.d.DecodeUint64(), 32))
+ }
+ }
+ if canChange {
+ if j < len(v) {
+ v = v[:uint(j)]
+ changed = true
+ } else if j == 0 && v == nil {
+ v = make([]uint32, 0)
+ changed = true
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ slh.End()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt8IntfR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int8]interface{})
- v, changed := fastpathTV.DecMapInt8IntfV(*vp, true, d)
- if changed {
+func (d *Decoder) fastpathDecSliceUint64R(f *codecFnInfo, rv reflect.Value) {
+ if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr {
+ vp := rv2i(rv).(*[]uint64)
+ if v, changed := fastpathTV.DecSliceUint64V(*vp, !array, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt8IntfV(rv2i(rv).(map[int8]interface{}), false, d)
+ v := rv2i(rv).([]uint64)
+ v2, changed := fastpathTV.DecSliceUint64V(v, !array, d)
+ if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
+ copy(v, v2)
+ }
}
}
-func (f fastpathT) DecMapInt8IntfX(vp *map[int8]interface{}, d *Decoder) {
- v, changed := f.DecMapInt8IntfV(*vp, true, d)
- if changed {
+func (f fastpathT) DecSliceUint64X(vp *[]uint64, d *Decoder) {
+ if v, changed := f.DecSliceUint64V(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt8IntfV(v map[int8]interface{}, canChange bool,
- d *Decoder) (_ map[int8]interface{}, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 17)
- v = make(map[int8]interface{}, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
+func (fastpathT) DecSliceUint64V(v []uint64, canChange bool, d *Decoder) (_ []uint64, changed bool) {
+ slh, containerLenS := d.decSliceHelperStart()
+ if containerLenS == 0 {
+ if canChange {
+ if v == nil {
+ v = []uint64{}
+ } else if len(v) != 0 {
+ v = v[:0]
+ }
+ changed = true
+ }
+ slh.End()
return v, changed
}
- d.depthIncr()
- mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset
- var mk int8
- var mv interface{}
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
+ hasLen := containerLenS > 0
+ var xlen int
+ if hasLen && canChange {
+ if containerLenS > cap(v) {
+ xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8)
+ if xlen <= cap(v) {
+ v = v[:uint(xlen)]
+ } else {
+ v = make([]uint64, uint(xlen))
+ }
+ changed = true
+ } else if containerLenS != len(v) {
+ v = v[:containerLenS]
+ changed = true
}
- mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8))
- if esep {
- dd.ReadMapElemValue()
+ }
+ var j int
+ for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.d.CheckBreak()); j++ {
+ if j == 0 && len(v) == 0 && canChange {
+ if hasLen {
+ xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8)
+ } else {
+ xlen = 8
+ }
+ v = make([]uint64, uint(xlen))
+ changed = true
}
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
+ var decodeIntoBlank bool
+ if j >= len(v) {
+ if canChange {
+ v = append(v, 0)
+ changed = true
} else {
- v[mk] = nil
+ d.arrayCannotExpand(len(v), j+1)
+ decodeIntoBlank = true
}
- continue
}
- if mapGet {
- mv = v[mk]
+ slh.ElemContainerState(j)
+ if decodeIntoBlank {
+ d.swallow()
+ } else if d.d.TryDecodeAsNil() {
+ v[uint(j)] = 0
} else {
- mv = nil
+ v[uint(j)] = d.d.DecodeUint64()
}
- d.decode(&mv)
- if v != nil {
- v[mk] = mv
+ }
+ if canChange {
+ if j < len(v) {
+ v = v[:uint(j)]
+ changed = true
+ } else if j == 0 && v == nil {
+ v = make([]uint64, 0)
+ changed = true
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ slh.End()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt8StringR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int8]string)
- v, changed := fastpathTV.DecMapInt8StringV(*vp, true, d)
- if changed {
+func (d *Decoder) fastpathDecSliceUintptrR(f *codecFnInfo, rv reflect.Value) {
+ if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr {
+ vp := rv2i(rv).(*[]uintptr)
+ if v, changed := fastpathTV.DecSliceUintptrV(*vp, !array, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt8StringV(rv2i(rv).(map[int8]string), false, d)
+ v := rv2i(rv).([]uintptr)
+ v2, changed := fastpathTV.DecSliceUintptrV(v, !array, d)
+ if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
+ copy(v, v2)
+ }
}
}
-func (f fastpathT) DecMapInt8StringX(vp *map[int8]string, d *Decoder) {
- v, changed := f.DecMapInt8StringV(*vp, true, d)
- if changed {
+func (f fastpathT) DecSliceUintptrX(vp *[]uintptr, d *Decoder) {
+ if v, changed := f.DecSliceUintptrV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt8StringV(v map[int8]string, canChange bool,
- d *Decoder) (_ map[int8]string, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 17)
- v = make(map[int8]string, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
+func (fastpathT) DecSliceUintptrV(v []uintptr, canChange bool, d *Decoder) (_ []uintptr, changed bool) {
+ slh, containerLenS := d.decSliceHelperStart()
+ if containerLenS == 0 {
+ if canChange {
+ if v == nil {
+ v = []uintptr{}
+ } else if len(v) != 0 {
+ v = v[:0]
+ }
+ changed = true
+ }
+ slh.End()
return v, changed
}
- d.depthIncr()
- var mk int8
- var mv string
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
+ hasLen := containerLenS > 0
+ var xlen int
+ if hasLen && canChange {
+ if containerLenS > cap(v) {
+ xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8)
+ if xlen <= cap(v) {
+ v = v[:uint(xlen)]
+ } else {
+ v = make([]uintptr, uint(xlen))
+ }
+ changed = true
+ } else if containerLenS != len(v) {
+ v = v[:containerLenS]
+ changed = true
}
- mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8))
- if esep {
- dd.ReadMapElemValue()
+ }
+ var j int
+ for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.d.CheckBreak()); j++ {
+ if j == 0 && len(v) == 0 && canChange {
+ if hasLen {
+ xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8)
+ } else {
+ xlen = 8
+ }
+ v = make([]uintptr, uint(xlen))
+ changed = true
}
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
+ var decodeIntoBlank bool
+ if j >= len(v) {
+ if canChange {
+ v = append(v, 0)
+ changed = true
} else {
- v[mk] = ""
+ d.arrayCannotExpand(len(v), j+1)
+ decodeIntoBlank = true
}
- continue
}
- mv = dd.DecodeString()
- if v != nil {
- v[mk] = mv
+ slh.ElemContainerState(j)
+ if decodeIntoBlank {
+ d.swallow()
+ } else if d.d.TryDecodeAsNil() {
+ v[uint(j)] = 0
+ } else {
+ v[uint(j)] = uintptr(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize))
+ }
+ }
+ if canChange {
+ if j < len(v) {
+ v = v[:uint(j)]
+ changed = true
+ } else if j == 0 && v == nil {
+ v = make([]uintptr, 0)
+ changed = true
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ slh.End()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt8UintR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int8]uint)
- v, changed := fastpathTV.DecMapInt8UintV(*vp, true, d)
- if changed {
+func (d *Decoder) fastpathDecSliceIntR(f *codecFnInfo, rv reflect.Value) {
+ if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr {
+ vp := rv2i(rv).(*[]int)
+ if v, changed := fastpathTV.DecSliceIntV(*vp, !array, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt8UintV(rv2i(rv).(map[int8]uint), false, d)
+ v := rv2i(rv).([]int)
+ v2, changed := fastpathTV.DecSliceIntV(v, !array, d)
+ if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
+ copy(v, v2)
+ }
}
}
-func (f fastpathT) DecMapInt8UintX(vp *map[int8]uint, d *Decoder) {
- v, changed := f.DecMapInt8UintV(*vp, true, d)
- if changed {
+func (f fastpathT) DecSliceIntX(vp *[]int, d *Decoder) {
+ if v, changed := f.DecSliceIntV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt8UintV(v map[int8]uint, canChange bool,
- d *Decoder) (_ map[int8]uint, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[int8]uint, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
+func (fastpathT) DecSliceIntV(v []int, canChange bool, d *Decoder) (_ []int, changed bool) {
+ slh, containerLenS := d.decSliceHelperStart()
+ if containerLenS == 0 {
+ if canChange {
+ if v == nil {
+ v = []int{}
+ } else if len(v) != 0 {
+ v = v[:0]
+ }
+ changed = true
+ }
+ slh.End()
return v, changed
}
- d.depthIncr()
- var mk int8
- var mv uint
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
+ hasLen := containerLenS > 0
+ var xlen int
+ if hasLen && canChange {
+ if containerLenS > cap(v) {
+ xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8)
+ if xlen <= cap(v) {
+ v = v[:uint(xlen)]
+ } else {
+ v = make([]int, uint(xlen))
+ }
+ changed = true
+ } else if containerLenS != len(v) {
+ v = v[:containerLenS]
+ changed = true
}
- mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8))
- if esep {
- dd.ReadMapElemValue()
+ }
+ var j int
+ for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.d.CheckBreak()); j++ {
+ if j == 0 && len(v) == 0 && canChange {
+ if hasLen {
+ xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8)
+ } else {
+ xlen = 8
+ }
+ v = make([]int, uint(xlen))
+ changed = true
}
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
+ var decodeIntoBlank bool
+ if j >= len(v) {
+ if canChange {
+ v = append(v, 0)
+ changed = true
} else {
- v[mk] = 0
+ d.arrayCannotExpand(len(v), j+1)
+ decodeIntoBlank = true
}
- continue
}
- mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if v != nil {
- v[mk] = mv
+ slh.ElemContainerState(j)
+ if decodeIntoBlank {
+ d.swallow()
+ } else if d.d.TryDecodeAsNil() {
+ v[uint(j)] = 0
+ } else {
+ v[uint(j)] = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize))
+ }
+ }
+ if canChange {
+ if j < len(v) {
+ v = v[:uint(j)]
+ changed = true
+ } else if j == 0 && v == nil {
+ v = make([]int, 0)
+ changed = true
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ slh.End()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt8Uint8R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int8]uint8)
- v, changed := fastpathTV.DecMapInt8Uint8V(*vp, true, d)
- if changed {
+func (d *Decoder) fastpathDecSliceInt8R(f *codecFnInfo, rv reflect.Value) {
+ if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr {
+ vp := rv2i(rv).(*[]int8)
+ if v, changed := fastpathTV.DecSliceInt8V(*vp, !array, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt8Uint8V(rv2i(rv).(map[int8]uint8), false, d)
+ v := rv2i(rv).([]int8)
+ v2, changed := fastpathTV.DecSliceInt8V(v, !array, d)
+ if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
+ copy(v, v2)
+ }
}
}
-func (f fastpathT) DecMapInt8Uint8X(vp *map[int8]uint8, d *Decoder) {
- v, changed := f.DecMapInt8Uint8V(*vp, true, d)
- if changed {
+func (f fastpathT) DecSliceInt8X(vp *[]int8, d *Decoder) {
+ if v, changed := f.DecSliceInt8V(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt8Uint8V(v map[int8]uint8, canChange bool,
- d *Decoder) (_ map[int8]uint8, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 2)
- v = make(map[int8]uint8, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
+func (fastpathT) DecSliceInt8V(v []int8, canChange bool, d *Decoder) (_ []int8, changed bool) {
+ slh, containerLenS := d.decSliceHelperStart()
+ if containerLenS == 0 {
+ if canChange {
+ if v == nil {
+ v = []int8{}
+ } else if len(v) != 0 {
+ v = v[:0]
+ }
+ changed = true
+ }
+ slh.End()
return v, changed
}
- d.depthIncr()
- var mk int8
- var mv uint8
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
+ hasLen := containerLenS > 0
+ var xlen int
+ if hasLen && canChange {
+ if containerLenS > cap(v) {
+ xlen = decInferLen(containerLenS, d.h.MaxInitLen, 1)
+ if xlen <= cap(v) {
+ v = v[:uint(xlen)]
+ } else {
+ v = make([]int8, uint(xlen))
+ }
+ changed = true
+ } else if containerLenS != len(v) {
+ v = v[:containerLenS]
+ changed = true
}
- mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8))
- if esep {
- dd.ReadMapElemValue()
+ }
+ var j int
+ for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.d.CheckBreak()); j++ {
+ if j == 0 && len(v) == 0 && canChange {
+ if hasLen {
+ xlen = decInferLen(containerLenS, d.h.MaxInitLen, 1)
+ } else {
+ xlen = 8
+ }
+ v = make([]int8, uint(xlen))
+ changed = true
}
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
+ var decodeIntoBlank bool
+ if j >= len(v) {
+ if canChange {
+ v = append(v, 0)
+ changed = true
} else {
- v[mk] = 0
+ d.arrayCannotExpand(len(v), j+1)
+ decodeIntoBlank = true
}
- continue
}
- mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8))
- if v != nil {
- v[mk] = mv
+ slh.ElemContainerState(j)
+ if decodeIntoBlank {
+ d.swallow()
+ } else if d.d.TryDecodeAsNil() {
+ v[uint(j)] = 0
+ } else {
+ v[uint(j)] = int8(chkOvf.IntV(d.d.DecodeInt64(), 8))
+ }
+ }
+ if canChange {
+ if j < len(v) {
+ v = v[:uint(j)]
+ changed = true
+ } else if j == 0 && v == nil {
+ v = make([]int8, 0)
+ changed = true
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ slh.End()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt8Uint16R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int8]uint16)
- v, changed := fastpathTV.DecMapInt8Uint16V(*vp, true, d)
- if changed {
+func (d *Decoder) fastpathDecSliceInt16R(f *codecFnInfo, rv reflect.Value) {
+ if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr {
+ vp := rv2i(rv).(*[]int16)
+ if v, changed := fastpathTV.DecSliceInt16V(*vp, !array, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt8Uint16V(rv2i(rv).(map[int8]uint16), false, d)
+ v := rv2i(rv).([]int16)
+ v2, changed := fastpathTV.DecSliceInt16V(v, !array, d)
+ if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
+ copy(v, v2)
+ }
}
}
-func (f fastpathT) DecMapInt8Uint16X(vp *map[int8]uint16, d *Decoder) {
- v, changed := f.DecMapInt8Uint16V(*vp, true, d)
- if changed {
+func (f fastpathT) DecSliceInt16X(vp *[]int16, d *Decoder) {
+ if v, changed := f.DecSliceInt16V(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt8Uint16V(v map[int8]uint16, canChange bool,
- d *Decoder) (_ map[int8]uint16, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 3)
- v = make(map[int8]uint16, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
+func (fastpathT) DecSliceInt16V(v []int16, canChange bool, d *Decoder) (_ []int16, changed bool) {
+ slh, containerLenS := d.decSliceHelperStart()
+ if containerLenS == 0 {
+ if canChange {
+ if v == nil {
+ v = []int16{}
+ } else if len(v) != 0 {
+ v = v[:0]
+ }
+ changed = true
+ }
+ slh.End()
return v, changed
}
- d.depthIncr()
- var mk int8
- var mv uint16
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
+ hasLen := containerLenS > 0
+ var xlen int
+ if hasLen && canChange {
+ if containerLenS > cap(v) {
+ xlen = decInferLen(containerLenS, d.h.MaxInitLen, 2)
+ if xlen <= cap(v) {
+ v = v[:uint(xlen)]
+ } else {
+ v = make([]int16, uint(xlen))
+ }
+ changed = true
+ } else if containerLenS != len(v) {
+ v = v[:containerLenS]
+ changed = true
}
- mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8))
- if esep {
- dd.ReadMapElemValue()
+ }
+ var j int
+ for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.d.CheckBreak()); j++ {
+ if j == 0 && len(v) == 0 && canChange {
+ if hasLen {
+ xlen = decInferLen(containerLenS, d.h.MaxInitLen, 2)
+ } else {
+ xlen = 8
+ }
+ v = make([]int16, uint(xlen))
+ changed = true
}
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
+ var decodeIntoBlank bool
+ if j >= len(v) {
+ if canChange {
+ v = append(v, 0)
+ changed = true
} else {
- v[mk] = 0
+ d.arrayCannotExpand(len(v), j+1)
+ decodeIntoBlank = true
}
- continue
}
- mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16))
- if v != nil {
- v[mk] = mv
+ slh.ElemContainerState(j)
+ if decodeIntoBlank {
+ d.swallow()
+ } else if d.d.TryDecodeAsNil() {
+ v[uint(j)] = 0
+ } else {
+ v[uint(j)] = int16(chkOvf.IntV(d.d.DecodeInt64(), 16))
+ }
+ }
+ if canChange {
+ if j < len(v) {
+ v = v[:uint(j)]
+ changed = true
+ } else if j == 0 && v == nil {
+ v = make([]int16, 0)
+ changed = true
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ slh.End()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt8Uint32R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int8]uint32)
- v, changed := fastpathTV.DecMapInt8Uint32V(*vp, true, d)
- if changed {
+func (d *Decoder) fastpathDecSliceInt32R(f *codecFnInfo, rv reflect.Value) {
+ if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr {
+ vp := rv2i(rv).(*[]int32)
+ if v, changed := fastpathTV.DecSliceInt32V(*vp, !array, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt8Uint32V(rv2i(rv).(map[int8]uint32), false, d)
+ v := rv2i(rv).([]int32)
+ v2, changed := fastpathTV.DecSliceInt32V(v, !array, d)
+ if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
+ copy(v, v2)
+ }
}
}
-func (f fastpathT) DecMapInt8Uint32X(vp *map[int8]uint32, d *Decoder) {
- v, changed := f.DecMapInt8Uint32V(*vp, true, d)
- if changed {
+func (f fastpathT) DecSliceInt32X(vp *[]int32, d *Decoder) {
+ if v, changed := f.DecSliceInt32V(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt8Uint32V(v map[int8]uint32, canChange bool,
- d *Decoder) (_ map[int8]uint32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[int8]uint32, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
+func (fastpathT) DecSliceInt32V(v []int32, canChange bool, d *Decoder) (_ []int32, changed bool) {
+ slh, containerLenS := d.decSliceHelperStart()
+ if containerLenS == 0 {
+ if canChange {
+ if v == nil {
+ v = []int32{}
+ } else if len(v) != 0 {
+ v = v[:0]
+ }
+ changed = true
+ }
+ slh.End()
return v, changed
}
- d.depthIncr()
- var mk int8
- var mv uint32
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
+ hasLen := containerLenS > 0
+ var xlen int
+ if hasLen && canChange {
+ if containerLenS > cap(v) {
+ xlen = decInferLen(containerLenS, d.h.MaxInitLen, 4)
+ if xlen <= cap(v) {
+ v = v[:uint(xlen)]
+ } else {
+ v = make([]int32, uint(xlen))
+ }
+ changed = true
+ } else if containerLenS != len(v) {
+ v = v[:containerLenS]
+ changed = true
}
- mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8))
- if esep {
- dd.ReadMapElemValue()
+ }
+ var j int
+ for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.d.CheckBreak()); j++ {
+ if j == 0 && len(v) == 0 && canChange {
+ if hasLen {
+ xlen = decInferLen(containerLenS, d.h.MaxInitLen, 4)
+ } else {
+ xlen = 8
+ }
+ v = make([]int32, uint(xlen))
+ changed = true
}
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
+ var decodeIntoBlank bool
+ if j >= len(v) {
+ if canChange {
+ v = append(v, 0)
+ changed = true
} else {
- v[mk] = 0
+ d.arrayCannotExpand(len(v), j+1)
+ decodeIntoBlank = true
}
- continue
}
- mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32))
- if v != nil {
- v[mk] = mv
+ slh.ElemContainerState(j)
+ if decodeIntoBlank {
+ d.swallow()
+ } else if d.d.TryDecodeAsNil() {
+ v[uint(j)] = 0
+ } else {
+ v[uint(j)] = int32(chkOvf.IntV(d.d.DecodeInt64(), 32))
+ }
+ }
+ if canChange {
+ if j < len(v) {
+ v = v[:uint(j)]
+ changed = true
+ } else if j == 0 && v == nil {
+ v = make([]int32, 0)
+ changed = true
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ slh.End()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt8Uint64R(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int8]uint64)
- v, changed := fastpathTV.DecMapInt8Uint64V(*vp, true, d)
- if changed {
+func (d *Decoder) fastpathDecSliceInt64R(f *codecFnInfo, rv reflect.Value) {
+ if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr {
+ vp := rv2i(rv).(*[]int64)
+ if v, changed := fastpathTV.DecSliceInt64V(*vp, !array, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt8Uint64V(rv2i(rv).(map[int8]uint64), false, d)
+ v := rv2i(rv).([]int64)
+ v2, changed := fastpathTV.DecSliceInt64V(v, !array, d)
+ if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
+ copy(v, v2)
+ }
}
}
-func (f fastpathT) DecMapInt8Uint64X(vp *map[int8]uint64, d *Decoder) {
- v, changed := f.DecMapInt8Uint64V(*vp, true, d)
- if changed {
+func (f fastpathT) DecSliceInt64X(vp *[]int64, d *Decoder) {
+ if v, changed := f.DecSliceInt64V(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt8Uint64V(v map[int8]uint64, canChange bool,
- d *Decoder) (_ map[int8]uint64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[int8]uint64, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
+func (fastpathT) DecSliceInt64V(v []int64, canChange bool, d *Decoder) (_ []int64, changed bool) {
+ slh, containerLenS := d.decSliceHelperStart()
+ if containerLenS == 0 {
+ if canChange {
+ if v == nil {
+ v = []int64{}
+ } else if len(v) != 0 {
+ v = v[:0]
+ }
+ changed = true
+ }
+ slh.End()
return v, changed
}
- d.depthIncr()
- var mk int8
- var mv uint64
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
+ hasLen := containerLenS > 0
+ var xlen int
+ if hasLen && canChange {
+ if containerLenS > cap(v) {
+ xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8)
+ if xlen <= cap(v) {
+ v = v[:uint(xlen)]
+ } else {
+ v = make([]int64, uint(xlen))
+ }
+ changed = true
+ } else if containerLenS != len(v) {
+ v = v[:containerLenS]
+ changed = true
}
- mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8))
- if esep {
- dd.ReadMapElemValue()
+ }
+ var j int
+ for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.d.CheckBreak()); j++ {
+ if j == 0 && len(v) == 0 && canChange {
+ if hasLen {
+ xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8)
+ } else {
+ xlen = 8
+ }
+ v = make([]int64, uint(xlen))
+ changed = true
}
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
+ var decodeIntoBlank bool
+ if j >= len(v) {
+ if canChange {
+ v = append(v, 0)
+ changed = true
} else {
- v[mk] = 0
+ d.arrayCannotExpand(len(v), j+1)
+ decodeIntoBlank = true
}
- continue
}
- mv = dd.DecodeUint64()
- if v != nil {
- v[mk] = mv
+ slh.ElemContainerState(j)
+ if decodeIntoBlank {
+ d.swallow()
+ } else if d.d.TryDecodeAsNil() {
+ v[uint(j)] = 0
+ } else {
+ v[uint(j)] = d.d.DecodeInt64()
+ }
+ }
+ if canChange {
+ if j < len(v) {
+ v = v[:uint(j)]
+ changed = true
+ } else if j == 0 && v == nil {
+ v = make([]int64, 0)
+ changed = true
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ slh.End()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt8UintptrR(f *codecFnInfo, rv reflect.Value) {
- if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int8]uintptr)
- v, changed := fastpathTV.DecMapInt8UintptrV(*vp, true, d)
- if changed {
+func (d *Decoder) fastpathDecSliceBoolR(f *codecFnInfo, rv reflect.Value) {
+ if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr {
+ vp := rv2i(rv).(*[]bool)
+ if v, changed := fastpathTV.DecSliceBoolV(*vp, !array, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt8UintptrV(rv2i(rv).(map[int8]uintptr), false, d)
+ v := rv2i(rv).([]bool)
+ v2, changed := fastpathTV.DecSliceBoolV(v, !array, d)
+ if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) {
+ copy(v, v2)
+ }
}
}
-func (f fastpathT) DecMapInt8UintptrX(vp *map[int8]uintptr, d *Decoder) {
- v, changed := f.DecMapInt8UintptrV(*vp, true, d)
- if changed {
+func (f fastpathT) DecSliceBoolX(vp *[]bool, d *Decoder) {
+ if v, changed := f.DecSliceBoolV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt8UintptrV(v map[int8]uintptr, canChange bool,
- d *Decoder) (_ map[int8]uintptr, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
- if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[int8]uintptr, xlen)
- changed = true
- }
- if containerLen == 0 {
- dd.ReadMapEnd()
+func (fastpathT) DecSliceBoolV(v []bool, canChange bool, d *Decoder) (_ []bool, changed bool) {
+ slh, containerLenS := d.decSliceHelperStart()
+ if containerLenS == 0 {
+ if canChange {
+ if v == nil {
+ v = []bool{}
+ } else if len(v) != 0 {
+ v = v[:0]
+ }
+ changed = true
+ }
+ slh.End()
return v, changed
}
- d.depthIncr()
- var mk int8
- var mv uintptr
- hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
+ hasLen := containerLenS > 0
+ var xlen int
+ if hasLen && canChange {
+ if containerLenS > cap(v) {
+ xlen = decInferLen(containerLenS, d.h.MaxInitLen, 1)
+ if xlen <= cap(v) {
+ v = v[:uint(xlen)]
+ } else {
+ v = make([]bool, uint(xlen))
+ }
+ changed = true
+ } else if containerLenS != len(v) {
+ v = v[:containerLenS]
+ changed = true
}
- mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8))
- if esep {
- dd.ReadMapElemValue()
+ }
+ var j int
+ for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.d.CheckBreak()); j++ {
+ if j == 0 && len(v) == 0 && canChange {
+ if hasLen {
+ xlen = decInferLen(containerLenS, d.h.MaxInitLen, 1)
+ } else {
+ xlen = 8
+ }
+ v = make([]bool, uint(xlen))
+ changed = true
}
- if dd.TryDecodeAsNil() {
- if v == nil {
- } else if d.h.DeleteOnNilMapValue {
- delete(v, mk)
+ var decodeIntoBlank bool
+ if j >= len(v) {
+ if canChange {
+ v = append(v, false)
+ changed = true
} else {
- v[mk] = 0
+ d.arrayCannotExpand(len(v), j+1)
+ decodeIntoBlank = true
}
- continue
}
- mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
- if v != nil {
- v[mk] = mv
+ slh.ElemContainerState(j)
+ if decodeIntoBlank {
+ d.swallow()
+ } else if d.d.TryDecodeAsNil() {
+ v[uint(j)] = false
+ } else {
+ v[uint(j)] = d.d.DecodeBool()
+ }
+ }
+ if canChange {
+ if j < len(v) {
+ v = v[:uint(j)]
+ changed = true
+ } else if j == 0 && v == nil {
+ v = make([]bool, 0)
+ changed = true
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ slh.End()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt8IntR(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapStringIntfR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int8]int)
- v, changed := fastpathTV.DecMapInt8IntV(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[string]interface{})
+ if v, changed := fastpathTV.DecMapStringIntfV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt8IntV(rv2i(rv).(map[int8]int), false, d)
+ fastpathTV.DecMapStringIntfV(rv2i(rv).(map[string]interface{}), false, d)
}
}
-func (f fastpathT) DecMapInt8IntX(vp *map[int8]int, d *Decoder) {
- v, changed := f.DecMapInt8IntV(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapStringIntfX(vp *map[string]interface{}, d *Decoder) {
+ if v, changed := f.DecMapStringIntfV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt8IntV(v map[int8]int, canChange bool,
- d *Decoder) (_ map[int8]int, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapStringIntfV(v map[string]interface{}, canChange bool,
+ d *Decoder) (_ map[string]interface{}, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[int8]int, xlen)
+ v = make(map[string]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 32))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int8
- var mv int
+ mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset
+ var mk string
+ var mv interface{}
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = d.d.DecodeString()
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
} else {
- v[mk] = 0
+ v[mk] = nil
}
continue
}
- mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize))
+ if mapGet {
+ mv = v[mk]
+ } else {
+ mv = nil
+ }
+ d.decode(&mv)
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt8Int8R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapStringStringR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int8]int8)
- v, changed := fastpathTV.DecMapInt8Int8V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[string]string)
+ if v, changed := fastpathTV.DecMapStringStringV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt8Int8V(rv2i(rv).(map[int8]int8), false, d)
+ fastpathTV.DecMapStringStringV(rv2i(rv).(map[string]string), false, d)
}
}
-func (f fastpathT) DecMapInt8Int8X(vp *map[int8]int8, d *Decoder) {
- v, changed := f.DecMapInt8Int8V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapStringStringX(vp *map[string]string, d *Decoder) {
+ if v, changed := f.DecMapStringStringV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt8Int8V(v map[int8]int8, canChange bool,
- d *Decoder) (_ map[int8]int8, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapStringStringV(v map[string]string, canChange bool,
+ d *Decoder) (_ map[string]string, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 2)
- v = make(map[int8]int8, xlen)
+ v = make(map[string]string, decInferLen(containerLen, d.h.MaxInitLen, 32))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int8
- var mv int8
+ var mk string
+ var mv string
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = d.d.DecodeString()
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
} else {
- v[mk] = 0
+ v[mk] = ""
}
continue
}
- mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8))
+ mv = d.d.DecodeString()
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt8Int16R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapStringBytesR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int8]int16)
- v, changed := fastpathTV.DecMapInt8Int16V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[string][]byte)
+ if v, changed := fastpathTV.DecMapStringBytesV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt8Int16V(rv2i(rv).(map[int8]int16), false, d)
+ fastpathTV.DecMapStringBytesV(rv2i(rv).(map[string][]byte), false, d)
}
}
-func (f fastpathT) DecMapInt8Int16X(vp *map[int8]int16, d *Decoder) {
- v, changed := f.DecMapInt8Int16V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapStringBytesX(vp *map[string][]byte, d *Decoder) {
+ if v, changed := f.DecMapStringBytesV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt8Int16V(v map[int8]int16, canChange bool,
- d *Decoder) (_ map[int8]int16, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapStringBytesV(v map[string][]byte, canChange bool,
+ d *Decoder) (_ map[string][]byte, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 3)
- v = make(map[int8]int16, xlen)
+ v = make(map[string][]byte, decInferLen(containerLen, d.h.MaxInitLen, 40))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int8
- var mv int16
+ mapGet := v != nil && !d.h.MapValueReset
+ var mk string
+ var mv []byte
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = d.d.DecodeString()
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
} else {
- v[mk] = 0
+ v[mk] = nil
}
continue
}
- mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16))
+ if mapGet {
+ mv = v[mk]
+ } else {
+ mv = nil
+ }
+ mv = d.d.DecodeBytes(mv, false)
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt8Int32R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapStringUintR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int8]int32)
- v, changed := fastpathTV.DecMapInt8Int32V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[string]uint)
+ if v, changed := fastpathTV.DecMapStringUintV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt8Int32V(rv2i(rv).(map[int8]int32), false, d)
+ fastpathTV.DecMapStringUintV(rv2i(rv).(map[string]uint), false, d)
}
}
-func (f fastpathT) DecMapInt8Int32X(vp *map[int8]int32, d *Decoder) {
- v, changed := f.DecMapInt8Int32V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapStringUintX(vp *map[string]uint, d *Decoder) {
+ if v, changed := f.DecMapStringUintV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt8Int32V(v map[int8]int32, canChange bool,
- d *Decoder) (_ map[int8]int32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapStringUintV(v map[string]uint, canChange bool,
+ d *Decoder) (_ map[string]uint, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[int8]int32, xlen)
+ v = make(map[string]uint, decInferLen(containerLen, d.h.MaxInitLen, 24))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int8
- var mv int32
+ var mk string
+ var mv uint
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = d.d.DecodeString()
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -30889,59 +6548,49 @@ func (_ fastpathT) DecMapInt8Int32V(v map[int8]int32, canChange bool,
}
continue
}
- mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32))
+ mv = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize))
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt8Int64R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapStringUint8R(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int8]int64)
- v, changed := fastpathTV.DecMapInt8Int64V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[string]uint8)
+ if v, changed := fastpathTV.DecMapStringUint8V(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt8Int64V(rv2i(rv).(map[int8]int64), false, d)
+ fastpathTV.DecMapStringUint8V(rv2i(rv).(map[string]uint8), false, d)
}
}
-func (f fastpathT) DecMapInt8Int64X(vp *map[int8]int64, d *Decoder) {
- v, changed := f.DecMapInt8Int64V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapStringUint8X(vp *map[string]uint8, d *Decoder) {
+ if v, changed := f.DecMapStringUint8V(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt8Int64V(v map[int8]int64, canChange bool,
- d *Decoder) (_ map[int8]int64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapStringUint8V(v map[string]uint8, canChange bool,
+ d *Decoder) (_ map[string]uint8, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[int8]int64, xlen)
+ v = make(map[string]uint8, decInferLen(containerLen, d.h.MaxInitLen, 17))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int8
- var mv int64
+ var mk string
+ var mv uint8
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = d.d.DecodeString()
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -30950,59 +6599,49 @@ func (_ fastpathT) DecMapInt8Int64V(v map[int8]int64, canChange bool,
}
continue
}
- mv = dd.DecodeInt64()
+ mv = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8))
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt8Float32R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapStringUint64R(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int8]float32)
- v, changed := fastpathTV.DecMapInt8Float32V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[string]uint64)
+ if v, changed := fastpathTV.DecMapStringUint64V(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt8Float32V(rv2i(rv).(map[int8]float32), false, d)
+ fastpathTV.DecMapStringUint64V(rv2i(rv).(map[string]uint64), false, d)
}
}
-func (f fastpathT) DecMapInt8Float32X(vp *map[int8]float32, d *Decoder) {
- v, changed := f.DecMapInt8Float32V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapStringUint64X(vp *map[string]uint64, d *Decoder) {
+ if v, changed := f.DecMapStringUint64V(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt8Float32V(v map[int8]float32, canChange bool,
- d *Decoder) (_ map[int8]float32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapStringUint64V(v map[string]uint64, canChange bool,
+ d *Decoder) (_ map[string]uint64, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[int8]float32, xlen)
+ v = make(map[string]uint64, decInferLen(containerLen, d.h.MaxInitLen, 24))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int8
- var mv float32
+ var mk string
+ var mv uint64
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = d.d.DecodeString()
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -31011,59 +6650,49 @@ func (_ fastpathT) DecMapInt8Float32V(v map[int8]float32, canChange bool,
}
continue
}
- mv = float32(chkOvf.Float32V(dd.DecodeFloat64()))
+ mv = d.d.DecodeUint64()
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt8Float64R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapStringUintptrR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int8]float64)
- v, changed := fastpathTV.DecMapInt8Float64V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[string]uintptr)
+ if v, changed := fastpathTV.DecMapStringUintptrV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt8Float64V(rv2i(rv).(map[int8]float64), false, d)
+ fastpathTV.DecMapStringUintptrV(rv2i(rv).(map[string]uintptr), false, d)
}
}
-func (f fastpathT) DecMapInt8Float64X(vp *map[int8]float64, d *Decoder) {
- v, changed := f.DecMapInt8Float64V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapStringUintptrX(vp *map[string]uintptr, d *Decoder) {
+ if v, changed := f.DecMapStringUintptrV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt8Float64V(v map[int8]float64, canChange bool,
- d *Decoder) (_ map[int8]float64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapStringUintptrV(v map[string]uintptr, canChange bool,
+ d *Decoder) (_ map[string]uintptr, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[int8]float64, xlen)
+ v = make(map[string]uintptr, decInferLen(containerLen, d.h.MaxInitLen, 24))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int8
- var mv float64
+ var mk string
+ var mv uintptr
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = d.d.DecodeString()
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -31072,248 +6701,202 @@ func (_ fastpathT) DecMapInt8Float64V(v map[int8]float64, canChange bool,
}
continue
}
- mv = dd.DecodeFloat64()
+ mv = uintptr(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize))
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt8BoolR(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapStringIntR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int8]bool)
- v, changed := fastpathTV.DecMapInt8BoolV(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[string]int)
+ if v, changed := fastpathTV.DecMapStringIntV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt8BoolV(rv2i(rv).(map[int8]bool), false, d)
+ fastpathTV.DecMapStringIntV(rv2i(rv).(map[string]int), false, d)
}
}
-func (f fastpathT) DecMapInt8BoolX(vp *map[int8]bool, d *Decoder) {
- v, changed := f.DecMapInt8BoolV(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapStringIntX(vp *map[string]int, d *Decoder) {
+ if v, changed := f.DecMapStringIntV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt8BoolV(v map[int8]bool, canChange bool,
- d *Decoder) (_ map[int8]bool, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapStringIntV(v map[string]int, canChange bool,
+ d *Decoder) (_ map[string]int, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 2)
- v = make(map[int8]bool, xlen)
+ v = make(map[string]int, decInferLen(containerLen, d.h.MaxInitLen, 24))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int8
- var mv bool
+ var mk string
+ var mv int
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = d.d.DecodeString()
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
} else {
- v[mk] = false
+ v[mk] = 0
}
continue
}
- mv = dd.DecodeBool()
+ mv = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize))
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt16IntfR(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapStringInt64R(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int16]interface{})
- v, changed := fastpathTV.DecMapInt16IntfV(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[string]int64)
+ if v, changed := fastpathTV.DecMapStringInt64V(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt16IntfV(rv2i(rv).(map[int16]interface{}), false, d)
+ fastpathTV.DecMapStringInt64V(rv2i(rv).(map[string]int64), false, d)
}
}
-func (f fastpathT) DecMapInt16IntfX(vp *map[int16]interface{}, d *Decoder) {
- v, changed := f.DecMapInt16IntfV(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapStringInt64X(vp *map[string]int64, d *Decoder) {
+ if v, changed := f.DecMapStringInt64V(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt16IntfV(v map[int16]interface{}, canChange bool,
- d *Decoder) (_ map[int16]interface{}, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapStringInt64V(v map[string]int64, canChange bool,
+ d *Decoder) (_ map[string]int64, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 18)
- v = make(map[int16]interface{}, xlen)
+ v = make(map[string]int64, decInferLen(containerLen, d.h.MaxInitLen, 24))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset
- var mk int16
- var mv interface{}
+ var mk string
+ var mv int64
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = d.d.DecodeString()
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
} else {
- v[mk] = nil
+ v[mk] = 0
}
continue
}
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
+ mv = d.d.DecodeInt64()
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt16StringR(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapStringFloat32R(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int16]string)
- v, changed := fastpathTV.DecMapInt16StringV(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[string]float32)
+ if v, changed := fastpathTV.DecMapStringFloat32V(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt16StringV(rv2i(rv).(map[int16]string), false, d)
+ fastpathTV.DecMapStringFloat32V(rv2i(rv).(map[string]float32), false, d)
}
}
-func (f fastpathT) DecMapInt16StringX(vp *map[int16]string, d *Decoder) {
- v, changed := f.DecMapInt16StringV(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapStringFloat32X(vp *map[string]float32, d *Decoder) {
+ if v, changed := f.DecMapStringFloat32V(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt16StringV(v map[int16]string, canChange bool,
- d *Decoder) (_ map[int16]string, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapStringFloat32V(v map[string]float32, canChange bool,
+ d *Decoder) (_ map[string]float32, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 18)
- v = make(map[int16]string, xlen)
+ v = make(map[string]float32, decInferLen(containerLen, d.h.MaxInitLen, 20))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int16
- var mv string
+ var mk string
+ var mv float32
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = d.d.DecodeString()
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
} else {
- v[mk] = ""
+ v[mk] = 0
}
continue
}
- mv = dd.DecodeString()
+ mv = float32(d.decodeFloat32())
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt16UintR(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapStringFloat64R(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int16]uint)
- v, changed := fastpathTV.DecMapInt16UintV(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[string]float64)
+ if v, changed := fastpathTV.DecMapStringFloat64V(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt16UintV(rv2i(rv).(map[int16]uint), false, d)
+ fastpathTV.DecMapStringFloat64V(rv2i(rv).(map[string]float64), false, d)
}
}
-func (f fastpathT) DecMapInt16UintX(vp *map[int16]uint, d *Decoder) {
- v, changed := f.DecMapInt16UintV(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapStringFloat64X(vp *map[string]float64, d *Decoder) {
+ if v, changed := f.DecMapStringFloat64V(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt16UintV(v map[int16]uint, canChange bool,
- d *Decoder) (_ map[int16]uint, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapStringFloat64V(v map[string]float64, canChange bool,
+ d *Decoder) (_ map[string]float64, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[int16]uint, xlen)
+ v = make(map[string]float64, decInferLen(containerLen, d.h.MaxInitLen, 24))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int16
- var mv uint
+ var mk string
+ var mv float64
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = d.d.DecodeString()
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -31322,303 +6905,265 @@ func (_ fastpathT) DecMapInt16UintV(v map[int16]uint, canChange bool,
}
continue
}
- mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
+ mv = d.d.DecodeFloat64()
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt16Uint8R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapStringBoolR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int16]uint8)
- v, changed := fastpathTV.DecMapInt16Uint8V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[string]bool)
+ if v, changed := fastpathTV.DecMapStringBoolV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt16Uint8V(rv2i(rv).(map[int16]uint8), false, d)
+ fastpathTV.DecMapStringBoolV(rv2i(rv).(map[string]bool), false, d)
}
}
-func (f fastpathT) DecMapInt16Uint8X(vp *map[int16]uint8, d *Decoder) {
- v, changed := f.DecMapInt16Uint8V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapStringBoolX(vp *map[string]bool, d *Decoder) {
+ if v, changed := f.DecMapStringBoolV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt16Uint8V(v map[int16]uint8, canChange bool,
- d *Decoder) (_ map[int16]uint8, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapStringBoolV(v map[string]bool, canChange bool,
+ d *Decoder) (_ map[string]bool, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 3)
- v = make(map[int16]uint8, xlen)
+ v = make(map[string]bool, decInferLen(containerLen, d.h.MaxInitLen, 17))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int16
- var mv uint8
+ var mk string
+ var mv bool
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = d.d.DecodeString()
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
} else {
- v[mk] = 0
+ v[mk] = false
}
continue
}
- mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8))
+ mv = d.d.DecodeBool()
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt16Uint16R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapUintIntfR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int16]uint16)
- v, changed := fastpathTV.DecMapInt16Uint16V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[uint]interface{})
+ if v, changed := fastpathTV.DecMapUintIntfV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt16Uint16V(rv2i(rv).(map[int16]uint16), false, d)
+ fastpathTV.DecMapUintIntfV(rv2i(rv).(map[uint]interface{}), false, d)
}
}
-func (f fastpathT) DecMapInt16Uint16X(vp *map[int16]uint16, d *Decoder) {
- v, changed := f.DecMapInt16Uint16V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapUintIntfX(vp *map[uint]interface{}, d *Decoder) {
+ if v, changed := f.DecMapUintIntfV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt16Uint16V(v map[int16]uint16, canChange bool,
- d *Decoder) (_ map[int16]uint16, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapUintIntfV(v map[uint]interface{}, canChange bool,
+ d *Decoder) (_ map[uint]interface{}, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 4)
- v = make(map[int16]uint16, xlen)
+ v = make(map[uint]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 24))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int16
- var mv uint16
+ mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset
+ var mk uint
+ var mv interface{}
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize))
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
} else {
- v[mk] = 0
+ v[mk] = nil
}
continue
}
- mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16))
+ if mapGet {
+ mv = v[mk]
+ } else {
+ mv = nil
+ }
+ d.decode(&mv)
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt16Uint32R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapUintStringR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int16]uint32)
- v, changed := fastpathTV.DecMapInt16Uint32V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[uint]string)
+ if v, changed := fastpathTV.DecMapUintStringV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt16Uint32V(rv2i(rv).(map[int16]uint32), false, d)
+ fastpathTV.DecMapUintStringV(rv2i(rv).(map[uint]string), false, d)
}
}
-func (f fastpathT) DecMapInt16Uint32X(vp *map[int16]uint32, d *Decoder) {
- v, changed := f.DecMapInt16Uint32V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapUintStringX(vp *map[uint]string, d *Decoder) {
+ if v, changed := f.DecMapUintStringV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt16Uint32V(v map[int16]uint32, canChange bool,
- d *Decoder) (_ map[int16]uint32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapUintStringV(v map[uint]string, canChange bool,
+ d *Decoder) (_ map[uint]string, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 6)
- v = make(map[int16]uint32, xlen)
+ v = make(map[uint]string, decInferLen(containerLen, d.h.MaxInitLen, 24))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int16
- var mv uint32
+ var mk uint
+ var mv string
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize))
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
} else {
- v[mk] = 0
+ v[mk] = ""
}
continue
}
- mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32))
+ mv = d.d.DecodeString()
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt16Uint64R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapUintBytesR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int16]uint64)
- v, changed := fastpathTV.DecMapInt16Uint64V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[uint][]byte)
+ if v, changed := fastpathTV.DecMapUintBytesV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt16Uint64V(rv2i(rv).(map[int16]uint64), false, d)
+ fastpathTV.DecMapUintBytesV(rv2i(rv).(map[uint][]byte), false, d)
}
}
-func (f fastpathT) DecMapInt16Uint64X(vp *map[int16]uint64, d *Decoder) {
- v, changed := f.DecMapInt16Uint64V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapUintBytesX(vp *map[uint][]byte, d *Decoder) {
+ if v, changed := f.DecMapUintBytesV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt16Uint64V(v map[int16]uint64, canChange bool,
- d *Decoder) (_ map[int16]uint64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapUintBytesV(v map[uint][]byte, canChange bool,
+ d *Decoder) (_ map[uint][]byte, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[int16]uint64, xlen)
+ v = make(map[uint][]byte, decInferLen(containerLen, d.h.MaxInitLen, 32))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int16
- var mv uint64
+ mapGet := v != nil && !d.h.MapValueReset
+ var mk uint
+ var mv []byte
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize))
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
} else {
- v[mk] = 0
+ v[mk] = nil
}
continue
}
- mv = dd.DecodeUint64()
+ if mapGet {
+ mv = v[mk]
+ } else {
+ mv = nil
+ }
+ mv = d.d.DecodeBytes(mv, false)
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt16UintptrR(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapUintUintR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int16]uintptr)
- v, changed := fastpathTV.DecMapInt16UintptrV(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[uint]uint)
+ if v, changed := fastpathTV.DecMapUintUintV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt16UintptrV(rv2i(rv).(map[int16]uintptr), false, d)
+ fastpathTV.DecMapUintUintV(rv2i(rv).(map[uint]uint), false, d)
}
}
-func (f fastpathT) DecMapInt16UintptrX(vp *map[int16]uintptr, d *Decoder) {
- v, changed := f.DecMapInt16UintptrV(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapUintUintX(vp *map[uint]uint, d *Decoder) {
+ if v, changed := f.DecMapUintUintV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt16UintptrV(v map[int16]uintptr, canChange bool,
- d *Decoder) (_ map[int16]uintptr, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapUintUintV(v map[uint]uint, canChange bool,
+ d *Decoder) (_ map[uint]uint, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[int16]uintptr, xlen)
+ v = make(map[uint]uint, decInferLen(containerLen, d.h.MaxInitLen, 16))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int16
- var mv uintptr
+ var mk uint
+ var mv uint
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize))
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -31627,59 +7172,49 @@ func (_ fastpathT) DecMapInt16UintptrV(v map[int16]uintptr, canChange bool,
}
continue
}
- mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
+ mv = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize))
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt16IntR(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapUintUint8R(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int16]int)
- v, changed := fastpathTV.DecMapInt16IntV(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[uint]uint8)
+ if v, changed := fastpathTV.DecMapUintUint8V(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt16IntV(rv2i(rv).(map[int16]int), false, d)
+ fastpathTV.DecMapUintUint8V(rv2i(rv).(map[uint]uint8), false, d)
}
}
-func (f fastpathT) DecMapInt16IntX(vp *map[int16]int, d *Decoder) {
- v, changed := f.DecMapInt16IntV(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapUintUint8X(vp *map[uint]uint8, d *Decoder) {
+ if v, changed := f.DecMapUintUint8V(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt16IntV(v map[int16]int, canChange bool,
- d *Decoder) (_ map[int16]int, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapUintUint8V(v map[uint]uint8, canChange bool,
+ d *Decoder) (_ map[uint]uint8, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[int16]int, xlen)
+ v = make(map[uint]uint8, decInferLen(containerLen, d.h.MaxInitLen, 9))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int16
- var mv int
+ var mk uint
+ var mv uint8
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize))
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -31688,59 +7223,49 @@ func (_ fastpathT) DecMapInt16IntV(v map[int16]int, canChange bool,
}
continue
}
- mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize))
+ mv = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8))
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt16Int8R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapUintUint64R(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int16]int8)
- v, changed := fastpathTV.DecMapInt16Int8V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[uint]uint64)
+ if v, changed := fastpathTV.DecMapUintUint64V(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt16Int8V(rv2i(rv).(map[int16]int8), false, d)
+ fastpathTV.DecMapUintUint64V(rv2i(rv).(map[uint]uint64), false, d)
}
}
-func (f fastpathT) DecMapInt16Int8X(vp *map[int16]int8, d *Decoder) {
- v, changed := f.DecMapInt16Int8V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapUintUint64X(vp *map[uint]uint64, d *Decoder) {
+ if v, changed := f.DecMapUintUint64V(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt16Int8V(v map[int16]int8, canChange bool,
- d *Decoder) (_ map[int16]int8, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapUintUint64V(v map[uint]uint64, canChange bool,
+ d *Decoder) (_ map[uint]uint64, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 3)
- v = make(map[int16]int8, xlen)
+ v = make(map[uint]uint64, decInferLen(containerLen, d.h.MaxInitLen, 16))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int16
- var mv int8
+ var mk uint
+ var mv uint64
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize))
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -31749,59 +7274,49 @@ func (_ fastpathT) DecMapInt16Int8V(v map[int16]int8, canChange bool,
}
continue
}
- mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8))
+ mv = d.d.DecodeUint64()
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt16Int16R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapUintUintptrR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int16]int16)
- v, changed := fastpathTV.DecMapInt16Int16V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[uint]uintptr)
+ if v, changed := fastpathTV.DecMapUintUintptrV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt16Int16V(rv2i(rv).(map[int16]int16), false, d)
+ fastpathTV.DecMapUintUintptrV(rv2i(rv).(map[uint]uintptr), false, d)
}
}
-func (f fastpathT) DecMapInt16Int16X(vp *map[int16]int16, d *Decoder) {
- v, changed := f.DecMapInt16Int16V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapUintUintptrX(vp *map[uint]uintptr, d *Decoder) {
+ if v, changed := f.DecMapUintUintptrV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt16Int16V(v map[int16]int16, canChange bool,
- d *Decoder) (_ map[int16]int16, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapUintUintptrV(v map[uint]uintptr, canChange bool,
+ d *Decoder) (_ map[uint]uintptr, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 4)
- v = make(map[int16]int16, xlen)
+ v = make(map[uint]uintptr, decInferLen(containerLen, d.h.MaxInitLen, 16))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int16
- var mv int16
+ var mk uint
+ var mv uintptr
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize))
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -31810,59 +7325,49 @@ func (_ fastpathT) DecMapInt16Int16V(v map[int16]int16, canChange bool,
}
continue
}
- mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16))
+ mv = uintptr(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize))
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt16Int32R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapUintIntR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int16]int32)
- v, changed := fastpathTV.DecMapInt16Int32V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[uint]int)
+ if v, changed := fastpathTV.DecMapUintIntV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt16Int32V(rv2i(rv).(map[int16]int32), false, d)
+ fastpathTV.DecMapUintIntV(rv2i(rv).(map[uint]int), false, d)
}
}
-func (f fastpathT) DecMapInt16Int32X(vp *map[int16]int32, d *Decoder) {
- v, changed := f.DecMapInt16Int32V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapUintIntX(vp *map[uint]int, d *Decoder) {
+ if v, changed := f.DecMapUintIntV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt16Int32V(v map[int16]int32, canChange bool,
- d *Decoder) (_ map[int16]int32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapUintIntV(v map[uint]int, canChange bool,
+ d *Decoder) (_ map[uint]int, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 6)
- v = make(map[int16]int32, xlen)
+ v = make(map[uint]int, decInferLen(containerLen, d.h.MaxInitLen, 16))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int16
- var mv int32
+ var mk uint
+ var mv int
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize))
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -31871,59 +7376,49 @@ func (_ fastpathT) DecMapInt16Int32V(v map[int16]int32, canChange bool,
}
continue
}
- mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32))
+ mv = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize))
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt16Int64R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapUintInt64R(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int16]int64)
- v, changed := fastpathTV.DecMapInt16Int64V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[uint]int64)
+ if v, changed := fastpathTV.DecMapUintInt64V(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt16Int64V(rv2i(rv).(map[int16]int64), false, d)
+ fastpathTV.DecMapUintInt64V(rv2i(rv).(map[uint]int64), false, d)
}
}
-func (f fastpathT) DecMapInt16Int64X(vp *map[int16]int64, d *Decoder) {
- v, changed := f.DecMapInt16Int64V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapUintInt64X(vp *map[uint]int64, d *Decoder) {
+ if v, changed := f.DecMapUintInt64V(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt16Int64V(v map[int16]int64, canChange bool,
- d *Decoder) (_ map[int16]int64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapUintInt64V(v map[uint]int64, canChange bool,
+ d *Decoder) (_ map[uint]int64, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[int16]int64, xlen)
+ v = make(map[uint]int64, decInferLen(containerLen, d.h.MaxInitLen, 16))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int16
+ var mk uint
var mv int64
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize))
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -31932,59 +7427,49 @@ func (_ fastpathT) DecMapInt16Int64V(v map[int16]int64, canChange bool,
}
continue
}
- mv = dd.DecodeInt64()
+ mv = d.d.DecodeInt64()
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt16Float32R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapUintFloat32R(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int16]float32)
- v, changed := fastpathTV.DecMapInt16Float32V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[uint]float32)
+ if v, changed := fastpathTV.DecMapUintFloat32V(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt16Float32V(rv2i(rv).(map[int16]float32), false, d)
+ fastpathTV.DecMapUintFloat32V(rv2i(rv).(map[uint]float32), false, d)
}
}
-func (f fastpathT) DecMapInt16Float32X(vp *map[int16]float32, d *Decoder) {
- v, changed := f.DecMapInt16Float32V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapUintFloat32X(vp *map[uint]float32, d *Decoder) {
+ if v, changed := f.DecMapUintFloat32V(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt16Float32V(v map[int16]float32, canChange bool,
- d *Decoder) (_ map[int16]float32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapUintFloat32V(v map[uint]float32, canChange bool,
+ d *Decoder) (_ map[uint]float32, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 6)
- v = make(map[int16]float32, xlen)
+ v = make(map[uint]float32, decInferLen(containerLen, d.h.MaxInitLen, 12))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int16
+ var mk uint
var mv float32
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize))
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -31993,59 +7478,49 @@ func (_ fastpathT) DecMapInt16Float32V(v map[int16]float32, canChange bool,
}
continue
}
- mv = float32(chkOvf.Float32V(dd.DecodeFloat64()))
+ mv = float32(d.decodeFloat32())
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt16Float64R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapUintFloat64R(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int16]float64)
- v, changed := fastpathTV.DecMapInt16Float64V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[uint]float64)
+ if v, changed := fastpathTV.DecMapUintFloat64V(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt16Float64V(rv2i(rv).(map[int16]float64), false, d)
+ fastpathTV.DecMapUintFloat64V(rv2i(rv).(map[uint]float64), false, d)
}
}
-func (f fastpathT) DecMapInt16Float64X(vp *map[int16]float64, d *Decoder) {
- v, changed := f.DecMapInt16Float64V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapUintFloat64X(vp *map[uint]float64, d *Decoder) {
+ if v, changed := f.DecMapUintFloat64V(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt16Float64V(v map[int16]float64, canChange bool,
- d *Decoder) (_ map[int16]float64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapUintFloat64V(v map[uint]float64, canChange bool,
+ d *Decoder) (_ map[uint]float64, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[int16]float64, xlen)
+ v = make(map[uint]float64, decInferLen(containerLen, d.h.MaxInitLen, 16))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int16
+ var mk uint
var mv float64
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize))
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -32054,59 +7529,49 @@ func (_ fastpathT) DecMapInt16Float64V(v map[int16]float64, canChange bool,
}
continue
}
- mv = dd.DecodeFloat64()
+ mv = d.d.DecodeFloat64()
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt16BoolR(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapUintBoolR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int16]bool)
- v, changed := fastpathTV.DecMapInt16BoolV(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[uint]bool)
+ if v, changed := fastpathTV.DecMapUintBoolV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt16BoolV(rv2i(rv).(map[int16]bool), false, d)
+ fastpathTV.DecMapUintBoolV(rv2i(rv).(map[uint]bool), false, d)
}
}
-func (f fastpathT) DecMapInt16BoolX(vp *map[int16]bool, d *Decoder) {
- v, changed := f.DecMapInt16BoolV(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapUintBoolX(vp *map[uint]bool, d *Decoder) {
+ if v, changed := f.DecMapUintBoolV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt16BoolV(v map[int16]bool, canChange bool,
- d *Decoder) (_ map[int16]bool, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapUintBoolV(v map[uint]bool, canChange bool,
+ d *Decoder) (_ map[uint]bool, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 3)
- v = make(map[int16]bool, xlen)
+ v = make(map[uint]bool, decInferLen(containerLen, d.h.MaxInitLen, 9))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int16
+ var mk uint
var mv bool
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize))
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -32115,60 +7580,50 @@ func (_ fastpathT) DecMapInt16BoolV(v map[int16]bool, canChange bool,
}
continue
}
- mv = dd.DecodeBool()
+ mv = d.d.DecodeBool()
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt32IntfR(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapUint8IntfR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int32]interface{})
- v, changed := fastpathTV.DecMapInt32IntfV(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[uint8]interface{})
+ if v, changed := fastpathTV.DecMapUint8IntfV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt32IntfV(rv2i(rv).(map[int32]interface{}), false, d)
+ fastpathTV.DecMapUint8IntfV(rv2i(rv).(map[uint8]interface{}), false, d)
}
}
-func (f fastpathT) DecMapInt32IntfX(vp *map[int32]interface{}, d *Decoder) {
- v, changed := f.DecMapInt32IntfV(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapUint8IntfX(vp *map[uint8]interface{}, d *Decoder) {
+ if v, changed := f.DecMapUint8IntfV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt32IntfV(v map[int32]interface{}, canChange bool,
- d *Decoder) (_ map[int32]interface{}, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapUint8IntfV(v map[uint8]interface{}, canChange bool,
+ d *Decoder) (_ map[uint8]interface{}, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 20)
- v = make(map[int32]interface{}, xlen)
+ v = make(map[uint8]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 17))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset
- var mk int32
+ var mk uint8
var mv interface{}
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8))
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -32187,54 +7642,44 @@ func (_ fastpathT) DecMapInt32IntfV(v map[int32]interface{}, canChange bool,
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt32StringR(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapUint8StringR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int32]string)
- v, changed := fastpathTV.DecMapInt32StringV(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[uint8]string)
+ if v, changed := fastpathTV.DecMapUint8StringV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt32StringV(rv2i(rv).(map[int32]string), false, d)
+ fastpathTV.DecMapUint8StringV(rv2i(rv).(map[uint8]string), false, d)
}
}
-func (f fastpathT) DecMapInt32StringX(vp *map[int32]string, d *Decoder) {
- v, changed := f.DecMapInt32StringV(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapUint8StringX(vp *map[uint8]string, d *Decoder) {
+ if v, changed := f.DecMapUint8StringV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt32StringV(v map[int32]string, canChange bool,
- d *Decoder) (_ map[int32]string, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapUint8StringV(v map[uint8]string, canChange bool,
+ d *Decoder) (_ map[uint8]string, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 20)
- v = make(map[int32]string, xlen)
+ v = make(map[uint8]string, decInferLen(containerLen, d.h.MaxInitLen, 17))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int32
+ var mk uint8
var mv string
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8))
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -32243,120 +7688,106 @@ func (_ fastpathT) DecMapInt32StringV(v map[int32]string, canChange bool,
}
continue
}
- mv = dd.DecodeString()
+ mv = d.d.DecodeString()
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt32UintR(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapUint8BytesR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int32]uint)
- v, changed := fastpathTV.DecMapInt32UintV(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[uint8][]byte)
+ if v, changed := fastpathTV.DecMapUint8BytesV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt32UintV(rv2i(rv).(map[int32]uint), false, d)
+ fastpathTV.DecMapUint8BytesV(rv2i(rv).(map[uint8][]byte), false, d)
}
}
-func (f fastpathT) DecMapInt32UintX(vp *map[int32]uint, d *Decoder) {
- v, changed := f.DecMapInt32UintV(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapUint8BytesX(vp *map[uint8][]byte, d *Decoder) {
+ if v, changed := f.DecMapUint8BytesV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt32UintV(v map[int32]uint, canChange bool,
- d *Decoder) (_ map[int32]uint, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapUint8BytesV(v map[uint8][]byte, canChange bool,
+ d *Decoder) (_ map[uint8][]byte, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[int32]uint, xlen)
+ v = make(map[uint8][]byte, decInferLen(containerLen, d.h.MaxInitLen, 25))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int32
- var mv uint
+ mapGet := v != nil && !d.h.MapValueReset
+ var mk uint8
+ var mv []byte
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8))
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
} else {
- v[mk] = 0
+ v[mk] = nil
}
continue
}
- mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
+ if mapGet {
+ mv = v[mk]
+ } else {
+ mv = nil
+ }
+ mv = d.d.DecodeBytes(mv, false)
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt32Uint8R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapUint8UintR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int32]uint8)
- v, changed := fastpathTV.DecMapInt32Uint8V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[uint8]uint)
+ if v, changed := fastpathTV.DecMapUint8UintV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt32Uint8V(rv2i(rv).(map[int32]uint8), false, d)
+ fastpathTV.DecMapUint8UintV(rv2i(rv).(map[uint8]uint), false, d)
}
}
-func (f fastpathT) DecMapInt32Uint8X(vp *map[int32]uint8, d *Decoder) {
- v, changed := f.DecMapInt32Uint8V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapUint8UintX(vp *map[uint8]uint, d *Decoder) {
+ if v, changed := f.DecMapUint8UintV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt32Uint8V(v map[int32]uint8, canChange bool,
- d *Decoder) (_ map[int32]uint8, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapUint8UintV(v map[uint8]uint, canChange bool,
+ d *Decoder) (_ map[uint8]uint, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[int32]uint8, xlen)
+ v = make(map[uint8]uint, decInferLen(containerLen, d.h.MaxInitLen, 9))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int32
- var mv uint8
+ var mk uint8
+ var mv uint
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8))
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -32365,59 +7796,49 @@ func (_ fastpathT) DecMapInt32Uint8V(v map[int32]uint8, canChange bool,
}
continue
}
- mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8))
+ mv = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize))
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt32Uint16R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapUint8Uint8R(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int32]uint16)
- v, changed := fastpathTV.DecMapInt32Uint16V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[uint8]uint8)
+ if v, changed := fastpathTV.DecMapUint8Uint8V(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt32Uint16V(rv2i(rv).(map[int32]uint16), false, d)
+ fastpathTV.DecMapUint8Uint8V(rv2i(rv).(map[uint8]uint8), false, d)
}
}
-func (f fastpathT) DecMapInt32Uint16X(vp *map[int32]uint16, d *Decoder) {
- v, changed := f.DecMapInt32Uint16V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapUint8Uint8X(vp *map[uint8]uint8, d *Decoder) {
+ if v, changed := f.DecMapUint8Uint8V(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt32Uint16V(v map[int32]uint16, canChange bool,
- d *Decoder) (_ map[int32]uint16, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapUint8Uint8V(v map[uint8]uint8, canChange bool,
+ d *Decoder) (_ map[uint8]uint8, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 6)
- v = make(map[int32]uint16, xlen)
+ v = make(map[uint8]uint8, decInferLen(containerLen, d.h.MaxInitLen, 2))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int32
- var mv uint16
+ var mk uint8
+ var mv uint8
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8))
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -32426,59 +7847,49 @@ func (_ fastpathT) DecMapInt32Uint16V(v map[int32]uint16, canChange bool,
}
continue
}
- mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16))
+ mv = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8))
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt32Uint32R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapUint8Uint64R(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int32]uint32)
- v, changed := fastpathTV.DecMapInt32Uint32V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[uint8]uint64)
+ if v, changed := fastpathTV.DecMapUint8Uint64V(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt32Uint32V(rv2i(rv).(map[int32]uint32), false, d)
+ fastpathTV.DecMapUint8Uint64V(rv2i(rv).(map[uint8]uint64), false, d)
}
}
-func (f fastpathT) DecMapInt32Uint32X(vp *map[int32]uint32, d *Decoder) {
- v, changed := f.DecMapInt32Uint32V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapUint8Uint64X(vp *map[uint8]uint64, d *Decoder) {
+ if v, changed := f.DecMapUint8Uint64V(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt32Uint32V(v map[int32]uint32, canChange bool,
- d *Decoder) (_ map[int32]uint32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapUint8Uint64V(v map[uint8]uint64, canChange bool,
+ d *Decoder) (_ map[uint8]uint64, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 8)
- v = make(map[int32]uint32, xlen)
+ v = make(map[uint8]uint64, decInferLen(containerLen, d.h.MaxInitLen, 9))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int32
- var mv uint32
+ var mk uint8
+ var mv uint64
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8))
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -32487,59 +7898,49 @@ func (_ fastpathT) DecMapInt32Uint32V(v map[int32]uint32, canChange bool,
}
continue
}
- mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32))
+ mv = d.d.DecodeUint64()
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt32Uint64R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapUint8UintptrR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int32]uint64)
- v, changed := fastpathTV.DecMapInt32Uint64V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[uint8]uintptr)
+ if v, changed := fastpathTV.DecMapUint8UintptrV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt32Uint64V(rv2i(rv).(map[int32]uint64), false, d)
+ fastpathTV.DecMapUint8UintptrV(rv2i(rv).(map[uint8]uintptr), false, d)
}
}
-func (f fastpathT) DecMapInt32Uint64X(vp *map[int32]uint64, d *Decoder) {
- v, changed := f.DecMapInt32Uint64V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapUint8UintptrX(vp *map[uint8]uintptr, d *Decoder) {
+ if v, changed := f.DecMapUint8UintptrV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt32Uint64V(v map[int32]uint64, canChange bool,
- d *Decoder) (_ map[int32]uint64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapUint8UintptrV(v map[uint8]uintptr, canChange bool,
+ d *Decoder) (_ map[uint8]uintptr, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[int32]uint64, xlen)
+ v = make(map[uint8]uintptr, decInferLen(containerLen, d.h.MaxInitLen, 9))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int32
- var mv uint64
+ var mk uint8
+ var mv uintptr
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8))
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -32548,59 +7949,49 @@ func (_ fastpathT) DecMapInt32Uint64V(v map[int32]uint64, canChange bool,
}
continue
}
- mv = dd.DecodeUint64()
+ mv = uintptr(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize))
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt32UintptrR(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapUint8IntR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int32]uintptr)
- v, changed := fastpathTV.DecMapInt32UintptrV(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[uint8]int)
+ if v, changed := fastpathTV.DecMapUint8IntV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt32UintptrV(rv2i(rv).(map[int32]uintptr), false, d)
+ fastpathTV.DecMapUint8IntV(rv2i(rv).(map[uint8]int), false, d)
}
}
-func (f fastpathT) DecMapInt32UintptrX(vp *map[int32]uintptr, d *Decoder) {
- v, changed := f.DecMapInt32UintptrV(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapUint8IntX(vp *map[uint8]int, d *Decoder) {
+ if v, changed := f.DecMapUint8IntV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt32UintptrV(v map[int32]uintptr, canChange bool,
- d *Decoder) (_ map[int32]uintptr, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapUint8IntV(v map[uint8]int, canChange bool,
+ d *Decoder) (_ map[uint8]int, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[int32]uintptr, xlen)
+ v = make(map[uint8]int, decInferLen(containerLen, d.h.MaxInitLen, 9))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int32
- var mv uintptr
+ var mk uint8
+ var mv int
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8))
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -32609,59 +8000,49 @@ func (_ fastpathT) DecMapInt32UintptrV(v map[int32]uintptr, canChange bool,
}
continue
}
- mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
+ mv = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize))
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt32IntR(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapUint8Int64R(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int32]int)
- v, changed := fastpathTV.DecMapInt32IntV(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[uint8]int64)
+ if v, changed := fastpathTV.DecMapUint8Int64V(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt32IntV(rv2i(rv).(map[int32]int), false, d)
+ fastpathTV.DecMapUint8Int64V(rv2i(rv).(map[uint8]int64), false, d)
}
}
-func (f fastpathT) DecMapInt32IntX(vp *map[int32]int, d *Decoder) {
- v, changed := f.DecMapInt32IntV(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapUint8Int64X(vp *map[uint8]int64, d *Decoder) {
+ if v, changed := f.DecMapUint8Int64V(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt32IntV(v map[int32]int, canChange bool,
- d *Decoder) (_ map[int32]int, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapUint8Int64V(v map[uint8]int64, canChange bool,
+ d *Decoder) (_ map[uint8]int64, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[int32]int, xlen)
+ v = make(map[uint8]int64, decInferLen(containerLen, d.h.MaxInitLen, 9))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int32
- var mv int
+ var mk uint8
+ var mv int64
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8))
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -32670,59 +8051,49 @@ func (_ fastpathT) DecMapInt32IntV(v map[int32]int, canChange bool,
}
continue
}
- mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize))
+ mv = d.d.DecodeInt64()
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt32Int8R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapUint8Float32R(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int32]int8)
- v, changed := fastpathTV.DecMapInt32Int8V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[uint8]float32)
+ if v, changed := fastpathTV.DecMapUint8Float32V(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt32Int8V(rv2i(rv).(map[int32]int8), false, d)
+ fastpathTV.DecMapUint8Float32V(rv2i(rv).(map[uint8]float32), false, d)
}
}
-func (f fastpathT) DecMapInt32Int8X(vp *map[int32]int8, d *Decoder) {
- v, changed := f.DecMapInt32Int8V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapUint8Float32X(vp *map[uint8]float32, d *Decoder) {
+ if v, changed := f.DecMapUint8Float32V(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt32Int8V(v map[int32]int8, canChange bool,
- d *Decoder) (_ map[int32]int8, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapUint8Float32V(v map[uint8]float32, canChange bool,
+ d *Decoder) (_ map[uint8]float32, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[int32]int8, xlen)
+ v = make(map[uint8]float32, decInferLen(containerLen, d.h.MaxInitLen, 5))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int32
- var mv int8
+ var mk uint8
+ var mv float32
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8))
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -32731,59 +8102,49 @@ func (_ fastpathT) DecMapInt32Int8V(v map[int32]int8, canChange bool,
}
continue
}
- mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8))
+ mv = float32(d.decodeFloat32())
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt32Int16R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapUint8Float64R(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int32]int16)
- v, changed := fastpathTV.DecMapInt32Int16V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[uint8]float64)
+ if v, changed := fastpathTV.DecMapUint8Float64V(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt32Int16V(rv2i(rv).(map[int32]int16), false, d)
+ fastpathTV.DecMapUint8Float64V(rv2i(rv).(map[uint8]float64), false, d)
}
}
-func (f fastpathT) DecMapInt32Int16X(vp *map[int32]int16, d *Decoder) {
- v, changed := f.DecMapInt32Int16V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapUint8Float64X(vp *map[uint8]float64, d *Decoder) {
+ if v, changed := f.DecMapUint8Float64V(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt32Int16V(v map[int32]int16, canChange bool,
- d *Decoder) (_ map[int32]int16, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapUint8Float64V(v map[uint8]float64, canChange bool,
+ d *Decoder) (_ map[uint8]float64, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 6)
- v = make(map[int32]int16, xlen)
+ v = make(map[uint8]float64, decInferLen(containerLen, d.h.MaxInitLen, 9))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int32
- var mv int16
+ var mk uint8
+ var mv float64
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8))
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -32792,492 +8153,418 @@ func (_ fastpathT) DecMapInt32Int16V(v map[int32]int16, canChange bool,
}
continue
}
- mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16))
+ mv = d.d.DecodeFloat64()
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt32Int32R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapUint8BoolR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int32]int32)
- v, changed := fastpathTV.DecMapInt32Int32V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[uint8]bool)
+ if v, changed := fastpathTV.DecMapUint8BoolV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt32Int32V(rv2i(rv).(map[int32]int32), false, d)
+ fastpathTV.DecMapUint8BoolV(rv2i(rv).(map[uint8]bool), false, d)
}
}
-func (f fastpathT) DecMapInt32Int32X(vp *map[int32]int32, d *Decoder) {
- v, changed := f.DecMapInt32Int32V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapUint8BoolX(vp *map[uint8]bool, d *Decoder) {
+ if v, changed := f.DecMapUint8BoolV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt32Int32V(v map[int32]int32, canChange bool,
- d *Decoder) (_ map[int32]int32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapUint8BoolV(v map[uint8]bool, canChange bool,
+ d *Decoder) (_ map[uint8]bool, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 8)
- v = make(map[int32]int32, xlen)
+ v = make(map[uint8]bool, decInferLen(containerLen, d.h.MaxInitLen, 2))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int32
- var mv int32
+ var mk uint8
+ var mv bool
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8))
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
} else {
- v[mk] = 0
+ v[mk] = false
}
continue
}
- mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32))
+ mv = d.d.DecodeBool()
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt32Int64R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapUint64IntfR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int32]int64)
- v, changed := fastpathTV.DecMapInt32Int64V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[uint64]interface{})
+ if v, changed := fastpathTV.DecMapUint64IntfV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt32Int64V(rv2i(rv).(map[int32]int64), false, d)
+ fastpathTV.DecMapUint64IntfV(rv2i(rv).(map[uint64]interface{}), false, d)
}
}
-func (f fastpathT) DecMapInt32Int64X(vp *map[int32]int64, d *Decoder) {
- v, changed := f.DecMapInt32Int64V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapUint64IntfX(vp *map[uint64]interface{}, d *Decoder) {
+ if v, changed := f.DecMapUint64IntfV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt32Int64V(v map[int32]int64, canChange bool,
- d *Decoder) (_ map[int32]int64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapUint64IntfV(v map[uint64]interface{}, canChange bool,
+ d *Decoder) (_ map[uint64]interface{}, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[int32]int64, xlen)
+ v = make(map[uint64]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 24))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int32
- var mv int64
+ mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset
+ var mk uint64
+ var mv interface{}
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = d.d.DecodeUint64()
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
} else {
- v[mk] = 0
+ v[mk] = nil
}
continue
}
- mv = dd.DecodeInt64()
+ if mapGet {
+ mv = v[mk]
+ } else {
+ mv = nil
+ }
+ d.decode(&mv)
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt32Float32R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapUint64StringR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int32]float32)
- v, changed := fastpathTV.DecMapInt32Float32V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[uint64]string)
+ if v, changed := fastpathTV.DecMapUint64StringV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt32Float32V(rv2i(rv).(map[int32]float32), false, d)
+ fastpathTV.DecMapUint64StringV(rv2i(rv).(map[uint64]string), false, d)
}
}
-func (f fastpathT) DecMapInt32Float32X(vp *map[int32]float32, d *Decoder) {
- v, changed := f.DecMapInt32Float32V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapUint64StringX(vp *map[uint64]string, d *Decoder) {
+ if v, changed := f.DecMapUint64StringV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt32Float32V(v map[int32]float32, canChange bool,
- d *Decoder) (_ map[int32]float32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapUint64StringV(v map[uint64]string, canChange bool,
+ d *Decoder) (_ map[uint64]string, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 8)
- v = make(map[int32]float32, xlen)
+ v = make(map[uint64]string, decInferLen(containerLen, d.h.MaxInitLen, 24))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int32
- var mv float32
+ var mk uint64
+ var mv string
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = d.d.DecodeUint64()
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
} else {
- v[mk] = 0
+ v[mk] = ""
}
continue
}
- mv = float32(chkOvf.Float32V(dd.DecodeFloat64()))
+ mv = d.d.DecodeString()
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt32Float64R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapUint64BytesR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int32]float64)
- v, changed := fastpathTV.DecMapInt32Float64V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[uint64][]byte)
+ if v, changed := fastpathTV.DecMapUint64BytesV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt32Float64V(rv2i(rv).(map[int32]float64), false, d)
+ fastpathTV.DecMapUint64BytesV(rv2i(rv).(map[uint64][]byte), false, d)
}
}
-func (f fastpathT) DecMapInt32Float64X(vp *map[int32]float64, d *Decoder) {
- v, changed := f.DecMapInt32Float64V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapUint64BytesX(vp *map[uint64][]byte, d *Decoder) {
+ if v, changed := f.DecMapUint64BytesV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt32Float64V(v map[int32]float64, canChange bool,
- d *Decoder) (_ map[int32]float64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapUint64BytesV(v map[uint64][]byte, canChange bool,
+ d *Decoder) (_ map[uint64][]byte, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[int32]float64, xlen)
+ v = make(map[uint64][]byte, decInferLen(containerLen, d.h.MaxInitLen, 32))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int32
- var mv float64
+ mapGet := v != nil && !d.h.MapValueReset
+ var mk uint64
+ var mv []byte
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = d.d.DecodeUint64()
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
} else {
- v[mk] = 0
+ v[mk] = nil
}
continue
}
- mv = dd.DecodeFloat64()
+ if mapGet {
+ mv = v[mk]
+ } else {
+ mv = nil
+ }
+ mv = d.d.DecodeBytes(mv, false)
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt32BoolR(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapUint64UintR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int32]bool)
- v, changed := fastpathTV.DecMapInt32BoolV(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[uint64]uint)
+ if v, changed := fastpathTV.DecMapUint64UintV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt32BoolV(rv2i(rv).(map[int32]bool), false, d)
+ fastpathTV.DecMapUint64UintV(rv2i(rv).(map[uint64]uint), false, d)
}
}
-func (f fastpathT) DecMapInt32BoolX(vp *map[int32]bool, d *Decoder) {
- v, changed := f.DecMapInt32BoolV(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapUint64UintX(vp *map[uint64]uint, d *Decoder) {
+ if v, changed := f.DecMapUint64UintV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt32BoolV(v map[int32]bool, canChange bool,
- d *Decoder) (_ map[int32]bool, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapUint64UintV(v map[uint64]uint, canChange bool,
+ d *Decoder) (_ map[uint64]uint, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[int32]bool, xlen)
+ v = make(map[uint64]uint, decInferLen(containerLen, d.h.MaxInitLen, 16))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int32
- var mv bool
+ var mk uint64
+ var mv uint
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32))
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = d.d.DecodeUint64()
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
} else {
- v[mk] = false
+ v[mk] = 0
}
continue
}
- mv = dd.DecodeBool()
+ mv = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize))
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt64IntfR(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapUint64Uint8R(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int64]interface{})
- v, changed := fastpathTV.DecMapInt64IntfV(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[uint64]uint8)
+ if v, changed := fastpathTV.DecMapUint64Uint8V(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt64IntfV(rv2i(rv).(map[int64]interface{}), false, d)
+ fastpathTV.DecMapUint64Uint8V(rv2i(rv).(map[uint64]uint8), false, d)
}
}
-func (f fastpathT) DecMapInt64IntfX(vp *map[int64]interface{}, d *Decoder) {
- v, changed := f.DecMapInt64IntfV(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapUint64Uint8X(vp *map[uint64]uint8, d *Decoder) {
+ if v, changed := f.DecMapUint64Uint8V(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt64IntfV(v map[int64]interface{}, canChange bool,
- d *Decoder) (_ map[int64]interface{}, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapUint64Uint8V(v map[uint64]uint8, canChange bool,
+ d *Decoder) (_ map[uint64]uint8, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[int64]interface{}, xlen)
+ v = make(map[uint64]uint8, decInferLen(containerLen, d.h.MaxInitLen, 9))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset
- var mk int64
- var mv interface{}
+ var mk uint64
+ var mv uint8
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeInt64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = d.d.DecodeUint64()
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
} else {
- v[mk] = nil
+ v[mk] = 0
}
continue
}
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
+ mv = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8))
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt64StringR(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapUint64Uint64R(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int64]string)
- v, changed := fastpathTV.DecMapInt64StringV(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[uint64]uint64)
+ if v, changed := fastpathTV.DecMapUint64Uint64V(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt64StringV(rv2i(rv).(map[int64]string), false, d)
+ fastpathTV.DecMapUint64Uint64V(rv2i(rv).(map[uint64]uint64), false, d)
}
}
-func (f fastpathT) DecMapInt64StringX(vp *map[int64]string, d *Decoder) {
- v, changed := f.DecMapInt64StringV(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapUint64Uint64X(vp *map[uint64]uint64, d *Decoder) {
+ if v, changed := f.DecMapUint64Uint64V(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt64StringV(v map[int64]string, canChange bool,
- d *Decoder) (_ map[int64]string, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapUint64Uint64V(v map[uint64]uint64, canChange bool,
+ d *Decoder) (_ map[uint64]uint64, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 24)
- v = make(map[int64]string, xlen)
+ v = make(map[uint64]uint64, decInferLen(containerLen, d.h.MaxInitLen, 16))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int64
- var mv string
+ var mk uint64
+ var mv uint64
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeInt64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = d.d.DecodeUint64()
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
} else {
- v[mk] = ""
+ v[mk] = 0
}
continue
}
- mv = dd.DecodeString()
+ mv = d.d.DecodeUint64()
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt64UintR(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapUint64UintptrR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int64]uint)
- v, changed := fastpathTV.DecMapInt64UintV(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[uint64]uintptr)
+ if v, changed := fastpathTV.DecMapUint64UintptrV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt64UintV(rv2i(rv).(map[int64]uint), false, d)
+ fastpathTV.DecMapUint64UintptrV(rv2i(rv).(map[uint64]uintptr), false, d)
}
}
-func (f fastpathT) DecMapInt64UintX(vp *map[int64]uint, d *Decoder) {
- v, changed := f.DecMapInt64UintV(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapUint64UintptrX(vp *map[uint64]uintptr, d *Decoder) {
+ if v, changed := f.DecMapUint64UintptrV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt64UintV(v map[int64]uint, canChange bool,
- d *Decoder) (_ map[int64]uint, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapUint64UintptrV(v map[uint64]uintptr, canChange bool,
+ d *Decoder) (_ map[uint64]uintptr, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[int64]uint, xlen)
+ v = make(map[uint64]uintptr, decInferLen(containerLen, d.h.MaxInitLen, 16))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int64
- var mv uint
+ var mk uint64
+ var mv uintptr
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeInt64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = d.d.DecodeUint64()
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -33286,59 +8573,49 @@ func (_ fastpathT) DecMapInt64UintV(v map[int64]uint, canChange bool,
}
continue
}
- mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
+ mv = uintptr(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize))
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt64Uint8R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapUint64IntR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int64]uint8)
- v, changed := fastpathTV.DecMapInt64Uint8V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[uint64]int)
+ if v, changed := fastpathTV.DecMapUint64IntV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt64Uint8V(rv2i(rv).(map[int64]uint8), false, d)
+ fastpathTV.DecMapUint64IntV(rv2i(rv).(map[uint64]int), false, d)
}
}
-func (f fastpathT) DecMapInt64Uint8X(vp *map[int64]uint8, d *Decoder) {
- v, changed := f.DecMapInt64Uint8V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapUint64IntX(vp *map[uint64]int, d *Decoder) {
+ if v, changed := f.DecMapUint64IntV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt64Uint8V(v map[int64]uint8, canChange bool,
- d *Decoder) (_ map[int64]uint8, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapUint64IntV(v map[uint64]int, canChange bool,
+ d *Decoder) (_ map[uint64]int, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[int64]uint8, xlen)
+ v = make(map[uint64]int, decInferLen(containerLen, d.h.MaxInitLen, 16))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int64
- var mv uint8
+ var mk uint64
+ var mv int
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeInt64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = d.d.DecodeUint64()
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -33347,59 +8624,49 @@ func (_ fastpathT) DecMapInt64Uint8V(v map[int64]uint8, canChange bool,
}
continue
}
- mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8))
+ mv = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize))
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt64Uint16R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapUint64Int64R(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int64]uint16)
- v, changed := fastpathTV.DecMapInt64Uint16V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[uint64]int64)
+ if v, changed := fastpathTV.DecMapUint64Int64V(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt64Uint16V(rv2i(rv).(map[int64]uint16), false, d)
+ fastpathTV.DecMapUint64Int64V(rv2i(rv).(map[uint64]int64), false, d)
}
}
-func (f fastpathT) DecMapInt64Uint16X(vp *map[int64]uint16, d *Decoder) {
- v, changed := f.DecMapInt64Uint16V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapUint64Int64X(vp *map[uint64]int64, d *Decoder) {
+ if v, changed := f.DecMapUint64Int64V(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt64Uint16V(v map[int64]uint16, canChange bool,
- d *Decoder) (_ map[int64]uint16, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapUint64Int64V(v map[uint64]int64, canChange bool,
+ d *Decoder) (_ map[uint64]int64, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[int64]uint16, xlen)
+ v = make(map[uint64]int64, decInferLen(containerLen, d.h.MaxInitLen, 16))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int64
- var mv uint16
+ var mk uint64
+ var mv int64
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeInt64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = d.d.DecodeUint64()
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -33408,59 +8675,49 @@ func (_ fastpathT) DecMapInt64Uint16V(v map[int64]uint16, canChange bool,
}
continue
}
- mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16))
+ mv = d.d.DecodeInt64()
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt64Uint32R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapUint64Float32R(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int64]uint32)
- v, changed := fastpathTV.DecMapInt64Uint32V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[uint64]float32)
+ if v, changed := fastpathTV.DecMapUint64Float32V(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt64Uint32V(rv2i(rv).(map[int64]uint32), false, d)
+ fastpathTV.DecMapUint64Float32V(rv2i(rv).(map[uint64]float32), false, d)
}
}
-func (f fastpathT) DecMapInt64Uint32X(vp *map[int64]uint32, d *Decoder) {
- v, changed := f.DecMapInt64Uint32V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapUint64Float32X(vp *map[uint64]float32, d *Decoder) {
+ if v, changed := f.DecMapUint64Float32V(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt64Uint32V(v map[int64]uint32, canChange bool,
- d *Decoder) (_ map[int64]uint32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapUint64Float32V(v map[uint64]float32, canChange bool,
+ d *Decoder) (_ map[uint64]float32, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[int64]uint32, xlen)
+ v = make(map[uint64]float32, decInferLen(containerLen, d.h.MaxInitLen, 12))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int64
- var mv uint32
+ var mk uint64
+ var mv float32
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeInt64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = d.d.DecodeUint64()
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -33469,59 +8726,49 @@ func (_ fastpathT) DecMapInt64Uint32V(v map[int64]uint32, canChange bool,
}
continue
}
- mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32))
+ mv = float32(d.decodeFloat32())
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt64Uint64R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapUint64Float64R(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int64]uint64)
- v, changed := fastpathTV.DecMapInt64Uint64V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[uint64]float64)
+ if v, changed := fastpathTV.DecMapUint64Float64V(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt64Uint64V(rv2i(rv).(map[int64]uint64), false, d)
+ fastpathTV.DecMapUint64Float64V(rv2i(rv).(map[uint64]float64), false, d)
}
}
-func (f fastpathT) DecMapInt64Uint64X(vp *map[int64]uint64, d *Decoder) {
- v, changed := f.DecMapInt64Uint64V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapUint64Float64X(vp *map[uint64]float64, d *Decoder) {
+ if v, changed := f.DecMapUint64Float64V(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt64Uint64V(v map[int64]uint64, canChange bool,
- d *Decoder) (_ map[int64]uint64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapUint64Float64V(v map[uint64]float64, canChange bool,
+ d *Decoder) (_ map[uint64]float64, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[int64]uint64, xlen)
+ v = make(map[uint64]float64, decInferLen(containerLen, d.h.MaxInitLen, 16))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int64
- var mv uint64
+ var mk uint64
+ var mv float64
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeInt64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = d.d.DecodeUint64()
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -33530,303 +8777,265 @@ func (_ fastpathT) DecMapInt64Uint64V(v map[int64]uint64, canChange bool,
}
continue
}
- mv = dd.DecodeUint64()
+ mv = d.d.DecodeFloat64()
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt64UintptrR(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapUint64BoolR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int64]uintptr)
- v, changed := fastpathTV.DecMapInt64UintptrV(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[uint64]bool)
+ if v, changed := fastpathTV.DecMapUint64BoolV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt64UintptrV(rv2i(rv).(map[int64]uintptr), false, d)
+ fastpathTV.DecMapUint64BoolV(rv2i(rv).(map[uint64]bool), false, d)
}
}
-func (f fastpathT) DecMapInt64UintptrX(vp *map[int64]uintptr, d *Decoder) {
- v, changed := f.DecMapInt64UintptrV(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapUint64BoolX(vp *map[uint64]bool, d *Decoder) {
+ if v, changed := f.DecMapUint64BoolV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt64UintptrV(v map[int64]uintptr, canChange bool,
- d *Decoder) (_ map[int64]uintptr, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapUint64BoolV(v map[uint64]bool, canChange bool,
+ d *Decoder) (_ map[uint64]bool, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[int64]uintptr, xlen)
+ v = make(map[uint64]bool, decInferLen(containerLen, d.h.MaxInitLen, 9))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int64
- var mv uintptr
+ var mk uint64
+ var mv bool
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeInt64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = d.d.DecodeUint64()
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
} else {
- v[mk] = 0
+ v[mk] = false
}
continue
}
- mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
+ mv = d.d.DecodeBool()
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt64IntR(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapIntIntfR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int64]int)
- v, changed := fastpathTV.DecMapInt64IntV(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[int]interface{})
+ if v, changed := fastpathTV.DecMapIntIntfV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt64IntV(rv2i(rv).(map[int64]int), false, d)
+ fastpathTV.DecMapIntIntfV(rv2i(rv).(map[int]interface{}), false, d)
}
}
-func (f fastpathT) DecMapInt64IntX(vp *map[int64]int, d *Decoder) {
- v, changed := f.DecMapInt64IntV(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapIntIntfX(vp *map[int]interface{}, d *Decoder) {
+ if v, changed := f.DecMapIntIntfV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt64IntV(v map[int64]int, canChange bool,
- d *Decoder) (_ map[int64]int, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapIntIntfV(v map[int]interface{}, canChange bool,
+ d *Decoder) (_ map[int]interface{}, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[int64]int, xlen)
+ v = make(map[int]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 24))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int64
- var mv int
+ mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset
+ var mk int
+ var mv interface{}
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeInt64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize))
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
} else {
- v[mk] = 0
+ v[mk] = nil
}
continue
}
- mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize))
+ if mapGet {
+ mv = v[mk]
+ } else {
+ mv = nil
+ }
+ d.decode(&mv)
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt64Int8R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapIntStringR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int64]int8)
- v, changed := fastpathTV.DecMapInt64Int8V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[int]string)
+ if v, changed := fastpathTV.DecMapIntStringV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt64Int8V(rv2i(rv).(map[int64]int8), false, d)
+ fastpathTV.DecMapIntStringV(rv2i(rv).(map[int]string), false, d)
}
}
-func (f fastpathT) DecMapInt64Int8X(vp *map[int64]int8, d *Decoder) {
- v, changed := f.DecMapInt64Int8V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapIntStringX(vp *map[int]string, d *Decoder) {
+ if v, changed := f.DecMapIntStringV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt64Int8V(v map[int64]int8, canChange bool,
- d *Decoder) (_ map[int64]int8, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapIntStringV(v map[int]string, canChange bool,
+ d *Decoder) (_ map[int]string, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[int64]int8, xlen)
+ v = make(map[int]string, decInferLen(containerLen, d.h.MaxInitLen, 24))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int64
- var mv int8
+ var mk int
+ var mv string
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeInt64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize))
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
} else {
- v[mk] = 0
+ v[mk] = ""
}
continue
}
- mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8))
+ mv = d.d.DecodeString()
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt64Int16R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapIntBytesR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int64]int16)
- v, changed := fastpathTV.DecMapInt64Int16V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[int][]byte)
+ if v, changed := fastpathTV.DecMapIntBytesV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt64Int16V(rv2i(rv).(map[int64]int16), false, d)
+ fastpathTV.DecMapIntBytesV(rv2i(rv).(map[int][]byte), false, d)
}
}
-func (f fastpathT) DecMapInt64Int16X(vp *map[int64]int16, d *Decoder) {
- v, changed := f.DecMapInt64Int16V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapIntBytesX(vp *map[int][]byte, d *Decoder) {
+ if v, changed := f.DecMapIntBytesV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt64Int16V(v map[int64]int16, canChange bool,
- d *Decoder) (_ map[int64]int16, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapIntBytesV(v map[int][]byte, canChange bool,
+ d *Decoder) (_ map[int][]byte, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 10)
- v = make(map[int64]int16, xlen)
+ v = make(map[int][]byte, decInferLen(containerLen, d.h.MaxInitLen, 32))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int64
- var mv int16
+ mapGet := v != nil && !d.h.MapValueReset
+ var mk int
+ var mv []byte
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeInt64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize))
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
} else {
- v[mk] = 0
+ v[mk] = nil
}
continue
}
- mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16))
+ if mapGet {
+ mv = v[mk]
+ } else {
+ mv = nil
+ }
+ mv = d.d.DecodeBytes(mv, false)
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt64Int32R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapIntUintR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int64]int32)
- v, changed := fastpathTV.DecMapInt64Int32V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[int]uint)
+ if v, changed := fastpathTV.DecMapIntUintV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt64Int32V(rv2i(rv).(map[int64]int32), false, d)
+ fastpathTV.DecMapIntUintV(rv2i(rv).(map[int]uint), false, d)
}
}
-func (f fastpathT) DecMapInt64Int32X(vp *map[int64]int32, d *Decoder) {
- v, changed := f.DecMapInt64Int32V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapIntUintX(vp *map[int]uint, d *Decoder) {
+ if v, changed := f.DecMapIntUintV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt64Int32V(v map[int64]int32, canChange bool,
- d *Decoder) (_ map[int64]int32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapIntUintV(v map[int]uint, canChange bool,
+ d *Decoder) (_ map[int]uint, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[int64]int32, xlen)
+ v = make(map[int]uint, decInferLen(containerLen, d.h.MaxInitLen, 16))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int64
- var mv int32
+ var mk int
+ var mv uint
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeInt64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize))
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -33835,59 +9044,49 @@ func (_ fastpathT) DecMapInt64Int32V(v map[int64]int32, canChange bool,
}
continue
}
- mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32))
+ mv = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize))
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt64Int64R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapIntUint8R(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int64]int64)
- v, changed := fastpathTV.DecMapInt64Int64V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[int]uint8)
+ if v, changed := fastpathTV.DecMapIntUint8V(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt64Int64V(rv2i(rv).(map[int64]int64), false, d)
+ fastpathTV.DecMapIntUint8V(rv2i(rv).(map[int]uint8), false, d)
}
}
-func (f fastpathT) DecMapInt64Int64X(vp *map[int64]int64, d *Decoder) {
- v, changed := f.DecMapInt64Int64V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapIntUint8X(vp *map[int]uint8, d *Decoder) {
+ if v, changed := f.DecMapIntUint8V(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt64Int64V(v map[int64]int64, canChange bool,
- d *Decoder) (_ map[int64]int64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapIntUint8V(v map[int]uint8, canChange bool,
+ d *Decoder) (_ map[int]uint8, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[int64]int64, xlen)
+ v = make(map[int]uint8, decInferLen(containerLen, d.h.MaxInitLen, 9))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int64
- var mv int64
+ var mk int
+ var mv uint8
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeInt64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize))
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -33896,59 +9095,49 @@ func (_ fastpathT) DecMapInt64Int64V(v map[int64]int64, canChange bool,
}
continue
}
- mv = dd.DecodeInt64()
+ mv = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8))
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt64Float32R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapIntUint64R(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int64]float32)
- v, changed := fastpathTV.DecMapInt64Float32V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[int]uint64)
+ if v, changed := fastpathTV.DecMapIntUint64V(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt64Float32V(rv2i(rv).(map[int64]float32), false, d)
+ fastpathTV.DecMapIntUint64V(rv2i(rv).(map[int]uint64), false, d)
}
}
-func (f fastpathT) DecMapInt64Float32X(vp *map[int64]float32, d *Decoder) {
- v, changed := f.DecMapInt64Float32V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapIntUint64X(vp *map[int]uint64, d *Decoder) {
+ if v, changed := f.DecMapIntUint64V(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt64Float32V(v map[int64]float32, canChange bool,
- d *Decoder) (_ map[int64]float32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapIntUint64V(v map[int]uint64, canChange bool,
+ d *Decoder) (_ map[int]uint64, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 12)
- v = make(map[int64]float32, xlen)
+ v = make(map[int]uint64, decInferLen(containerLen, d.h.MaxInitLen, 16))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int64
- var mv float32
+ var mk int
+ var mv uint64
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeInt64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize))
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -33957,59 +9146,49 @@ func (_ fastpathT) DecMapInt64Float32V(v map[int64]float32, canChange bool,
}
continue
}
- mv = float32(chkOvf.Float32V(dd.DecodeFloat64()))
+ mv = d.d.DecodeUint64()
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt64Float64R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapIntUintptrR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int64]float64)
- v, changed := fastpathTV.DecMapInt64Float64V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[int]uintptr)
+ if v, changed := fastpathTV.DecMapIntUintptrV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt64Float64V(rv2i(rv).(map[int64]float64), false, d)
+ fastpathTV.DecMapIntUintptrV(rv2i(rv).(map[int]uintptr), false, d)
}
}
-func (f fastpathT) DecMapInt64Float64X(vp *map[int64]float64, d *Decoder) {
- v, changed := f.DecMapInt64Float64V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapIntUintptrX(vp *map[int]uintptr, d *Decoder) {
+ if v, changed := f.DecMapIntUintptrV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt64Float64V(v map[int64]float64, canChange bool,
- d *Decoder) (_ map[int64]float64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapIntUintptrV(v map[int]uintptr, canChange bool,
+ d *Decoder) (_ map[int]uintptr, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 16)
- v = make(map[int64]float64, xlen)
+ v = make(map[int]uintptr, decInferLen(containerLen, d.h.MaxInitLen, 16))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int64
- var mv float64
+ var mk int
+ var mv uintptr
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeInt64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize))
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -34018,248 +9197,202 @@ func (_ fastpathT) DecMapInt64Float64V(v map[int64]float64, canChange bool,
}
continue
}
- mv = dd.DecodeFloat64()
+ mv = uintptr(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize))
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapInt64BoolR(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapIntIntR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[int64]bool)
- v, changed := fastpathTV.DecMapInt64BoolV(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[int]int)
+ if v, changed := fastpathTV.DecMapIntIntV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapInt64BoolV(rv2i(rv).(map[int64]bool), false, d)
+ fastpathTV.DecMapIntIntV(rv2i(rv).(map[int]int), false, d)
}
}
-func (f fastpathT) DecMapInt64BoolX(vp *map[int64]bool, d *Decoder) {
- v, changed := f.DecMapInt64BoolV(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapIntIntX(vp *map[int]int, d *Decoder) {
+ if v, changed := f.DecMapIntIntV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapInt64BoolV(v map[int64]bool, canChange bool,
- d *Decoder) (_ map[int64]bool, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapIntIntV(v map[int]int, canChange bool,
+ d *Decoder) (_ map[int]int, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[int64]bool, xlen)
+ v = make(map[int]int, decInferLen(containerLen, d.h.MaxInitLen, 16))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk int64
- var mv bool
+ var mk int
+ var mv int
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeInt64()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize))
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
} else {
- v[mk] = false
+ v[mk] = 0
}
continue
}
- mv = dd.DecodeBool()
+ mv = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize))
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapBoolIntfR(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapIntInt64R(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[bool]interface{})
- v, changed := fastpathTV.DecMapBoolIntfV(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[int]int64)
+ if v, changed := fastpathTV.DecMapIntInt64V(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapBoolIntfV(rv2i(rv).(map[bool]interface{}), false, d)
+ fastpathTV.DecMapIntInt64V(rv2i(rv).(map[int]int64), false, d)
}
}
-func (f fastpathT) DecMapBoolIntfX(vp *map[bool]interface{}, d *Decoder) {
- v, changed := f.DecMapBoolIntfV(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapIntInt64X(vp *map[int]int64, d *Decoder) {
+ if v, changed := f.DecMapIntInt64V(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapBoolIntfV(v map[bool]interface{}, canChange bool,
- d *Decoder) (_ map[bool]interface{}, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapIntInt64V(v map[int]int64, canChange bool,
+ d *Decoder) (_ map[int]int64, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 17)
- v = make(map[bool]interface{}, xlen)
+ v = make(map[int]int64, decInferLen(containerLen, d.h.MaxInitLen, 16))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset
- var mk bool
- var mv interface{}
+ var mk int
+ var mv int64
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeBool()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize))
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
} else {
- v[mk] = nil
+ v[mk] = 0
}
continue
}
- if mapGet {
- mv = v[mk]
- } else {
- mv = nil
- }
- d.decode(&mv)
+ mv = d.d.DecodeInt64()
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapBoolStringR(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapIntFloat32R(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[bool]string)
- v, changed := fastpathTV.DecMapBoolStringV(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[int]float32)
+ if v, changed := fastpathTV.DecMapIntFloat32V(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapBoolStringV(rv2i(rv).(map[bool]string), false, d)
+ fastpathTV.DecMapIntFloat32V(rv2i(rv).(map[int]float32), false, d)
}
}
-func (f fastpathT) DecMapBoolStringX(vp *map[bool]string, d *Decoder) {
- v, changed := f.DecMapBoolStringV(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapIntFloat32X(vp *map[int]float32, d *Decoder) {
+ if v, changed := f.DecMapIntFloat32V(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapBoolStringV(v map[bool]string, canChange bool,
- d *Decoder) (_ map[bool]string, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapIntFloat32V(v map[int]float32, canChange bool,
+ d *Decoder) (_ map[int]float32, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 17)
- v = make(map[bool]string, xlen)
+ v = make(map[int]float32, decInferLen(containerLen, d.h.MaxInitLen, 12))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk bool
- var mv string
+ var mk int
+ var mv float32
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeBool()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize))
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
} else {
- v[mk] = ""
+ v[mk] = 0
}
continue
}
- mv = dd.DecodeString()
+ mv = float32(d.decodeFloat32())
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapBoolUintR(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapIntFloat64R(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[bool]uint)
- v, changed := fastpathTV.DecMapBoolUintV(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[int]float64)
+ if v, changed := fastpathTV.DecMapIntFloat64V(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapBoolUintV(rv2i(rv).(map[bool]uint), false, d)
+ fastpathTV.DecMapIntFloat64V(rv2i(rv).(map[int]float64), false, d)
}
}
-func (f fastpathT) DecMapBoolUintX(vp *map[bool]uint, d *Decoder) {
- v, changed := f.DecMapBoolUintV(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapIntFloat64X(vp *map[int]float64, d *Decoder) {
+ if v, changed := f.DecMapIntFloat64V(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapBoolUintV(v map[bool]uint, canChange bool,
- d *Decoder) (_ map[bool]uint, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapIntFloat64V(v map[int]float64, canChange bool,
+ d *Decoder) (_ map[int]float64, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[bool]uint, xlen)
+ v = make(map[int]float64, decInferLen(containerLen, d.h.MaxInitLen, 16))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk bool
- var mv uint
+ var mk int
+ var mv float64
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeBool()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize))
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -34268,303 +9401,265 @@ func (_ fastpathT) DecMapBoolUintV(v map[bool]uint, canChange bool,
}
continue
}
- mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
+ mv = d.d.DecodeFloat64()
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapBoolUint8R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapIntBoolR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[bool]uint8)
- v, changed := fastpathTV.DecMapBoolUint8V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[int]bool)
+ if v, changed := fastpathTV.DecMapIntBoolV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapBoolUint8V(rv2i(rv).(map[bool]uint8), false, d)
+ fastpathTV.DecMapIntBoolV(rv2i(rv).(map[int]bool), false, d)
}
}
-func (f fastpathT) DecMapBoolUint8X(vp *map[bool]uint8, d *Decoder) {
- v, changed := f.DecMapBoolUint8V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapIntBoolX(vp *map[int]bool, d *Decoder) {
+ if v, changed := f.DecMapIntBoolV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapBoolUint8V(v map[bool]uint8, canChange bool,
- d *Decoder) (_ map[bool]uint8, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapIntBoolV(v map[int]bool, canChange bool,
+ d *Decoder) (_ map[int]bool, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 2)
- v = make(map[bool]uint8, xlen)
+ v = make(map[int]bool, decInferLen(containerLen, d.h.MaxInitLen, 9))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk bool
- var mv uint8
+ var mk int
+ var mv bool
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeBool()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize))
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
} else {
- v[mk] = 0
+ v[mk] = false
}
continue
}
- mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8))
+ mv = d.d.DecodeBool()
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapBoolUint16R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapInt64IntfR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[bool]uint16)
- v, changed := fastpathTV.DecMapBoolUint16V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[int64]interface{})
+ if v, changed := fastpathTV.DecMapInt64IntfV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapBoolUint16V(rv2i(rv).(map[bool]uint16), false, d)
+ fastpathTV.DecMapInt64IntfV(rv2i(rv).(map[int64]interface{}), false, d)
}
}
-func (f fastpathT) DecMapBoolUint16X(vp *map[bool]uint16, d *Decoder) {
- v, changed := f.DecMapBoolUint16V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapInt64IntfX(vp *map[int64]interface{}, d *Decoder) {
+ if v, changed := f.DecMapInt64IntfV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapBoolUint16V(v map[bool]uint16, canChange bool,
- d *Decoder) (_ map[bool]uint16, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapInt64IntfV(v map[int64]interface{}, canChange bool,
+ d *Decoder) (_ map[int64]interface{}, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 3)
- v = make(map[bool]uint16, xlen)
+ v = make(map[int64]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 24))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk bool
- var mv uint16
+ mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset
+ var mk int64
+ var mv interface{}
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeBool()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = d.d.DecodeInt64()
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
} else {
- v[mk] = 0
+ v[mk] = nil
}
continue
}
- mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16))
+ if mapGet {
+ mv = v[mk]
+ } else {
+ mv = nil
+ }
+ d.decode(&mv)
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapBoolUint32R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapInt64StringR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[bool]uint32)
- v, changed := fastpathTV.DecMapBoolUint32V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[int64]string)
+ if v, changed := fastpathTV.DecMapInt64StringV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapBoolUint32V(rv2i(rv).(map[bool]uint32), false, d)
+ fastpathTV.DecMapInt64StringV(rv2i(rv).(map[int64]string), false, d)
}
}
-func (f fastpathT) DecMapBoolUint32X(vp *map[bool]uint32, d *Decoder) {
- v, changed := f.DecMapBoolUint32V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapInt64StringX(vp *map[int64]string, d *Decoder) {
+ if v, changed := f.DecMapInt64StringV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapBoolUint32V(v map[bool]uint32, canChange bool,
- d *Decoder) (_ map[bool]uint32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapInt64StringV(v map[int64]string, canChange bool,
+ d *Decoder) (_ map[int64]string, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[bool]uint32, xlen)
+ v = make(map[int64]string, decInferLen(containerLen, d.h.MaxInitLen, 24))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk bool
- var mv uint32
+ var mk int64
+ var mv string
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeBool()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = d.d.DecodeInt64()
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
} else {
- v[mk] = 0
+ v[mk] = ""
}
continue
}
- mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32))
+ mv = d.d.DecodeString()
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapBoolUint64R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapInt64BytesR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[bool]uint64)
- v, changed := fastpathTV.DecMapBoolUint64V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[int64][]byte)
+ if v, changed := fastpathTV.DecMapInt64BytesV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapBoolUint64V(rv2i(rv).(map[bool]uint64), false, d)
+ fastpathTV.DecMapInt64BytesV(rv2i(rv).(map[int64][]byte), false, d)
}
}
-func (f fastpathT) DecMapBoolUint64X(vp *map[bool]uint64, d *Decoder) {
- v, changed := f.DecMapBoolUint64V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapInt64BytesX(vp *map[int64][]byte, d *Decoder) {
+ if v, changed := f.DecMapInt64BytesV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapBoolUint64V(v map[bool]uint64, canChange bool,
- d *Decoder) (_ map[bool]uint64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapInt64BytesV(v map[int64][]byte, canChange bool,
+ d *Decoder) (_ map[int64][]byte, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[bool]uint64, xlen)
+ v = make(map[int64][]byte, decInferLen(containerLen, d.h.MaxInitLen, 32))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk bool
- var mv uint64
+ mapGet := v != nil && !d.h.MapValueReset
+ var mk int64
+ var mv []byte
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeBool()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = d.d.DecodeInt64()
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
} else {
- v[mk] = 0
+ v[mk] = nil
}
continue
}
- mv = dd.DecodeUint64()
+ if mapGet {
+ mv = v[mk]
+ } else {
+ mv = nil
+ }
+ mv = d.d.DecodeBytes(mv, false)
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapBoolUintptrR(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapInt64UintR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[bool]uintptr)
- v, changed := fastpathTV.DecMapBoolUintptrV(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[int64]uint)
+ if v, changed := fastpathTV.DecMapInt64UintV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapBoolUintptrV(rv2i(rv).(map[bool]uintptr), false, d)
+ fastpathTV.DecMapInt64UintV(rv2i(rv).(map[int64]uint), false, d)
}
}
-func (f fastpathT) DecMapBoolUintptrX(vp *map[bool]uintptr, d *Decoder) {
- v, changed := f.DecMapBoolUintptrV(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapInt64UintX(vp *map[int64]uint, d *Decoder) {
+ if v, changed := f.DecMapInt64UintV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapBoolUintptrV(v map[bool]uintptr, canChange bool,
- d *Decoder) (_ map[bool]uintptr, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapInt64UintV(v map[int64]uint, canChange bool,
+ d *Decoder) (_ map[int64]uint, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[bool]uintptr, xlen)
+ v = make(map[int64]uint, decInferLen(containerLen, d.h.MaxInitLen, 16))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk bool
- var mv uintptr
+ var mk int64
+ var mv uint
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeBool()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = d.d.DecodeInt64()
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -34573,59 +9668,49 @@ func (_ fastpathT) DecMapBoolUintptrV(v map[bool]uintptr, canChange bool,
}
continue
}
- mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))
+ mv = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize))
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapBoolIntR(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapInt64Uint8R(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[bool]int)
- v, changed := fastpathTV.DecMapBoolIntV(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[int64]uint8)
+ if v, changed := fastpathTV.DecMapInt64Uint8V(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapBoolIntV(rv2i(rv).(map[bool]int), false, d)
+ fastpathTV.DecMapInt64Uint8V(rv2i(rv).(map[int64]uint8), false, d)
}
}
-func (f fastpathT) DecMapBoolIntX(vp *map[bool]int, d *Decoder) {
- v, changed := f.DecMapBoolIntV(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapInt64Uint8X(vp *map[int64]uint8, d *Decoder) {
+ if v, changed := f.DecMapInt64Uint8V(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapBoolIntV(v map[bool]int, canChange bool,
- d *Decoder) (_ map[bool]int, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapInt64Uint8V(v map[int64]uint8, canChange bool,
+ d *Decoder) (_ map[int64]uint8, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[bool]int, xlen)
+ v = make(map[int64]uint8, decInferLen(containerLen, d.h.MaxInitLen, 9))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk bool
- var mv int
+ var mk int64
+ var mv uint8
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeBool()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = d.d.DecodeInt64()
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -34634,59 +9719,49 @@ func (_ fastpathT) DecMapBoolIntV(v map[bool]int, canChange bool,
}
continue
}
- mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize))
+ mv = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8))
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapBoolInt8R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapInt64Uint64R(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[bool]int8)
- v, changed := fastpathTV.DecMapBoolInt8V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[int64]uint64)
+ if v, changed := fastpathTV.DecMapInt64Uint64V(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapBoolInt8V(rv2i(rv).(map[bool]int8), false, d)
+ fastpathTV.DecMapInt64Uint64V(rv2i(rv).(map[int64]uint64), false, d)
}
}
-func (f fastpathT) DecMapBoolInt8X(vp *map[bool]int8, d *Decoder) {
- v, changed := f.DecMapBoolInt8V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapInt64Uint64X(vp *map[int64]uint64, d *Decoder) {
+ if v, changed := f.DecMapInt64Uint64V(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapBoolInt8V(v map[bool]int8, canChange bool,
- d *Decoder) (_ map[bool]int8, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapInt64Uint64V(v map[int64]uint64, canChange bool,
+ d *Decoder) (_ map[int64]uint64, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 2)
- v = make(map[bool]int8, xlen)
+ v = make(map[int64]uint64, decInferLen(containerLen, d.h.MaxInitLen, 16))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk bool
- var mv int8
+ var mk int64
+ var mv uint64
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeBool()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = d.d.DecodeInt64()
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -34695,59 +9770,49 @@ func (_ fastpathT) DecMapBoolInt8V(v map[bool]int8, canChange bool,
}
continue
}
- mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8))
+ mv = d.d.DecodeUint64()
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapBoolInt16R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapInt64UintptrR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[bool]int16)
- v, changed := fastpathTV.DecMapBoolInt16V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[int64]uintptr)
+ if v, changed := fastpathTV.DecMapInt64UintptrV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapBoolInt16V(rv2i(rv).(map[bool]int16), false, d)
+ fastpathTV.DecMapInt64UintptrV(rv2i(rv).(map[int64]uintptr), false, d)
}
}
-func (f fastpathT) DecMapBoolInt16X(vp *map[bool]int16, d *Decoder) {
- v, changed := f.DecMapBoolInt16V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapInt64UintptrX(vp *map[int64]uintptr, d *Decoder) {
+ if v, changed := f.DecMapInt64UintptrV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapBoolInt16V(v map[bool]int16, canChange bool,
- d *Decoder) (_ map[bool]int16, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapInt64UintptrV(v map[int64]uintptr, canChange bool,
+ d *Decoder) (_ map[int64]uintptr, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 3)
- v = make(map[bool]int16, xlen)
+ v = make(map[int64]uintptr, decInferLen(containerLen, d.h.MaxInitLen, 16))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk bool
- var mv int16
+ var mk int64
+ var mv uintptr
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeBool()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = d.d.DecodeInt64()
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -34756,59 +9821,49 @@ func (_ fastpathT) DecMapBoolInt16V(v map[bool]int16, canChange bool,
}
continue
}
- mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16))
+ mv = uintptr(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize))
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapBoolInt32R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapInt64IntR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[bool]int32)
- v, changed := fastpathTV.DecMapBoolInt32V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[int64]int)
+ if v, changed := fastpathTV.DecMapInt64IntV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapBoolInt32V(rv2i(rv).(map[bool]int32), false, d)
+ fastpathTV.DecMapInt64IntV(rv2i(rv).(map[int64]int), false, d)
}
}
-func (f fastpathT) DecMapBoolInt32X(vp *map[bool]int32, d *Decoder) {
- v, changed := f.DecMapBoolInt32V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapInt64IntX(vp *map[int64]int, d *Decoder) {
+ if v, changed := f.DecMapInt64IntV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapBoolInt32V(v map[bool]int32, canChange bool,
- d *Decoder) (_ map[bool]int32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapInt64IntV(v map[int64]int, canChange bool,
+ d *Decoder) (_ map[int64]int, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[bool]int32, xlen)
+ v = make(map[int64]int, decInferLen(containerLen, d.h.MaxInitLen, 16))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk bool
- var mv int32
+ var mk int64
+ var mv int
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeBool()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = d.d.DecodeInt64()
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -34817,59 +9872,49 @@ func (_ fastpathT) DecMapBoolInt32V(v map[bool]int32, canChange bool,
}
continue
}
- mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32))
+ mv = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize))
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapBoolInt64R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapInt64Int64R(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[bool]int64)
- v, changed := fastpathTV.DecMapBoolInt64V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[int64]int64)
+ if v, changed := fastpathTV.DecMapInt64Int64V(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapBoolInt64V(rv2i(rv).(map[bool]int64), false, d)
+ fastpathTV.DecMapInt64Int64V(rv2i(rv).(map[int64]int64), false, d)
}
}
-func (f fastpathT) DecMapBoolInt64X(vp *map[bool]int64, d *Decoder) {
- v, changed := f.DecMapBoolInt64V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapInt64Int64X(vp *map[int64]int64, d *Decoder) {
+ if v, changed := f.DecMapInt64Int64V(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapBoolInt64V(v map[bool]int64, canChange bool,
- d *Decoder) (_ map[bool]int64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapInt64Int64V(v map[int64]int64, canChange bool,
+ d *Decoder) (_ map[int64]int64, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[bool]int64, xlen)
+ v = make(map[int64]int64, decInferLen(containerLen, d.h.MaxInitLen, 16))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk bool
+ var mk int64
var mv int64
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeBool()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = d.d.DecodeInt64()
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -34878,59 +9923,49 @@ func (_ fastpathT) DecMapBoolInt64V(v map[bool]int64, canChange bool,
}
continue
}
- mv = dd.DecodeInt64()
+ mv = d.d.DecodeInt64()
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapBoolFloat32R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapInt64Float32R(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[bool]float32)
- v, changed := fastpathTV.DecMapBoolFloat32V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[int64]float32)
+ if v, changed := fastpathTV.DecMapInt64Float32V(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapBoolFloat32V(rv2i(rv).(map[bool]float32), false, d)
+ fastpathTV.DecMapInt64Float32V(rv2i(rv).(map[int64]float32), false, d)
}
}
-func (f fastpathT) DecMapBoolFloat32X(vp *map[bool]float32, d *Decoder) {
- v, changed := f.DecMapBoolFloat32V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapInt64Float32X(vp *map[int64]float32, d *Decoder) {
+ if v, changed := f.DecMapInt64Float32V(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapBoolFloat32V(v map[bool]float32, canChange bool,
- d *Decoder) (_ map[bool]float32, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapInt64Float32V(v map[int64]float32, canChange bool,
+ d *Decoder) (_ map[int64]float32, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 5)
- v = make(map[bool]float32, xlen)
+ v = make(map[int64]float32, decInferLen(containerLen, d.h.MaxInitLen, 12))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk bool
+ var mk int64
var mv float32
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeBool()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = d.d.DecodeInt64()
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -34939,59 +9974,49 @@ func (_ fastpathT) DecMapBoolFloat32V(v map[bool]float32, canChange bool,
}
continue
}
- mv = float32(chkOvf.Float32V(dd.DecodeFloat64()))
+ mv = float32(d.decodeFloat32())
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapBoolFloat64R(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapInt64Float64R(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[bool]float64)
- v, changed := fastpathTV.DecMapBoolFloat64V(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[int64]float64)
+ if v, changed := fastpathTV.DecMapInt64Float64V(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapBoolFloat64V(rv2i(rv).(map[bool]float64), false, d)
+ fastpathTV.DecMapInt64Float64V(rv2i(rv).(map[int64]float64), false, d)
}
}
-func (f fastpathT) DecMapBoolFloat64X(vp *map[bool]float64, d *Decoder) {
- v, changed := f.DecMapBoolFloat64V(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapInt64Float64X(vp *map[int64]float64, d *Decoder) {
+ if v, changed := f.DecMapInt64Float64V(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapBoolFloat64V(v map[bool]float64, canChange bool,
- d *Decoder) (_ map[bool]float64, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapInt64Float64V(v map[int64]float64, canChange bool,
+ d *Decoder) (_ map[int64]float64, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 9)
- v = make(map[bool]float64, xlen)
+ v = make(map[int64]float64, decInferLen(containerLen, d.h.MaxInitLen, 16))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk bool
+ var mk int64
var mv float64
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeBool()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = d.d.DecodeInt64()
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -35000,59 +10025,49 @@ func (_ fastpathT) DecMapBoolFloat64V(v map[bool]float64, canChange bool,
}
continue
}
- mv = dd.DecodeFloat64()
+ mv = d.d.DecodeFloat64()
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
-func (d *Decoder) fastpathDecMapBoolBoolR(f *codecFnInfo, rv reflect.Value) {
+func (d *Decoder) fastpathDecMapInt64BoolR(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
- vp := rv2i(rv).(*map[bool]bool)
- v, changed := fastpathTV.DecMapBoolBoolV(*vp, true, d)
- if changed {
+ vp := rv2i(rv).(*map[int64]bool)
+ if v, changed := fastpathTV.DecMapInt64BoolV(*vp, true, d); changed {
*vp = v
}
} else {
- fastpathTV.DecMapBoolBoolV(rv2i(rv).(map[bool]bool), false, d)
+ fastpathTV.DecMapInt64BoolV(rv2i(rv).(map[int64]bool), false, d)
}
}
-func (f fastpathT) DecMapBoolBoolX(vp *map[bool]bool, d *Decoder) {
- v, changed := f.DecMapBoolBoolV(*vp, true, d)
- if changed {
+func (f fastpathT) DecMapInt64BoolX(vp *map[int64]bool, d *Decoder) {
+ if v, changed := f.DecMapInt64BoolV(*vp, true, d); changed {
*vp = v
}
}
-func (_ fastpathT) DecMapBoolBoolV(v map[bool]bool, canChange bool,
- d *Decoder) (_ map[bool]bool, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators()
- containerLen := dd.ReadMapStart()
+func (fastpathT) DecMapInt64BoolV(v map[int64]bool, canChange bool,
+ d *Decoder) (_ map[int64]bool, changed bool) {
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, 2)
- v = make(map[bool]bool, xlen)
+ v = make(map[int64]bool, decInferLen(containerLen, d.h.MaxInitLen, 9))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- var mk bool
+ var mk int64
var mv bool
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep {
- dd.ReadMapElemKey()
- }
- mk = dd.DecodeBool()
- if esep {
- dd.ReadMapElemValue()
- }
- if dd.TryDecodeAsNil() {
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
+ mk = d.d.DecodeInt64()
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {
} else if d.h.DeleteOnNilMapValue {
delete(v, mk)
@@ -35061,12 +10076,11 @@ func (_ fastpathT) DecMapBoolBoolV(v map[bool]bool, canChange bool,
}
continue
}
- mv = dd.DecodeBool()
+ mv = d.d.DecodeBool()
if v != nil {
v[mk] = mv
}
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
diff --git a/vendor/github.com/ugorji/go/codec/fast-path.go.tmpl b/vendor/github.com/ugorji/go/codec/fast-path.go.tmpl
index 40c28275..b3b464ed 100644
--- a/vendor/github.com/ugorji/go/codec/fast-path.go.tmpl
+++ b/vendor/github.com/ugorji/go/codec/fast-path.go.tmpl
@@ -10,7 +10,7 @@ package codec
// Fast path functions try to create a fast path encode or decode implementation
// for common maps and slices.
//
-// We define the functions and register then in this single file
+// We define the functions and register them in this single file
// so as not to pollute the encode.go and decode.go, and create a dependency in there.
// This file can be omitted without causing a build failure.
//
@@ -18,9 +18,10 @@ package codec
// - Many calls bypass reflection altogether
//
// Currently support
-// - slice of all builtin types,
-// - map of all builtin types to string or interface value
-// - symmetrical maps of all builtin types (e.g. str-str, uint8-uint8)
+// - slice of all builtin types (numeric, bool, string, []byte)
+// - maps of builtin types to builtin or interface{} type, EXCEPT FOR
+// keys of type uintptr, int8/16/32, uint16/32, float32/64, bool, interface{}
+// AND values of type type int8/16/32, uint16/32
// This should provide adequate "typical" implementations.
//
// Note that fast track decode functions must handle values for which an address cannot be obtained.
@@ -187,58 +188,35 @@ func (e *Encoder) {{ .MethodNamePfx "fastpathEnc" false }}R(f *codecFnInfo, rv r
fastpathTV.{{ .MethodNamePfx "Enc" false }}V(rv2i(rv).([]{{ .Elem }}), e)
}
}
-func (_ fastpathT) {{ .MethodNamePfx "Enc" false }}V(v []{{ .Elem }}, e *Encoder) {
- if v == nil { e.e.EncodeNil(); return }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteArrayStart(len(v))
- if esep {
- for _, v2 := range v {
- ee.WriteArrayElem()
- {{ encmd .Elem "v2"}}
- }
- } else {
- for _, v2 := range v {
- {{ encmd .Elem "v2"}}
- }
- } {{/*
- for _, v2 := range v {
- if esep { ee.WriteArrayElem() }
- {{ encmd .Elem "v2"}}
- } */}}
- ee.WriteArrayEnd()
-}
-func (_ fastpathT) {{ .MethodNamePfx "EncAsMap" false }}V(v []{{ .Elem }}, e *Encoder) {
- ee, esep := e.e, e.hh.hasElemSeparators()
- if len(v)%2 == 1 {
- e.errorf(fastpathMapBySliceErrMsg, len(v))
+func (fastpathT) {{ .MethodNamePfx "Enc" false }}V(v []{{ .Elem }}, e *Encoder) {
+ if v == nil {
+ e.e.EncodeNil()
return
}
- ee.WriteMapStart(len(v) / 2)
- if esep {
- for j, v2 := range v {
- if j%2 == 0 {
- ee.WriteMapElemKey()
- } else {
- ee.WriteMapElemValue()
- }
- {{ encmd .Elem "v2"}}
- }
+ e.arrayStart(len(v))
+ for j := range v {
+ e.arrayElem()
+ {{ encmd .Elem "v[j]"}}
+ }
+ e.arrayEnd()
+}
+func (fastpathT) {{ .MethodNamePfx "EncAsMap" false }}V(v []{{ .Elem }}, e *Encoder) {
+ if v == nil {
+ e.e.EncodeNil()
+ } else if len(v)%2 == 1 {
+ e.errorf(fastpathMapBySliceErrMsg, len(v))
} else {
- for _, v2 := range v {
- {{ encmd .Elem "v2"}}
- }
- } {{/*
- for j, v2 := range v {
- if esep {
+ e.mapStart(len(v) / 2)
+ for j := range v {
if j%2 == 0 {
- ee.WriteMapElemKey()
+ e.mapElemKey()
} else {
- ee.WriteMapElemValue()
+ e.mapElemValue()
}
- }
- {{ encmd .Elem "v2"}}
- } */}}
- ee.WriteMapEnd()
+ {{ encmd .Elem "v[j]"}}
+ }
+ e.mapEnd()
+ }
}
{{end}}{{end}}{{end}}
@@ -246,17 +224,16 @@ func (_ fastpathT) {{ .MethodNamePfx "EncAsMap" false }}V(v []{{ .Elem }}, e *En
func (e *Encoder) {{ .MethodNamePfx "fastpathEnc" false }}R(f *codecFnInfo, rv reflect.Value) {
fastpathTV.{{ .MethodNamePfx "Enc" false }}V(rv2i(rv).(map[{{ .MapKey }}]{{ .Elem }}), e)
}
-func (_ fastpathT) {{ .MethodNamePfx "Enc" false }}V(v map[{{ .MapKey }}]{{ .Elem }}, e *Encoder) {
+func (fastpathT) {{ .MethodNamePfx "Enc" false }}V(v map[{{ .MapKey }}]{{ .Elem }}, e *Encoder) {
if v == nil { e.e.EncodeNil(); return }
- ee, esep := e.e, e.hh.hasElemSeparators()
- ee.WriteMapStart(len(v))
- if e.h.Canonical {
- {{if eq .MapKey "interface{}"}}{{/* out of band
- */}}var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
+ e.mapStart(len(v))
+ if e.h.Canonical { {{/* need to figure out .NoCanonical */}}
+ {{if eq .MapKey "interface{}"}}{{/* out of band */ -}}
+ var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding
e2 := NewEncoderBytes(&mksv, e.hh)
- v2 := make([]bytesI, len(v))
+ v2 := make([]bytesIntf, len(v))
var i, l uint
- var vp *bytesI {{/* put loop variables outside. seems currently needed for better perf */}}
+ var vp *bytesIntf {{/* put loop variables outside. seems currently needed for better perf */}}
for k2 := range v {
l = uint(len(mksv))
e2.MustEncode(k2)
@@ -265,73 +242,34 @@ func (_ fastpathT) {{ .MethodNamePfx "Enc" false }}V(v map[{{ .MapKey }}]{{ .Ele
vp.i = k2
i++
}
- sort.Sort(bytesISlice(v2))
- if esep {
- for j := range v2 {
- ee.WriteMapElemKey()
- e.asis(v2[j].v)
- ee.WriteMapElemValue()
- e.encode(v[v2[j].i])
- }
- } else {
- for j := range v2 {
- e.asis(v2[j].v)
- e.encode(v[v2[j].i])
- }
- } {{/*
+ sort.Sort(bytesIntfSlice(v2))
for j := range v2 {
- if esep { ee.WriteMapElemKey() }
+ e.mapElemKey()
e.asis(v2[j].v)
- if esep { ee.WriteMapElemValue() }
+ e.mapElemValue()
e.encode(v[v2[j].i])
- } */}} {{else}}{{ $x := sorttype .MapKey true}}v2 := make([]{{ $x }}, len(v))
+ } {{else}}{{ $x := sorttype .MapKey true}}v2 := make([]{{ $x }}, len(v))
var i uint
for k := range v {
- v2[i] = {{ $x }}(k)
+ v2[i] = {{if eq $x .MapKey}}k{{else}}{{ $x }}(k){{end}}
i++
}
sort.Sort({{ sorttype .MapKey false}}(v2))
- if esep {
- for _, k2 := range v2 {
- ee.WriteMapElemKey()
- {{if eq .MapKey "string"}}ee.EncodeStringEnc(cUTF8, k2){{else}}{{ $y := printf "%s(k2)" .MapKey }}{{ encmd .MapKey $y }}{{end}}
- ee.WriteMapElemValue()
- {{ $y := printf "v[%s(k2)]" .MapKey }}{{ encmd .Elem $y }}
- }
- } else {
- for _, k2 := range v2 {
- {{if eq .MapKey "string"}}ee.EncodeStringEnc(cUTF8, k2){{else}}{{ $y := printf "%s(k2)" .MapKey }}{{ encmd .MapKey $y }}{{end}}
- {{ $y := printf "v[%s(k2)]" .MapKey }}{{ encmd .Elem $y }}
- }
- } {{/*
for _, k2 := range v2 {
- if esep { ee.WriteMapElemKey() }
- {{if eq .MapKey "string"}}ee.EncodeStringEnc(cUTF8, k2){{else}}{{ $y := printf "%s(k2)" .MapKey }}{{ encmd .MapKey $y }}{{end}}
- if esep { ee.WriteMapElemValue() }
- {{ $y := printf "v[%s(k2)]" .MapKey }}{{ encmd .Elem $y }}
- } */}} {{end}}
- } else {
- if esep {
- for k2, v2 := range v {
- ee.WriteMapElemKey()
- {{if eq .MapKey "string"}}ee.EncodeStringEnc(cUTF8, k2){{else}}{{ encmd .MapKey "k2"}}{{end}}
- ee.WriteMapElemValue()
- {{ encmd .Elem "v2"}}
- }
- } else {
- for k2, v2 := range v {
- {{if eq .MapKey "string"}}ee.EncodeStringEnc(cUTF8, k2){{else}}{{ encmd .MapKey "k2"}}{{end}}
- {{ encmd .Elem "v2"}}
- }
- } {{/*
+ e.mapElemKey()
+ {{if eq .MapKey "string"}} if e.h.StringToRaw {e.e.EncodeStringBytesRaw(bytesView(k2))} else {e.e.EncodeStringEnc(cUTF8, k2)} {{else}}{{ $y := printf "%s(k2)" .MapKey }}{{if eq $x .MapKey }}{{ $y = "k2" }}{{end}}{{ encmd .MapKey $y }}{{end}}
+ e.mapElemValue()
+ {{ $y := printf "v[%s(k2)]" .MapKey }}{{if eq $x .MapKey }}{{ $y = "v[k2]" }}{{end}}{{ encmd .Elem $y }}
+ } {{end}}
+ } else {
for k2, v2 := range v {
- if esep { ee.WriteMapElemKey() }
- {{if eq .MapKey "string"}}ee.EncodeStringEnc(cUTF8, k2){{else}}{{ encmd .MapKey "k2"}}{{end}}
- if esep { ee.WriteMapElemValue() }
+ e.mapElemKey()
+ {{if eq .MapKey "string"}} if e.h.StringToRaw {e.e.EncodeStringBytesRaw(bytesView(k2))} else {e.e.EncodeStringEnc(cUTF8, k2)} {{else}}{{ encmd .MapKey "k2"}}{{end}}
+ e.mapElemValue()
{{ encmd .Elem "v2"}}
- } */}}
+ }
}
- ee.WriteMapEnd()
+ e.mapEnd()
}
{{end}}{{end}}{{end}}
@@ -402,8 +340,7 @@ Slices can change if they
func (d *Decoder) {{ .MethodNamePfx "fastpathDec" false }}R(f *codecFnInfo, rv reflect.Value) {
if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr {
vp := rv2i(rv).(*[]{{ .Elem }})
- v, changed := fastpathTV.{{ .MethodNamePfx "Dec" false }}V(*vp, !array, d)
- if changed { *vp = v }
+ if v, changed := fastpathTV.{{ .MethodNamePfx "Dec" false }}V(*vp, !array, d); changed { *vp = v }
} else {
v := rv2i(rv).([]{{ .Elem }})
v2, changed := fastpathTV.{{ .MethodNamePfx "Dec" false }}V(v, !array, d)
@@ -413,13 +350,12 @@ func (d *Decoder) {{ .MethodNamePfx "fastpathDec" false }}R(f *codecFnInfo, rv r
}
}
func (f fastpathT) {{ .MethodNamePfx "Dec" false }}X(vp *[]{{ .Elem }}, d *Decoder) {
- v, changed := f.{{ .MethodNamePfx "Dec" false }}V(*vp, true, d)
- if changed { *vp = v }
+ if v, changed := f.{{ .MethodNamePfx "Dec" false }}V(*vp, true, d); changed { *vp = v }
}
-func (_ fastpathT) {{ .MethodNamePfx "Dec" false }}V(v []{{ .Elem }}, canChange bool, d *Decoder) (_ []{{ .Elem }}, changed bool) {
- dd := d.d{{/*
- // if dd.isContainerType(valueTypeNil) { dd.TryDecodeAsNil()
- */}}
+func (fastpathT) {{ .MethodNamePfx "Dec" false }}V(v []{{ .Elem }}, canChange bool, d *Decoder) (_ []{{ .Elem }}, changed bool) {
+ {{/* dd := d.d
+ // if d.d.isContainerType(valueTypeNil) { d.d.TryDecodeAsNil() }
+ */ -}}
slh, containerLenS := d.decSliceHelperStart()
if containerLenS == 0 {
if canChange {
@@ -429,7 +365,6 @@ func (_ fastpathT) {{ .MethodNamePfx "Dec" false }}V(v []{{ .Elem }}, canChange
slh.End()
return v, changed
}
- d.depthIncr()
hasLen := containerLenS > 0
var xlen int
if hasLen && canChange {
@@ -447,7 +382,7 @@ func (_ fastpathT) {{ .MethodNamePfx "Dec" false }}V(v []{{ .Elem }}, canChange
}
}
var j int
- for j = 0; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ {
+ for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.d.CheckBreak()); j++ {
if j == 0 && len(v) == 0 && canChange {
if hasLen {
xlen = decInferLen(containerLenS, d.h.MaxInitLen, {{ .Size }})
@@ -457,7 +392,7 @@ func (_ fastpathT) {{ .MethodNamePfx "Dec" false }}V(v []{{ .Elem }}, canChange
v = make([]{{ .Elem }}, uint(xlen))
changed = true
}
- // if indefinite, etc, then expand the slice if necessary
+ {{/* // if indefinite, etc, then expand the slice if necessary */ -}}
var decodeIntoBlank bool
if j >= len(v) {
if canChange {
@@ -471,7 +406,7 @@ func (_ fastpathT) {{ .MethodNamePfx "Dec" false }}V(v []{{ .Elem }}, canChange
slh.ElemContainerState(j)
if decodeIntoBlank {
d.swallow()
- } else if dd.TryDecodeAsNil() {
+ } else if d.d.TryDecodeAsNil() {
v[uint(j)] = {{ zerocmd .Elem }}
} else {
{{ if eq .Elem "interface{}" }}d.decode(&v[uint(j)]){{ else }}v[uint(j)] = {{ decmd .Elem }}{{ end }}
@@ -487,7 +422,6 @@ func (_ fastpathT) {{ .MethodNamePfx "Dec" false }}V(v []{{ .Elem }}, canChange
}
}
slh.End()
- d.depthDecr()
return v, changed
}
{{end}}{{end}}{{end}}
@@ -501,54 +435,59 @@ Maps can change if they are
func (d *Decoder) {{ .MethodNamePfx "fastpathDec" false }}R(f *codecFnInfo, rv reflect.Value) {
if rv.Kind() == reflect.Ptr {
vp := rv2i(rv).(*map[{{ .MapKey }}]{{ .Elem }})
- v, changed := fastpathTV.{{ .MethodNamePfx "Dec" false }}V(*vp, true, d);
- if changed { *vp = v }
+ if v, changed := fastpathTV.{{ .MethodNamePfx "Dec" false }}V(*vp, true, d); changed { *vp = v }
} else {
fastpathTV.{{ .MethodNamePfx "Dec" false }}V(rv2i(rv).(map[{{ .MapKey }}]{{ .Elem }}), false, d)
}
}
func (f fastpathT) {{ .MethodNamePfx "Dec" false }}X(vp *map[{{ .MapKey }}]{{ .Elem }}, d *Decoder) {
- v, changed := f.{{ .MethodNamePfx "Dec" false }}V(*vp, true, d)
- if changed { *vp = v }
+ if v, changed := f.{{ .MethodNamePfx "Dec" false }}V(*vp, true, d); changed { *vp = v }
}
-func (_ fastpathT) {{ .MethodNamePfx "Dec" false }}V(v map[{{ .MapKey }}]{{ .Elem }}, canChange bool,
+func (fastpathT) {{ .MethodNamePfx "Dec" false }}V(v map[{{ .MapKey }}]{{ .Elem }}, canChange bool,
d *Decoder) (_ map[{{ .MapKey }}]{{ .Elem }}, changed bool) {
- dd, esep := d.d, d.hh.hasElemSeparators(){{/*
- // if dd.isContainerType(valueTypeNil) {dd.TryDecodeAsNil()
- */}}
- containerLen := dd.ReadMapStart()
+ {{/*
+ // if d.d.isContainerType(valueTypeNil) {d.d.TryDecodeAsNil()
+ */ -}}
+ containerLen := d.mapStart()
if canChange && v == nil {
- xlen := decInferLen(containerLen, d.h.MaxInitLen, {{ .Size }})
- v = make(map[{{ .MapKey }}]{{ .Elem }}, xlen)
+ v = make(map[{{ .MapKey }}]{{ .Elem }}, decInferLen(containerLen, d.h.MaxInitLen, {{ .Size }}))
changed = true
}
if containerLen == 0 {
- dd.ReadMapEnd()
+ d.mapEnd()
return v, changed
}
- d.depthIncr()
- {{ if eq .Elem "interface{}" }}mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset
- {{end}}var mk {{ .MapKey }}
+ {{if eq .Elem "interface{}" }}mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset
+ {{else if eq .Elem "bytes" "[]byte" }}mapGet := v != nil && !d.h.MapValueReset
+ {{end -}}
+ var mk {{ .MapKey }}
var mv {{ .Elem }}
hasLen := containerLen > 0
- for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ {
- if esep { dd.ReadMapElemKey() }
+ for j := 0; (hasLen && j < containerLen) || !(hasLen || d.d.CheckBreak()); j++ {
+ d.mapElemKey()
{{ if eq .MapKey "interface{}" }}mk = nil
d.decode(&mk)
if bv, bok := mk.([]byte); bok {
mk = d.string(bv) {{/* // maps cannot have []byte as key. switch to string. */}}
}{{ else }}mk = {{ decmd .MapKey }}{{ end }}
- if esep { dd.ReadMapElemValue() }
- if dd.TryDecodeAsNil() {
+ d.mapElemValue()
+ if d.d.TryDecodeAsNil() {
if v == nil {} else if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = {{ zerocmd .Elem }} }
continue
}
- {{ if eq .Elem "interface{}" }}if mapGet { mv = v[mk] } else { mv = nil }
- d.decode(&mv){{ else }}mv = {{ decmd .Elem }}{{ end }}
+ {{ if eq .Elem "interface{}" "[]byte" "bytes" -}}
+ if mapGet { mv = v[mk] } else { mv = nil }
+ {{ end -}}
+ {{ if eq .Elem "interface{}" -}}
+ d.decode(&mv)
+ {{ else if eq .Elem "[]byte" "bytes" -}}
+ mv = d.d.DecodeBytes(mv, false)
+ {{ else -}}
+ mv = {{ decmd .Elem }}
+ {{ end -}}
if v != nil { v[mk] = mv }
}
- dd.ReadMapEnd()
- d.depthDecr()
+ d.mapEnd()
return v, changed
}
{{end}}{{end}}{{end}}
diff --git a/vendor/github.com/ugorji/go/codec/gen-dec-array.go.tmpl b/vendor/github.com/ugorji/go/codec/gen-dec-array.go.tmpl
index 790e914e..8d182760 100644
--- a/vendor/github.com/ugorji/go/codec/gen-dec-array.go.tmpl
+++ b/vendor/github.com/ugorji/go/codec/gen-dec-array.go.tmpl
@@ -12,7 +12,8 @@ if {{var "l"}} == 0 {
} {{else if isChan }}if {{var "v"}} == nil {
{{var "v"}} = make({{ .CTyp }}, 0)
{{var "c"}} = true
- } {{end}}
+ }
+ {{end -}}
} else {
{{var "hl"}} := {{var "l"}} > 0
var {{var "rl"}} int
@@ -30,9 +31,10 @@ if {{var "l"}} == 0 {
{{var "v"}} = {{var "v"}}[:{{var "l"}}]
{{var "c"}} = true
}
- } {{end}}
+ }
+ {{end -}}
var {{var "j"}} int
- // var {{var "dn"}} bool
+ {{/* // var {{var "dn"}} bool */ -}}
for {{var "j"}} = 0; ({{var "hl"}} && {{var "j"}} < {{var "l"}}) || !({{var "hl"}} || r.CheckBreak()); {{var "j"}}++ { // bounds-check-elimination
{{if not isArray}} if {{var "j"}} == 0 && {{var "v"}} == nil {
if {{var "hl"}} {
@@ -42,27 +44,28 @@ if {{var "l"}} == 0 {
}
{{var "v"}} = make({{if isSlice}}[]{{ .Typ }}{{else if isChan}}{{.CTyp}}{{end}}, {{var "rl"}})
{{var "c"}} = true
- }{{end}}
+ }
+ {{end -}}
{{var "h"}}.ElemContainerState({{var "j"}})
- {{/* {{var "dn"}} = r.TryDecodeAsNil() */}}{{/* commented out, as decLineVar handles this already each time */}}
+ {{/* {{var "dn"}} = r.TryDecodeAsNil() */}}{{/* commented out, as decLineVar handles this already each time */ -}}
{{if isChan}}{{ $x := printf "%[1]vvcx%[2]v" .TempVar .Rand }}var {{$x}} {{ .Typ }}
- {{ decLineVar $x }}
+ {{ decLineVar $x -}}
{{var "v"}} <- {{ $x }}
// println(">>>> sending ", {{ $x }}, " into ", {{var "v"}}) // TODO: remove this
- {{else}}{{/* // if indefinite, etc, then expand the slice if necessary */}}
+ {{else}}{{/* // if indefinite, etc, then expand the slice if necessary */ -}}
var {{var "db"}} bool
if {{var "j"}} >= len({{var "v"}}) {
{{if isSlice }} {{var "v"}} = append({{var "v"}}, {{ zero }})
{{var "c"}} = true
{{else}} z.DecArrayCannotExpand(len(v), {{var "j"}}+1); {{var "db"}} = true
- {{end}}
+ {{end -}}
}
if {{var "db"}} {
z.DecSwallow()
} else {
- {{ $x := printf "%[1]vv%[2]v[%[1]vj%[2]v]" .TempVar .Rand }}{{ decLineVar $x }}
+ {{ $x := printf "%[1]vv%[2]v[%[1]vj%[2]v]" .TempVar .Rand }}{{ decLineVar $x -}}
}
- {{end}}
+ {{end -}}
}
{{if isSlice}} if {{var "j"}} < len({{var "v"}}) {
{{var "v"}} = {{var "v"}}[:{{var "j"}}]
@@ -70,9 +73,11 @@ if {{var "l"}} == 0 {
} else if {{var "j"}} == 0 && {{var "v"}} == nil {
{{var "v"}} = make([]{{ .Typ }}, 0)
{{var "c"}} = true
- } {{end}}
+ }
+ {{end -}}
}
{{var "h"}}.End()
{{if not isArray }}if {{var "c"}} {
*{{ .Varname }} = {{var "v"}}
-}{{end}}
+}
+{{end -}}
diff --git a/vendor/github.com/ugorji/go/codec/gen-dec-map.go.tmpl b/vendor/github.com/ugorji/go/codec/gen-dec-map.go.tmpl
index 8323b549..2df0103c 100644
--- a/vendor/github.com/ugorji/go/codec/gen-dec-map.go.tmpl
+++ b/vendor/github.com/ugorji/go/codec/gen-dec-map.go.tmpl
@@ -1,5 +1,5 @@
{{var "v"}} := *{{ .Varname }}
-{{var "l"}} := r.ReadMapStart()
+{{var "l"}} := z.DecReadMapStart()
{{var "bh"}} := z.DecBasicHandle()
if {{var "v"}} == nil {
{{var "rl"}} := z.DecInferLen({{var "l"}}, {{var "bh"}}.MaxInitLen, {{ .Size }})
@@ -17,21 +17,29 @@ if {{var "bh"}}.MapValueReset {
if {{var "l"}} != 0 {
{{var "hl"}} := {{var "l"}} > 0
for {{var "j"}} := 0; ({{var "hl"}} && {{var "j"}} < {{var "l"}}) || !({{var "hl"}} || r.CheckBreak()); {{var "j"}}++ {
- r.ReadMapElemKey() {{/* z.DecSendContainerState(codecSelfer_containerMapKey{{ .Sfx }}) */}}
- {{ $x := printf "%vmk%v" .TempVar .Rand }}{{ decLineVarK $x }}
-{{ if eq .KTyp "interface{}" }}{{/* // special case if a byte array. */}}if {{var "bv"}}, {{var "bok"}} := {{var "mk"}}.([]byte); {{var "bok"}} {
+ z.DecReadMapElemKey() {{/* z.DecSendContainerState(codecSelfer_containerMapKey{{ .Sfx }}) */}}
+ {{ $x := printf "%vmk%v" .TempVar .Rand }}{{ decLineVarK $x -}}
+ {{ if eq .KTyp "interface{}" }}{{/* // special case if a byte array. */ -}}
+ if {{var "bv"}}, {{var "bok"}} := {{var "mk"}}.([]byte); {{var "bok"}} {
{{var "mk"}} = string({{var "bv"}})
- }{{ end }}{{if decElemKindPtr}}
- {{var "ms"}} = true{{end}}
+ }
+ {{ end -}}
+ {{if decElemKindPtr -}}
+ {{var "ms"}} = true
+ {{end -}}
if {{var "mg"}} {
- {{if decElemKindPtr}}{{var "mv"}}, {{var "mok"}} = {{var "v"}}[{{var "mk"}}]
+ {{if decElemKindPtr -}}
+ {{var "mv"}}, {{var "mok"}} = {{var "v"}}[{{var "mk"}}]
if {{var "mok"}} {
{{var "ms"}} = false
- } {{else}}{{var "mv"}} = {{var "v"}}[{{var "mk"}}] {{end}}
+ }
+ {{else -}}
+ {{var "mv"}} = {{var "v"}}[{{var "mk"}}]
+ {{end -}}
} {{if not decElemKindImmutable}}else { {{var "mv"}} = {{decElemZero}} }{{end}}
- r.ReadMapElemValue() {{/* z.DecSendContainerState(codecSelfer_containerMapValue{{ .Sfx }}) */}}
+ z.DecReadMapElemValue() {{/* z.DecSendContainerState(codecSelfer_containerMapValue{{ .Sfx }}) */}}
{{var "mdn"}} = false
- {{ $x := printf "%vmv%v" .TempVar .Rand }}{{ $y := printf "%vmdn%v" .TempVar .Rand }}{{ decLineVar $x $y }}
+ {{ $x := printf "%vmv%v" .TempVar .Rand }}{{ $y := printf "%vmdn%v" .TempVar .Rand }}{{ decLineVar $x $y -}}
if {{var "mdn"}} {
if {{ var "bh" }}.DeleteOnNilMapValue { delete({{var "v"}}, {{var "mk"}}) } else { {{var "v"}}[{{var "mk"}}] = {{decElemZero}} }
} else if {{if decElemKindPtr}} {{var "ms"}} && {{end}} {{var "v"}} != nil {
@@ -39,4 +47,4 @@ if {{var "l"}} != 0 {
}
}
} // else len==0: TODO: Should we clear map entries?
-r.ReadMapEnd() {{/* z.DecSendContainerState(codecSelfer_containerMapEnd{{ .Sfx }}) */}}
+z.DecReadMapEnd() {{/* z.DecSendContainerState(codecSelfer_containerMapEnd{{ .Sfx }}) */}}
diff --git a/vendor/github.com/ugorji/go/codec/gen-helper.generated.go b/vendor/github.com/ugorji/go/codec/gen-helper.generated.go
index b5155240..d9d0ed68 100644
--- a/vendor/github.com/ugorji/go/codec/gen-helper.generated.go
+++ b/vendor/github.com/ugorji/go/codec/gen-helper.generated.go
@@ -10,21 +10,14 @@ package codec
import (
"encoding"
"reflect"
- "strconv"
)
// GenVersion is the current version of codecgen.
-const GenVersion = 10
+const GenVersion = 12
// This file is used to generate helper code for codecgen.
// The values here i.e. genHelper(En|De)coder are not to be used directly by
// library users. They WILL change continuously and without notice.
-//
-// To help enforce this, we create an unexported type with exported members.
-// The only way to get the type is via the one exported type that we control (somewhat).
-//
-// When static codecs are created for types, they will use this value
-// to perform encoding or decoding of primitives or known slice or map types.
// GenHelperEncoder is exported so that it can be used externally by codecgen.
//
@@ -48,66 +41,22 @@ type genHelperEncDriver struct {
encDriver
}
-func (x genHelperEncDriver) EncodeBuiltin(rt uintptr, v interface{}) {}
-func (x genHelperEncDriver) EncStructFieldKey(keyType valueType, s string) {
- var m must
- if keyType == valueTypeString {
- x.encDriver.EncodeStringEnc(cUTF8, s)
- } else if keyType == valueTypeInt {
- x.encDriver.EncodeInt(m.Int(strconv.ParseInt(s, 10, 64)))
- } else if keyType == valueTypeUint {
- x.encDriver.EncodeUint(m.Uint(strconv.ParseUint(s, 10, 64)))
- } else if keyType == valueTypeFloat {
- x.encDriver.EncodeFloat64(m.Float(strconv.ParseFloat(s, 64)))
- }
- // encStructFieldKey(x.encDriver, keyType, s)
-}
-func (x genHelperEncDriver) EncodeSymbol(s string) {
- x.encDriver.EncodeStringEnc(cUTF8, s)
-}
-
type genHelperDecDriver struct {
decDriver
- C checkOverflow
-}
-
-func (x genHelperDecDriver) DecodeBuiltin(rt uintptr, v interface{}) {}
-func (x genHelperDecDriver) DecStructFieldKey(keyType valueType, buf *[decScratchByteArrayLen]byte) []byte {
- return decStructFieldKey(x.decDriver, keyType, buf)
-}
-func (x genHelperDecDriver) DecodeInt(bitsize uint8) (i int64) {
- return x.C.IntV(x.decDriver.DecodeInt64(), bitsize)
-}
-func (x genHelperDecDriver) DecodeUint(bitsize uint8) (ui uint64) {
- return x.C.UintV(x.decDriver.DecodeUint64(), bitsize)
-}
-func (x genHelperDecDriver) DecodeFloat(chkOverflow32 bool) (f float64) {
- f = x.DecodeFloat64()
- if chkOverflow32 && chkOvf.Float32(f) {
- panicv.errorf("float32 overflow: %v", f)
- }
- return
-}
-func (x genHelperDecDriver) DecodeFloat32As64() (f float64) {
- f = x.DecodeFloat64()
- if chkOvf.Float32(f) {
- panicv.errorf("float32 overflow: %v", f)
- }
- return
}
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
type genHelperEncoder struct {
M must
- e *Encoder
F fastpathT
+ e *Encoder
}
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
type genHelperDecoder struct {
C checkOverflow
- d *Decoder
F fastpathT
+ d *Decoder
}
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
@@ -127,7 +76,6 @@ func (f genHelperEncoder) IsJSONHandle() bool {
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
func (f genHelperEncoder) EncFallback(iv interface{}) {
- // println(">>>>>>>>> EncFallback")
// f.e.encodeI(iv, false, false)
f.e.encodeValue(reflect.ValueOf(iv), nil, false)
}
@@ -153,18 +101,6 @@ func (f genHelperEncoder) EncBinaryMarshal(iv encoding.BinaryMarshaler) {
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
func (f genHelperEncoder) EncRaw(iv Raw) { f.e.rawBytes(iv) }
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-//
-// Deprecated: builtin no longer supported - so we make this method a no-op,
-// but leave in-place so that old generated files continue to work without regeneration.
-func (f genHelperEncoder) TimeRtidIfBinc() (v uintptr) { return }
-
-// func (f genHelperEncoder) TimeRtidIfBinc() uintptr {
-// if _, ok := f.e.hh.(*BincHandle); ok {
-// return timeTypId
-// }
-// }
-
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
func (f genHelperEncoder) I2Rtid(v interface{}) uintptr {
return i2rtid(v)
@@ -182,28 +118,32 @@ func (f genHelperEncoder) EncExtension(v interface{}, xfFn *extTypeTagFn) {
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
func (f genHelperEncoder) WriteStr(s string) {
- f.e.w.writestr(s)
+ f.e.w().writestr(s)
}
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-//
-// Deprecated: No longer used,
-// but leave in-place so that old generated files continue to work without regeneration.
-func (f genHelperEncoder) HasExtensions() bool {
- return len(f.e.h.extHandle) != 0
-}
+func (f genHelperEncoder) BytesView(v string) []byte { return bytesView(v) }
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-//
-// Deprecated: No longer used,
-// but leave in-place so that old generated files continue to work without regeneration.
-func (f genHelperEncoder) EncExt(v interface{}) (r bool) {
- if xfFn := f.e.h.getExt(i2rtid(v)); xfFn != nil {
- f.e.e.EncodeExt(v, xfFn.tag, xfFn.ext, f.e)
- return true
- }
- return false
-}
+func (f genHelperEncoder) EncWriteMapStart(length int) { f.e.mapStart(length) }
+
+// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
+func (f genHelperEncoder) EncWriteMapEnd() { f.e.mapEnd() }
+
+// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
+func (f genHelperEncoder) EncWriteArrayStart(length int) { f.e.arrayStart(length) }
+
+// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
+func (f genHelperEncoder) EncWriteArrayEnd() { f.e.arrayEnd() }
+
+// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
+func (f genHelperEncoder) EncWriteArrayElem() { f.e.arrayElem() }
+
+// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
+func (f genHelperEncoder) EncWriteMapElemKey() { f.e.mapElemKey() }
+
+// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
+func (f genHelperEncoder) EncWriteMapElemValue() { f.e.mapElemValue() }
// ---------------- DECODER FOLLOWS -----------------
@@ -232,13 +172,11 @@ func (f genHelperDecoder) DecScratchArrayBuffer() *[decScratchByteArrayLen]byte
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
func (f genHelperDecoder) DecFallback(iv interface{}, chkPtr bool) {
- // println(">>>>>>>>> DecFallback")
rv := reflect.ValueOf(iv)
if chkPtr {
rv = f.d.ensureDecodeable(rv)
}
f.d.decodeValue(rv, nil, false)
- // f.d.decodeValueFallback(rv)
}
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
@@ -258,8 +196,7 @@ func (f genHelperDecoder) DecArrayCannotExpand(sliceLen, streamLen int) {
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
func (f genHelperDecoder) DecTextUnmarshal(tm encoding.TextUnmarshaler) {
- fnerr := tm.UnmarshalText(f.d.d.DecodeStringAsBytes())
- if fnerr != nil {
+ if fnerr := tm.UnmarshalText(f.d.d.DecodeStringAsBytes()); fnerr != nil {
panic(fnerr)
}
}
@@ -268,16 +205,14 @@ func (f genHelperDecoder) DecTextUnmarshal(tm encoding.TextUnmarshaler) {
func (f genHelperDecoder) DecJSONUnmarshal(tm jsonUnmarshaler) {
// bs := f.dd.DecodeStringAsBytes()
// grab the bytes to be read, as UnmarshalJSON needs the full JSON so as to unmarshal it itself.
- fnerr := tm.UnmarshalJSON(f.d.nextValueBytes())
- if fnerr != nil {
+ if fnerr := tm.UnmarshalJSON(f.d.nextValueBytes()); fnerr != nil {
panic(fnerr)
}
}
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
func (f genHelperDecoder) DecBinaryUnmarshal(bm encoding.BinaryUnmarshaler) {
- fnerr := bm.UnmarshalBinary(f.d.d.DecodeBytes(nil, true))
- if fnerr != nil {
+ if fnerr := bm.UnmarshalBinary(f.d.d.DecodeBytes(nil, true)); fnerr != nil {
panic(fnerr)
}
}
@@ -285,20 +220,6 @@ func (f genHelperDecoder) DecBinaryUnmarshal(bm encoding.BinaryUnmarshaler) {
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
func (f genHelperDecoder) DecRaw() []byte { return f.d.rawBytes() }
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-//
-// Deprecated: builtin no longer supported - so we make this method a no-op,
-// but leave in-place so that old generated files continue to work without regeneration.
-func (f genHelperDecoder) TimeRtidIfBinc() (v uintptr) { return }
-
-// func (f genHelperDecoder) TimeRtidIfBinc() uintptr {
-// // Note: builtin is no longer supported - so make this a no-op
-// if _, ok := f.d.hh.(*BincHandle); ok {
-// return timeTypId
-// }
-// return 0
-// }
-
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
func (f genHelperDecoder) IsJSONHandle() bool {
return f.d.js
@@ -320,32 +241,33 @@ func (f genHelperDecoder) DecExtension(v interface{}, xfFn *extTypeTagFn) {
}
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-//
-// Deprecated: No longer used,
-// but leave in-place so that old generated files continue to work without regeneration.
-func (f genHelperDecoder) HasExtensions() bool {
- return len(f.d.h.extHandle) != 0
+func (f genHelperDecoder) DecInferLen(clen, maxlen, unit int) (rvlen int) {
+ return decInferLen(clen, maxlen, unit)
}
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-//
-// Deprecated: No longer used,
-// but leave in-place so that old generated files continue to work without regeneration.
-func (f genHelperDecoder) DecExt(v interface{}) (r bool) {
- if xfFn := f.d.h.getExt(i2rtid(v)); xfFn != nil {
- f.d.d.DecodeExt(v, xfFn.tag, xfFn.ext)
- return true
- }
- return false
-}
+func (f genHelperDecoder) StringView(v []byte) string { return stringView(v) }
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-func (f genHelperDecoder) DecInferLen(clen, maxlen, unit int) (rvlen int) {
- return decInferLen(clen, maxlen, unit)
-}
+func (f genHelperDecoder) DecReadMapStart() int { return f.d.mapStart() }
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-//
-// Deprecated: no longer used,
-// but leave in-place so that old generated files continue to work without regeneration.
-func (f genHelperDecoder) StringView(v []byte) string { return stringView(v) }
+func (f genHelperDecoder) DecReadMapEnd() { f.d.mapEnd() }
+
+// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
+func (f genHelperDecoder) DecReadArrayStart() int { return f.d.arrayStart() }
+
+// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
+func (f genHelperDecoder) DecReadArrayEnd() { f.d.arrayEnd() }
+
+// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
+func (f genHelperDecoder) DecReadArrayElem() { f.d.arrayElem() }
+
+// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
+func (f genHelperDecoder) DecReadMapElemKey() { f.d.mapElemKey() }
+
+// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
+func (f genHelperDecoder) DecReadMapElemValue() { f.d.mapElemValue() }
+
+// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
+func (f genHelperDecoder) DecDecodeFloat32() float64 { return f.d.decodeFloat32() }
diff --git a/vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl b/vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl
index 161aaf1b..abe8cf33 100644
--- a/vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl
+++ b/vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl
@@ -10,7 +10,6 @@ package codec
import (
"encoding"
"reflect"
- "strconv"
)
// GenVersion is the current version of codecgen.
@@ -19,12 +18,14 @@ const GenVersion = {{ .Version }}
// This file is used to generate helper code for codecgen.
// The values here i.e. genHelper(En|De)coder are not to be used directly by
// library users. They WILL change continuously and without notice.
-//
+
+{{/*
// To help enforce this, we create an unexported type with exported members.
// The only way to get the type is via the one exported type that we control (somewhat).
//
// When static codecs are created for types, they will use this value
// to perform encoding or decoding of primitives or known slice or map types.
+*/ -}}
// GenHelperEncoder is exported so that it can be used externally by codecgen.
//
@@ -48,66 +49,34 @@ type genHelperEncDriver struct {
encDriver
}
-func (x genHelperEncDriver) EncodeBuiltin(rt uintptr, v interface{}) {}
-func (x genHelperEncDriver) EncStructFieldKey(keyType valueType, s string) {
- var m must
- if keyType == valueTypeString {
- x.encDriver.EncodeStringEnc(cUTF8, s)
- } else if keyType == valueTypeInt {
- x.encDriver.EncodeInt(m.Int(strconv.ParseInt(s, 10, 64)))
- } else if keyType == valueTypeUint {
- x.encDriver.EncodeUint(m.Uint(strconv.ParseUint(s, 10, 64)))
- } else if keyType == valueTypeFloat {
- x.encDriver.EncodeFloat64(m.Float(strconv.ParseFloat(s, 64)))
- }
- // encStructFieldKey(x.encDriver, keyType, s)
-}
-func (x genHelperEncDriver) EncodeSymbol(s string) {
- x.encDriver.EncodeStringEnc(cUTF8, s)
-}
-
type genHelperDecDriver struct {
decDriver
- C checkOverflow
}
-func (x genHelperDecDriver) DecodeBuiltin(rt uintptr, v interface{}) {}
+{{/*
+// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
+func (x genHelperEncDriver) EncStructFieldKey(keyType valueType, s string) {
+ encStructFieldKey(s, x.encDriver, nil, keyType, false, false)
+}
+
+// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
func (x genHelperDecDriver) DecStructFieldKey(keyType valueType, buf *[decScratchByteArrayLen]byte) []byte {
return decStructFieldKey(x.decDriver, keyType, buf)
}
-func (x genHelperDecDriver) DecodeInt(bitsize uint8) (i int64) {
- return x.C.IntV(x.decDriver.DecodeInt64(), bitsize)
-}
-func (x genHelperDecDriver) DecodeUint(bitsize uint8) (ui uint64) {
- return x.C.UintV(x.decDriver.DecodeUint64(), bitsize)
-}
-func (x genHelperDecDriver) DecodeFloat(chkOverflow32 bool) (f float64) {
- f = x.DecodeFloat64()
- if chkOverflow32 && chkOvf.Float32(f) {
- panicv.errorf("float32 overflow: %v", f)
- }
- return
-}
-func (x genHelperDecDriver) DecodeFloat32As64() (f float64) {
- f = x.DecodeFloat64()
- if chkOvf.Float32(f) {
- panicv.errorf("float32 overflow: %v", f)
- }
- return
-}
+*/ -}}
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
type genHelperEncoder struct {
M must
- e *Encoder
F fastpathT
+ e *Encoder
}
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
type genHelperDecoder struct {
C checkOverflow
- d *Decoder
F fastpathT
+ d *Decoder
}
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
@@ -124,7 +93,6 @@ func (f genHelperEncoder) IsJSONHandle() bool {
}
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
func (f genHelperEncoder) EncFallback(iv interface{}) {
- // println(">>>>>>>>> EncFallback")
// f.e.encodeI(iv, false, false)
f.e.encodeValue(reflect.ValueOf(iv), nil, false)
}
@@ -145,16 +113,6 @@ func (f genHelperEncoder) EncBinaryMarshal(iv encoding.BinaryMarshaler) {
}
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
func (f genHelperEncoder) EncRaw(iv Raw) { f.e.rawBytes(iv) }
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-//
-// Deprecated: builtin no longer supported - so we make this method a no-op,
-// but leave in-place so that old generated files continue to work without regeneration.
-func (f genHelperEncoder) TimeRtidIfBinc() (v uintptr) { return }
-// func (f genHelperEncoder) TimeRtidIfBinc() uintptr {
-// if _, ok := f.e.hh.(*BincHandle); ok {
-// return timeTypId
-// }
-// }
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
func (f genHelperEncoder) I2Rtid(v interface{}) uintptr {
@@ -170,26 +128,25 @@ func (f genHelperEncoder) EncExtension(v interface{}, xfFn *extTypeTagFn) {
}
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
func (f genHelperEncoder) WriteStr(s string) {
- f.e.w.writestr(s)
+ f.e.w().writestr(s)
}
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-//
-// Deprecated: No longer used,
-// but leave in-place so that old generated files continue to work without regeneration.
-func (f genHelperEncoder) HasExtensions() bool {
- return len(f.e.h.extHandle) != 0
-}
+func (f genHelperEncoder) BytesView(v string) []byte { return bytesView(v) }
+
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-//
-// Deprecated: No longer used,
-// but leave in-place so that old generated files continue to work without regeneration.
-func (f genHelperEncoder) EncExt(v interface{}) (r bool) {
- if xfFn := f.e.h.getExt(i2rtid(v)); xfFn != nil {
- f.e.e.EncodeExt(v, xfFn.tag, xfFn.ext, f.e)
- return true
- }
- return false
-}
+func (f genHelperEncoder) EncWriteMapStart(length int) { f.e.mapStart(length) }
+// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
+func (f genHelperEncoder) EncWriteMapEnd() { f.e.mapEnd() }
+// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
+func (f genHelperEncoder) EncWriteArrayStart(length int) { f.e.arrayStart(length) }
+// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
+func (f genHelperEncoder) EncWriteArrayEnd() { f.e.arrayEnd() }
+// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
+func (f genHelperEncoder) EncWriteArrayElem() { f.e.arrayElem() }
+// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
+func (f genHelperEncoder) EncWriteMapElemKey() { f.e.mapElemKey() }
+// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
+func (f genHelperEncoder) EncWriteMapElemValue() { f.e.mapElemValue() }
// ---------------- DECODER FOLLOWS -----------------
@@ -213,13 +170,11 @@ func (f genHelperDecoder) DecScratchArrayBuffer() *[decScratchByteArrayLen]byte
}
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
func (f genHelperDecoder) DecFallback(iv interface{}, chkPtr bool) {
- // println(">>>>>>>>> DecFallback")
rv := reflect.ValueOf(iv)
if chkPtr {
rv = f.d.ensureDecodeable(rv)
}
f.d.decodeValue(rv, nil, false)
- // f.d.decodeValueFallback(rv)
}
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
func (f genHelperDecoder) DecSliceHelperStart() (decSliceHelper, int) {
@@ -235,8 +190,7 @@ func (f genHelperDecoder) DecArrayCannotExpand(sliceLen, streamLen int) {
}
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
func (f genHelperDecoder) DecTextUnmarshal(tm encoding.TextUnmarshaler) {
- fnerr := tm.UnmarshalText(f.d.d.DecodeStringAsBytes())
- if fnerr != nil {
+ if fnerr := tm.UnmarshalText(f.d.d.DecodeStringAsBytes()); fnerr != nil {
panic(fnerr)
}
}
@@ -244,32 +198,18 @@ func (f genHelperDecoder) DecTextUnmarshal(tm encoding.TextUnmarshaler) {
func (f genHelperDecoder) DecJSONUnmarshal(tm jsonUnmarshaler) {
// bs := f.dd.DecodeStringAsBytes()
// grab the bytes to be read, as UnmarshalJSON needs the full JSON so as to unmarshal it itself.
- fnerr := tm.UnmarshalJSON(f.d.nextValueBytes())
- if fnerr != nil {
+ if fnerr := tm.UnmarshalJSON(f.d.nextValueBytes()); fnerr != nil {
panic(fnerr)
}
}
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
func (f genHelperDecoder) DecBinaryUnmarshal(bm encoding.BinaryUnmarshaler) {
- fnerr := bm.UnmarshalBinary(f.d.d.DecodeBytes(nil, true))
- if fnerr != nil {
+ if fnerr := bm.UnmarshalBinary(f.d.d.DecodeBytes(nil, true)); fnerr != nil {
panic(fnerr)
}
}
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
func (f genHelperDecoder) DecRaw() []byte { return f.d.rawBytes() }
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-//
-// Deprecated: builtin no longer supported - so we make this method a no-op,
-// but leave in-place so that old generated files continue to work without regeneration.
-func (f genHelperDecoder) TimeRtidIfBinc() (v uintptr) { return }
-// func (f genHelperDecoder) TimeRtidIfBinc() uintptr {
-// // Note: builtin is no longer supported - so make this a no-op
-// if _, ok := f.d.hh.(*BincHandle); ok {
-// return timeTypId
-// }
-// return 0
-// }
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
func (f genHelperDecoder) IsJSONHandle() bool {
@@ -288,30 +228,27 @@ func (f genHelperDecoder) DecExtension(v interface{}, xfFn *extTypeTagFn) {
f.d.d.DecodeExt(v, xfFn.tag, xfFn.ext)
}
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-//
-// Deprecated: No longer used,
-// but leave in-place so that old generated files continue to work without regeneration.
-func (f genHelperDecoder) HasExtensions() bool {
- return len(f.d.h.extHandle) != 0
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-//
-// Deprecated: No longer used,
-// but leave in-place so that old generated files continue to work without regeneration.
-func (f genHelperDecoder) DecExt(v interface{}) (r bool) {
- if xfFn := f.d.h.getExt(i2rtid(v)); xfFn != nil {
- f.d.d.DecodeExt(v, xfFn.tag, xfFn.ext)
- return true
- }
- return false
-}
-// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
func (f genHelperDecoder) DecInferLen(clen, maxlen, unit int) (rvlen int) {
return decInferLen(clen, maxlen, unit)
}
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
-//
-// Deprecated: no longer used,
-// but leave in-place so that old generated files continue to work without regeneration.
func (f genHelperDecoder) StringView(v []byte) string { return stringView(v) }
+// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
+func (f genHelperDecoder) DecReadMapStart() int { return f.d.mapStart() }
+// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
+func (f genHelperDecoder) DecReadMapEnd() { f.d.mapEnd() }
+// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
+func (f genHelperDecoder) DecReadArrayStart() int { return f.d.arrayStart() }
+// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
+func (f genHelperDecoder) DecReadArrayEnd() { f.d.arrayEnd() }
+// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
+func (f genHelperDecoder) DecReadArrayElem() { f.d.arrayElem() }
+// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
+func (f genHelperDecoder) DecReadMapElemKey() { f.d.mapElemKey() }
+// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
+func (f genHelperDecoder) DecReadMapElemValue() { f.d.mapElemValue() }
+
+// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
+func (f genHelperDecoder) DecDecodeFloat32() float64 { return f.d.decodeFloat32() }
+
diff --git a/vendor/github.com/ugorji/go/codec/gen.generated.go b/vendor/github.com/ugorji/go/codec/gen.generated.go
index 8b00090a..b88998b0 100644
--- a/vendor/github.com/ugorji/go/codec/gen.generated.go
+++ b/vendor/github.com/ugorji/go/codec/gen.generated.go
@@ -9,7 +9,7 @@ package codec
const genDecMapTmpl = `
{{var "v"}} := *{{ .Varname }}
-{{var "l"}} := r.ReadMapStart()
+{{var "l"}} := z.DecReadMapStart()
{{var "bh"}} := z.DecBasicHandle()
if {{var "v"}} == nil {
{{var "rl"}} := z.DecInferLen({{var "l"}}, {{var "bh"}}.MaxInitLen, {{ .Size }})
@@ -27,21 +27,29 @@ if {{var "bh"}}.MapValueReset {
if {{var "l"}} != 0 {
{{var "hl"}} := {{var "l"}} > 0
for {{var "j"}} := 0; ({{var "hl"}} && {{var "j"}} < {{var "l"}}) || !({{var "hl"}} || r.CheckBreak()); {{var "j"}}++ {
- r.ReadMapElemKey() {{/* z.DecSendContainerState(codecSelfer_containerMapKey{{ .Sfx }}) */}}
- {{ $x := printf "%vmk%v" .TempVar .Rand }}{{ decLineVarK $x }}
-{{ if eq .KTyp "interface{}" }}{{/* // special case if a byte array. */}}if {{var "bv"}}, {{var "bok"}} := {{var "mk"}}.([]byte); {{var "bok"}} {
+ z.DecReadMapElemKey() {{/* z.DecSendContainerState(codecSelfer_containerMapKey{{ .Sfx }}) */}}
+ {{ $x := printf "%vmk%v" .TempVar .Rand }}{{ decLineVarK $x -}}
+ {{ if eq .KTyp "interface{}" }}{{/* // special case if a byte array. */ -}}
+ if {{var "bv"}}, {{var "bok"}} := {{var "mk"}}.([]byte); {{var "bok"}} {
{{var "mk"}} = string({{var "bv"}})
- }{{ end }}{{if decElemKindPtr}}
- {{var "ms"}} = true{{end}}
+ }
+ {{ end -}}
+ {{if decElemKindPtr -}}
+ {{var "ms"}} = true
+ {{end -}}
if {{var "mg"}} {
- {{if decElemKindPtr}}{{var "mv"}}, {{var "mok"}} = {{var "v"}}[{{var "mk"}}]
+ {{if decElemKindPtr -}}
+ {{var "mv"}}, {{var "mok"}} = {{var "v"}}[{{var "mk"}}]
if {{var "mok"}} {
{{var "ms"}} = false
- } {{else}}{{var "mv"}} = {{var "v"}}[{{var "mk"}}] {{end}}
+ }
+ {{else -}}
+ {{var "mv"}} = {{var "v"}}[{{var "mk"}}]
+ {{end -}}
} {{if not decElemKindImmutable}}else { {{var "mv"}} = {{decElemZero}} }{{end}}
- r.ReadMapElemValue() {{/* z.DecSendContainerState(codecSelfer_containerMapValue{{ .Sfx }}) */}}
+ z.DecReadMapElemValue() {{/* z.DecSendContainerState(codecSelfer_containerMapValue{{ .Sfx }}) */}}
{{var "mdn"}} = false
- {{ $x := printf "%vmv%v" .TempVar .Rand }}{{ $y := printf "%vmdn%v" .TempVar .Rand }}{{ decLineVar $x $y }}
+ {{ $x := printf "%vmv%v" .TempVar .Rand }}{{ $y := printf "%vmdn%v" .TempVar .Rand }}{{ decLineVar $x $y -}}
if {{var "mdn"}} {
if {{ var "bh" }}.DeleteOnNilMapValue { delete({{var "v"}}, {{var "mk"}}) } else { {{var "v"}}[{{var "mk"}}] = {{decElemZero}} }
} else if {{if decElemKindPtr}} {{var "ms"}} && {{end}} {{var "v"}} != nil {
@@ -49,7 +57,7 @@ if {{var "l"}} != 0 {
}
}
} // else len==0: TODO: Should we clear map entries?
-r.ReadMapEnd() {{/* z.DecSendContainerState(codecSelfer_containerMapEnd{{ .Sfx }}) */}}
+z.DecReadMapEnd() {{/* z.DecSendContainerState(codecSelfer_containerMapEnd{{ .Sfx }}) */}}
`
const genDecListTmpl = `
@@ -67,7 +75,8 @@ if {{var "l"}} == 0 {
} {{else if isChan }}if {{var "v"}} == nil {
{{var "v"}} = make({{ .CTyp }}, 0)
{{var "c"}} = true
- } {{end}}
+ }
+ {{end -}}
} else {
{{var "hl"}} := {{var "l"}} > 0
var {{var "rl"}} int
@@ -85,9 +94,10 @@ if {{var "l"}} == 0 {
{{var "v"}} = {{var "v"}}[:{{var "l"}}]
{{var "c"}} = true
}
- } {{end}}
+ }
+ {{end -}}
var {{var "j"}} int
- // var {{var "dn"}} bool
+ {{/* // var {{var "dn"}} bool */ -}}
for {{var "j"}} = 0; ({{var "hl"}} && {{var "j"}} < {{var "l"}}) || !({{var "hl"}} || r.CheckBreak()); {{var "j"}}++ { // bounds-check-elimination
{{if not isArray}} if {{var "j"}} == 0 && {{var "v"}} == nil {
if {{var "hl"}} {
@@ -97,27 +107,28 @@ if {{var "l"}} == 0 {
}
{{var "v"}} = make({{if isSlice}}[]{{ .Typ }}{{else if isChan}}{{.CTyp}}{{end}}, {{var "rl"}})
{{var "c"}} = true
- }{{end}}
+ }
+ {{end -}}
{{var "h"}}.ElemContainerState({{var "j"}})
- {{/* {{var "dn"}} = r.TryDecodeAsNil() */}}{{/* commented out, as decLineVar handles this already each time */}}
+ {{/* {{var "dn"}} = r.TryDecodeAsNil() */}}{{/* commented out, as decLineVar handles this already each time */ -}}
{{if isChan}}{{ $x := printf "%[1]vvcx%[2]v" .TempVar .Rand }}var {{$x}} {{ .Typ }}
- {{ decLineVar $x }}
+ {{ decLineVar $x -}}
{{var "v"}} <- {{ $x }}
// println(">>>> sending ", {{ $x }}, " into ", {{var "v"}}) // TODO: remove this
- {{else}}{{/* // if indefinite, etc, then expand the slice if necessary */}}
+ {{else}}{{/* // if indefinite, etc, then expand the slice if necessary */ -}}
var {{var "db"}} bool
if {{var "j"}} >= len({{var "v"}}) {
{{if isSlice }} {{var "v"}} = append({{var "v"}}, {{ zero }})
{{var "c"}} = true
{{else}} z.DecArrayCannotExpand(len(v), {{var "j"}}+1); {{var "db"}} = true
- {{end}}
+ {{end -}}
}
if {{var "db"}} {
z.DecSwallow()
} else {
- {{ $x := printf "%[1]vv%[2]v[%[1]vj%[2]v]" .TempVar .Rand }}{{ decLineVar $x }}
+ {{ $x := printf "%[1]vv%[2]v[%[1]vj%[2]v]" .TempVar .Rand }}{{ decLineVar $x -}}
}
- {{end}}
+ {{end -}}
}
{{if isSlice}} if {{var "j"}} < len({{var "v"}}) {
{{var "v"}} = {{var "v"}}[:{{var "j"}}]
@@ -125,12 +136,14 @@ if {{var "l"}} == 0 {
} else if {{var "j"}} == 0 && {{var "v"}} == nil {
{{var "v"}} = make([]{{ .Typ }}, 0)
{{var "c"}} = true
- } {{end}}
+ }
+ {{end -}}
}
{{var "h"}}.End()
{{if not isArray }}if {{var "c"}} {
*{{ .Varname }} = {{var "v"}}
-}{{end}}
+}
+{{end -}}
`
const genEncChanTmpl = `
diff --git a/vendor/github.com/ugorji/go/codec/gen.go b/vendor/github.com/ugorji/go/codec/gen.go
index 115c9b46..4dc3c065 100644
--- a/vendor/github.com/ugorji/go/codec/gen.go
+++ b/vendor/github.com/ugorji/go/codec/gen.go
@@ -105,8 +105,10 @@ import (
// v7:
// v8: current - we now maintain compatibility with old generated code.
// v9: skipped
-// v10: modified encDriver and decDriver interfaces. Remove deprecated methods after Jan 1, 2019
-const genVersion = 10
+// v10: modified encDriver and decDriver interfaces.
+// v11: remove deprecated methods of encDriver and decDriver.
+// v12: removed deprecated methods from genHelper and changed container tracking logic
+const genVersion = 12
const (
genCodecPkg = "codec1978"
@@ -123,6 +125,15 @@ const (
//
// From testing, it didn't make much difference in runtime, so keep as true (one function only)
genUseOneFunctionForDecStructMap = true
+
+ // genFastpathCanonical configures whether we support Canonical in fast path.
+ // The savings is not much.
+ //
+ // NOTE: This MUST ALWAYS BE TRUE. fast-path.go.tmp doesn't handle it being false.
+ genFastpathCanonical = true // MUST be true
+
+ // genFastpathTrimTypes configures whether we trim uncommon fastpath types.
+ genFastpathTrimTypes = true
)
type genStructMapStyle uint8
@@ -157,10 +168,11 @@ func (x *genBuf) reset() {
// genRunner holds some state used during a Gen run.
type genRunner struct {
- w io.Writer // output
- c uint64 // counter used for generating varsfx
- t []reflect.Type // list of types to run selfer on
+ w io.Writer // output
+ c uint64 // counter used for generating varsfx
+ f uint64 // counter used for saying false
+ t []reflect.Type // list of types to run selfer on
tc reflect.Type // currently running selfer on this type
te map[uintptr]bool // types for which the encoder has been created
td map[uintptr]bool // types for which the decoder has been created
@@ -187,6 +199,30 @@ type genRunner struct {
nx bool // no extensions
}
+type genIfClause struct {
+ hasIf bool
+}
+
+func (g *genIfClause) end(x *genRunner) {
+ if g.hasIf {
+ x.line("}")
+ }
+}
+
+func (g *genIfClause) c(last bool) (v string) {
+ if last {
+ if g.hasIf {
+ v = " } else { "
+ }
+ } else if g.hasIf {
+ v = " } else if "
+ } else {
+ v = "if "
+ g.hasIf = true
+ }
+ return
+}
+
// Gen will write a complete go file containing Selfer implementations for each
// type passed. All the types must be in the same package.
//
@@ -285,43 +321,49 @@ func Gen(w io.Writer, buildTags, pkgName, uid string, noExtensions bool,
x.linef("codecSelferBitsize%s = uint8(32 << (^uint(0) >> 63))", x.xs)
x.line(")")
x.line("var (")
- x.line("errCodecSelferOnlyMapOrArrayEncodeToStruct" + x.xs + " = errors.New(`only encoded map or array can be decoded into a struct`)")
+ x.line("errCodecSelferOnlyMapOrArrayEncodeToStruct" + x.xs + " = " + "\nerrors.New(`only encoded map or array can be decoded into a struct`)")
x.line(")")
x.line("")
x.hn = "codecSelfer" + x.xs
x.line("type " + x.hn + " struct{}")
x.line("")
-
+ x.linef("func %sFalse() bool { return false }", x.hn)
+ x.line("")
x.varsfxreset()
x.line("func init() {")
x.linef("if %sGenVersion != %v {", x.cpfx, genVersion)
x.line("_, file, _, _ := runtime.Caller(0)")
- x.outf(`panic("codecgen version mismatch: current: %v, need " + strconv.FormatInt(int64(%sGenVersion), 10) + ". Re-generate file: " + file)`, genVersion, x.cpfx)
+ x.linef("ver := strconv.FormatInt(int64(%sGenVersion), 10)", x.cpfx)
+ x.outf(`panic("codecgen version mismatch: current: %v, need " + ver + ". Re-generate file: " + file)`, genVersion)
// x.out(`panic(fmt.Errorf("codecgen version mismatch: current: %v, need %v. Re-generate file: %v", `)
// x.linef(`%v, %sGenVersion, file))`, genVersion, x.cpfx)
x.linef("}")
- x.line("if false { var _ byte = 0; // reference the types, but skip this branch at build/run time")
- // x.line("_ = strconv.ParseInt")
- var n int
- // for k, t := range x.im {
- for _, k := range imKeys {
- t := x.im[k]
- x.linef("var v%v %s.%s", n, x.imn[k], t.Name())
- n++
- }
- if n > 0 {
- x.out("_")
- for i := 1; i < n; i++ {
- x.out(", _")
- }
- x.out(" = v0")
- for i := 1; i < n; i++ {
- x.outf(", v%v", i)
- }
+ if len(imKeys) > 0 {
+ x.line("if false { // reference the types, but skip this branch at build/run time")
+ x.line("var _ byte")
+ // x.line("_ = strconv.ParseInt")
+ // var n int
+ // for k, t := range x.im {
+ for _, k := range imKeys {
+ t := x.im[k]
+ // x.linef("var v%v %s.%s", n, x.imn[k], t.Name())
+ // n++
+ x.linef("var _ %s.%s", x.imn[k], t.Name())
+ }
+ // if n > 0 {
+ // x.out("_")
+ // for i := 1; i < n; i++ {
+ // x.out(", _")
+ // }
+ // x.out(" = v0")
+ // for i := 1; i < n; i++ {
+ // x.outf(", v%v", i)
+ // }
+ // }
+ x.line("} ") // close if false
}
- x.line("} ") // close if false
- x.line("}") // close init
+ x.line("}") // close init
x.line("")
// generate rest of type info
@@ -422,6 +464,15 @@ func (x *genRunner) genRefPkgs(t reflect.Type) {
}
}
+// sayFalse will either say "false" or use a function call that returns false.
+func (x *genRunner) sayFalse() string {
+ x.f++
+ if x.f%2 == 0 {
+ return x.hn + "False()"
+ }
+ return "false"
+}
+
func (x *genRunner) varsfx() string {
x.c++
return strconv.FormatUint(x.c, 10)
@@ -452,6 +503,12 @@ func (x *genRunner) line(s string) {
}
}
+func (x *genRunner) lineIf(s string) {
+ if s != "" {
+ x.line(s)
+ }
+}
+
func (x *genRunner) linef(s string, params ...interface{}) {
x.outf(s, params...)
if len(s) == 0 || s[len(s)-1] != '\n' {
@@ -638,12 +695,16 @@ func (x *genRunner) registerXtraT(t reflect.Type) {
// encVar will encode a variable.
// The parameter, t, is the reflect.Type of the variable itself
func (x *genRunner) encVar(varname string, t reflect.Type) {
- // fmt.Printf(">>>>>> varname: %s, t: %v\n", varname, t)
+ // xdebugf("varname: %s, t: %v", varname, t)
var checkNil bool
switch t.Kind() {
case reflect.Ptr, reflect.Interface, reflect.Slice, reflect.Map, reflect.Chan:
checkNil = true
}
+ x.encVarChkNil(varname, t, checkNil)
+}
+
+func (x *genRunner) encVarChkNil(varname string, t reflect.Type, checkNil bool) {
if checkNil {
x.linef("if %s == nil { r.EncodeNil() } else { ", varname)
}
@@ -674,7 +735,6 @@ func (x *genRunner) encVar(varname string, t reflect.Type) {
if checkNil {
x.line("}")
}
-
}
// enc will encode a variable (varname) of type t, where t represents T.
@@ -738,53 +798,54 @@ func (x *genRunner) enc(varname string, t reflect.Type) {
// - type is time.Time, RawExt, Raw
// - the type implements (Text|JSON|Binary)(Unm|M)arshal
- x.line("if false {") //start if block
- defer func() { x.line("}") }() //end if block
+ var hasIf genIfClause
+ defer hasIf.end(x) // end if block (if necessary)
if t == timeTyp {
- x.linef("} else if !z.EncBasicHandle().TimeNotBuiltin { r.EncodeTime(%s)", varname)
+ x.linef("%s !z.EncBasicHandle().TimeNotBuiltin { r.EncodeTime(%s)", hasIf.c(false), varname)
// return
}
if t == rawTyp {
- x.linef("} else { z.EncRaw(%s)", varname)
+ x.linef("%s z.EncRaw(%s)", hasIf.c(true), varname)
return
}
if t == rawExtTyp {
- x.linef("} else { r.EncodeRawExt(%s, e)", varname)
+ x.linef("%s r.EncodeRawExt(%s, e)", hasIf.c(true), varname)
return
}
// only check for extensions if the type is named, and has a packagePath.
var arrayOrStruct = tk == reflect.Array || tk == reflect.Struct // meaning varname if of type *T
if !x.nx && genImportPath(t) != "" && t.Name() != "" {
yy := fmt.Sprintf("%sxt%s", genTempVarPfx, mi)
- x.linef("} else if %s := z.Extension(z.I2Rtid(%s)); %s != nil { z.EncExtension(%s, %s) ", yy, varname, yy, varname, yy)
+ x.linef("%s %s := z.Extension(z.I2Rtid(%s)); %s != nil { z.EncExtension(%s, %s) ",
+ hasIf.c(false), yy, varname, yy, varname, yy)
}
if arrayOrStruct { // varname is of type *T
if ti2.bm || ti2.bmp { // t.Implements(binaryMarshalerTyp) || tptr.Implements(binaryMarshalerTyp) {
- x.linef("} else if z.EncBinary() { z.EncBinaryMarshal(%v) ", varname)
+ x.linef("%s z.EncBinary() { z.EncBinaryMarshal(%v) ", hasIf.c(false), varname)
}
if ti2.jm || ti2.jmp { // t.Implements(jsonMarshalerTyp) || tptr.Implements(jsonMarshalerTyp) {
- x.linef("} else if !z.EncBinary() && z.IsJSONHandle() { z.EncJSONMarshal(%v) ", varname)
+ x.linef("%s !z.EncBinary() && z.IsJSONHandle() { z.EncJSONMarshal(%v) ", hasIf.c(false), varname)
} else if ti2.tm || ti2.tmp { // t.Implements(textMarshalerTyp) || tptr.Implements(textMarshalerTyp) {
- x.linef("} else if !z.EncBinary() { z.EncTextMarshal(%v) ", varname)
+ x.linef("%s !z.EncBinary() { z.EncTextMarshal(%v) ", hasIf.c(false), varname)
}
} else { // varname is of type T
if ti2.bm { // t.Implements(binaryMarshalerTyp) {
- x.linef("} else if z.EncBinary() { z.EncBinaryMarshal(%v) ", varname)
+ x.linef("%s z.EncBinary() { z.EncBinaryMarshal(%v) ", hasIf.c(false), varname)
} else if ti2.bmp { // tptr.Implements(binaryMarshalerTyp) {
- x.linef("} else if z.EncBinary() { z.EncBinaryMarshal(&%v) ", varname)
+ x.linef("%s z.EncBinary() { z.EncBinaryMarshal(&%v) ", hasIf.c(false), varname)
}
if ti2.jm { // t.Implements(jsonMarshalerTyp) {
- x.linef("} else if !z.EncBinary() && z.IsJSONHandle() { z.EncJSONMarshal(%v) ", varname)
+ x.linef("%s !z.EncBinary() && z.IsJSONHandle() { z.EncJSONMarshal(%v) ", hasIf.c(false), varname)
} else if ti2.jmp { // tptr.Implements(jsonMarshalerTyp) {
- x.linef("} else if !z.EncBinary() && z.IsJSONHandle() { z.EncJSONMarshal(&%v) ", varname)
+ x.linef("%s !z.EncBinary() && z.IsJSONHandle() { z.EncJSONMarshal(&%v) ", hasIf.c(false), varname)
} else if ti2.tm { // t.Implements(textMarshalerTyp) {
- x.linef("} else if !z.EncBinary() { z.EncTextMarshal(%v) ", varname)
+ x.linef("%s !z.EncBinary() { z.EncTextMarshal(%v) ", hasIf.c(false), varname)
} else if ti2.tmp { // tptr.Implements(textMarshalerTyp) {
- x.linef("} else if !z.EncBinary() { z.EncTextMarshal(&%v) ", varname)
+ x.linef("%s !z.EncBinary() { z.EncTextMarshal(&%v) ", hasIf.c(false), varname)
}
}
- x.line("} else {")
+ x.lineIf(hasIf.c(true))
switch t.Kind() {
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
@@ -798,7 +859,7 @@ func (x *genRunner) enc(varname string, t reflect.Type) {
case reflect.Bool:
x.line("r.EncodeBool(bool(" + varname + "))")
case reflect.String:
- x.line("r.EncodeStringEnc(codecSelferCcUTF8" + x.xs + ", string(" + varname + "))")
+ x.linef("if z.EncBasicHandle().StringToRaw { r.EncodeStringBytesRaw(z.BytesView(string(%s))) } else { r.EncodeStringEnc(codecSelferCcUTF8%s, string(%s)) }", varname, x.xs, varname)
case reflect.Chan:
x.xtraSM(varname, t, true, false)
// x.encListFallback(varname, rtid, t)
@@ -814,7 +875,7 @@ func (x *genRunner) enc(varname string, t reflect.Type) {
if rtid == uint8SliceTypId {
x.line("r.EncodeStringBytesRaw([]byte(" + varname + "))")
} else if fastpathAV.index(rtid) != -1 {
- g := x.newGenV(t)
+ g := x.newFastpathGenV(t)
x.line("z.F." + g.MethodNamePfx("Enc", false) + "V(" + varname + ", e)")
} else {
x.xtraSM(varname, t, true, false)
@@ -828,7 +889,7 @@ func (x *genRunner) enc(varname string, t reflect.Type) {
// - else call Encoder.encode(XXX) on it.
// x.line("if " + varname + " == nil { \nr.EncodeNil()\n } else { ")
if fastpathAV.index(rtid) != -1 {
- g := x.newGenV(t)
+ g := x.newFastpathGenV(t)
x.line("z.F." + g.MethodNamePfx("Enc", false) + "V(" + varname + ", e)")
} else {
x.xtraSM(varname, t, true, false)
@@ -862,12 +923,17 @@ func (x *genRunner) encZero(t reflect.Type) {
case reflect.Bool:
x.line("r.EncodeBool(false)")
case reflect.String:
- x.line("r.EncodeStringEnc(codecSelferCcUTF8" + x.xs + `, "")`)
+ x.linef(`if z.EncBasicHandle().StringToRaw { r.EncodeStringBytesRaw([]byte{}) } else { r.EncodeStringEnc(codecSelferCcUTF8%s, "") }`, x.xs)
default:
x.line("r.EncodeNil()")
}
}
+func (x *genRunner) doEncOmitEmptyLine(t2 reflect.StructField, varname string, buf *genBuf) {
+ x.f = 0
+ x.encOmitEmptyLine(t2, varname, buf)
+}
+
func (x *genRunner) encOmitEmptyLine(t2 reflect.StructField, varname string, buf *genBuf) {
// smartly check omitEmpty on a struct type, as it may contain uncomparable map/slice/etc.
// also, for maps/slices/arrays, check if len ! 0 (not if == zero value)
@@ -890,7 +956,7 @@ func (x *genRunner) encOmitEmptyLine(t2 reflect.StructField, varname string, buf
break
}
// buf.s("(")
- buf.s("false")
+ buf.s(x.sayFalse()) // buf.s("false")
for i, n := 0, t2.Type.NumField(); i < n; i++ {
f := t2.Type.Field(i)
if f.PkgPath != "" { // unexported
@@ -910,6 +976,7 @@ func (x *genRunner) encOmitEmptyLine(t2 reflect.StructField, varname string, buf
}
func (x *genRunner) encStruct(varname string, rtid uintptr, t reflect.Type) {
+ // xdebug2f("encStruct, varname: %s, t: %s", varname, t)
// Use knowledge from structfieldinfo (mbs, encodable fields. Ignore omitempty. )
// replicate code in kStruct i.e. for each field, deref type to non-pointer, and call x.enc on it
@@ -920,11 +987,13 @@ func (x *genRunner) encStruct(varname string, rtid uintptr, t reflect.Type) {
numfieldsvar := genTempVarPfx + "q" + i
ti2arrayvar := genTempVarPfx + "r" + i
struct2arrvar := genTempVarPfx + "2arr" + i
+ // firstvar := genTempVarPfx + "2first" + i
x.line(sepVarname + " := !z.EncBinary()")
x.linef("%s := z.EncBasicHandle().StructToArray", struct2arrvar)
x.linef("_, _ = %s, %s", sepVarname, struct2arrvar)
x.linef("const %s bool = %v // struct tag has 'toArray'", ti2arrayvar, ti.toArray)
+ // x.linef("var %s bool = true", firstvar)
tisfi := ti.sfiSrc // always use sequence from file. decStruct expects same thing.
@@ -968,36 +1037,32 @@ func (x *genRunner) encStruct(varname string, rtid uintptr, t reflect.Type) {
}
}
}
- x.encOmitEmptyLine(t2, varname, &omitline)
+ x.doEncOmitEmptyLine(t2, varname, &omitline)
x.linef("%s, // %s", omitline.v(), si.fieldName)
}
x.line("}")
x.linef("_ = %s", numfieldsvar)
}
// x.linef("var %snn%s int", genTempVarPfx, i)
- x.linef("if %s || %s {", ti2arrayvar, struct2arrvar) // if ti.toArray {
- x.linef("r.WriteArrayStart(%d)", len(tisfi))
- x.linef("} else {") // if not ti.toArray
- if ti.anyOmitEmpty {
- // nn = 0
- // x.linef("var %snn%s = %v", genTempVarPfx, i, nn)
- x.linef("var %snn%s int", genTempVarPfx, i)
- x.linef("for _, b := range %s { if b { %snn%s++ } }", numfieldsvar, genTempVarPfx, i)
- x.linef("r.WriteMapStart(%snn%s)", genTempVarPfx, i)
- x.linef("%snn%s = %v", genTempVarPfx, i, 0)
- } else {
- x.linef("r.WriteMapStart(%d)", len(tisfi))
+
+ type genFQN struct {
+ i string
+ fqname string
+ nilLine genBuf
+ nilVar string
+ canNil bool
+ sf reflect.StructField
}
- x.line("}") // close if not StructToArray
+ genFQNs := make([]genFQN, len(tisfi))
for j, si := range tisfi {
- i := x.varsfx()
- isNilVarName := genTempVarPfx + "n" + i
- var labelUsed bool
- var t2 reflect.StructField
+ q := &genFQNs[j]
+ q.i = x.varsfx()
+ q.nilVar = genTempVarPfx + "n" + q.i
+ q.canNil = false
+ q.fqname = varname
{
t2typ := t
- varname3 := varname
for ij, ix := range si.is {
if uint8(ij) == si.nis {
break
@@ -1005,53 +1070,77 @@ func (x *genRunner) encStruct(varname string, rtid uintptr, t reflect.Type) {
for t2typ.Kind() == reflect.Ptr {
t2typ = t2typ.Elem()
}
- t2 = t2typ.Field(int(ix))
- t2typ = t2.Type
- varname3 = varname3 + "." + t2.Name
+ q.sf = t2typ.Field(int(ix))
+ t2typ = q.sf.Type
+ q.fqname += "." + q.sf.Name
if t2typ.Kind() == reflect.Ptr {
- if !labelUsed {
- x.line("var " + isNilVarName + " bool")
+ if !q.canNil {
+ q.nilLine.f("%s == nil", q.fqname)
+ q.canNil = true
+ } else {
+ q.nilLine.f(" || %s == nil", q.fqname)
}
- x.line("if " + varname3 + " == nil { " + isNilVarName + " = true ")
- x.line("goto LABEL" + i)
- x.line("}")
- labelUsed = true
+ // x.linef("if %s == nil { %s = true; goto LABEL%d }", varname3, isNilVarName, i)
// "varname3 = new(" + x.genTypeName(t3.Elem()) + ") }")
}
}
// t2 = t.FieldByIndex(si.is)
}
- if labelUsed {
- x.line("LABEL" + i + ":")
+ }
+
+ for j := range genFQNs {
+ q := &genFQNs[j]
+ if q.canNil {
+ x.linef("var %s bool = %s", q.nilVar, q.nilLine.v())
+ // x.linef("if %s { %s = true }", q.nilLine.v(), q.nilVar)
}
- // if the type of the field is a Selfer, or one of the ones
+ }
+
+ x.linef("if %s || %s {", ti2arrayvar, struct2arrvar) // if ti.toArray
+ x.linef("z.EncWriteArrayStart(%d)", len(tisfi))
- x.linef("if %s || %s {", ti2arrayvar, struct2arrvar) // if ti.toArray
- if labelUsed {
- x.linef("if %s { r.WriteArrayElem(); r.EncodeNil() } else { ", isNilVarName)
+ for j, si := range tisfi {
+ q := &genFQNs[j]
+ // if the type of the field is a Selfer, or one of the ones
+ if q.canNil {
+ x.linef("if %s { z.EncWriteArrayElem(); r.EncodeNil() } else { ", q.nilVar)
}
- x.line("r.WriteArrayElem()")
+ x.linef("z.EncWriteArrayElem()")
if si.omitEmpty() {
x.linef("if %s[%v] {", numfieldsvar, j)
}
- x.encVar(varname+"."+t2.Name, t2.Type)
+ // xdebug2f("varname: %s, t2.Type: %s", varname3, t2.Type)
+ x.encVarChkNil(q.fqname, q.sf.Type, false)
if si.omitEmpty() {
x.linef("} else {")
- x.encZero(t2.Type)
+ x.encZero(q.sf.Type)
x.linef("}")
}
- if labelUsed {
+ if q.canNil {
x.line("}")
}
+ }
- x.linef("} else {") // if not ti.toArray
+ x.line("z.EncWriteArrayEnd()")
+ x.linef("} else {") // if not ti.toArray
+ if ti.anyOmitEmpty {
+ // nn = 0
+ // x.linef("var %snn%s = %v", genTempVarPfx, i, nn)
+ x.linef("var %snn%s int", genTempVarPfx, i)
+ x.linef("for _, b := range %s { if b { %snn%s++ } }", numfieldsvar, genTempVarPfx, i)
+ x.linef("z.EncWriteMapStart(%snn%s)", genTempVarPfx, i)
+ x.linef("%snn%s = %v", genTempVarPfx, i, 0)
+ } else {
+ x.linef("z.EncWriteMapStart(%d)", len(tisfi))
+ }
+ for j, si := range tisfi {
+ q := &genFQNs[j]
if si.omitEmpty() {
x.linef("if %s[%v] {", numfieldsvar, j)
}
- x.line("r.WriteMapElemKey()")
+ x.linef("z.EncWriteMapElemKey()")
- // x.line("r.EncodeStringEnc(codecSelferCcUTF8" + x.xs + ", `" + si.encName + "`)")
// emulate EncStructFieldKey
switch ti.keyType {
case valueTypeInt:
@@ -1070,25 +1159,20 @@ func (x *genRunner) encStruct(varname string, rtid uintptr, t reflect.Type) {
}
}
// x.linef("r.EncStructFieldKey(codecSelferValueType%s%s, `%s`)", ti.keyType.String(), x.xs, si.encName)
- x.line("r.WriteMapElemValue()")
- if labelUsed {
- x.line("if " + isNilVarName + " { r.EncodeNil() } else { ")
- x.encVar(varname+"."+t2.Name, t2.Type)
+ x.line("z.EncWriteMapElemValue()")
+ if q.canNil {
+ x.line("if " + q.nilVar + " { r.EncodeNil() } else { ")
+ x.encVarChkNil(q.fqname, q.sf.Type, false)
x.line("}")
} else {
- x.encVar(varname+"."+t2.Name, t2.Type)
+ x.encVarChkNil(q.fqname, q.sf.Type, false)
}
if si.omitEmpty() {
x.line("}")
}
- x.linef("} ") // end if/else ti.toArray
}
- x.linef("if %s || %s {", ti2arrayvar, struct2arrvar) // if ti.toArray {
- x.line("r.WriteArrayEnd()")
- x.line("} else {")
- x.line("r.WriteMapEnd()")
- x.line("}")
-
+ x.line("z.EncWriteMapEnd()")
+ x.linef("} ") // end if/else ti.toArray
}
func (x *genRunner) encListFallback(varname string, t reflect.Type) {
@@ -1125,13 +1209,13 @@ func (x *genRunner) encListFallback(varname string, t reflect.Type) {
varname = "sch" + i
}
- x.line("r.WriteArrayStart(len(" + varname + "))")
+ x.line("z.EncWriteArrayStart(len(" + varname + "))")
x.linef("for _, %sv%s := range %s {", genTempVarPfx, i, varname)
- x.line("r.WriteArrayElem()")
+ x.linef("z.EncWriteArrayElem()")
x.encVar(genTempVarPfx+"v"+i, t.Elem())
x.line("}")
- x.line("r.WriteArrayEnd()")
+ x.line("z.EncWriteArrayEnd()")
if t.Kind() == reflect.Chan {
x.line("}")
}
@@ -1140,22 +1224,24 @@ func (x *genRunner) encListFallback(varname string, t reflect.Type) {
func (x *genRunner) encMapFallback(varname string, t reflect.Type) {
// TODO: expand this to handle canonical.
i := x.varsfx()
- x.line("r.WriteMapStart(len(" + varname + "))")
+ x.line("z.EncWriteMapStart(len(" + varname + "))")
+ // x.linef("var %sfirst%s = true", genTempVarPfx, i)
x.linef("for %sk%s, %sv%s := range %s {", genTempVarPfx, i, genTempVarPfx, i, varname)
- x.line("r.WriteMapElemKey()")
+ x.linef("z.EncWriteMapElemKey()")
+ // x.linef("%sfirst%s = false", genTempVarPfx, i)
x.encVar(genTempVarPfx+"k"+i, t.Key())
- x.line("r.WriteMapElemValue()")
+ x.line("z.EncWriteMapElemValue()")
x.encVar(genTempVarPfx+"v"+i, t.Elem())
x.line("}")
- x.line("r.WriteMapEnd()")
+ x.line("z.EncWriteMapEnd()")
}
func (x *genRunner) decVarInitPtr(varname, nilvar string, t reflect.Type, si *structFieldInfo,
- newbuf, nilbuf *genBuf) (t2 reflect.StructField) {
+ newbuf, nilbuf *genBuf) (varname3 string, t2 reflect.StructField) {
//we must accommodate anonymous fields, where the embedded field is a nil pointer in the value.
// t2 = t.FieldByIndex(si.is)
+ varname3 = varname
t2typ := t
- varname3 := varname
t2kind := t2typ.Kind()
var nilbufed bool
if si != nil {
@@ -1178,10 +1264,11 @@ func (x *genRunner) decVarInitPtr(varname, nilvar string, t reflect.Type, si *st
}
if nilbuf != nil {
if !nilbufed {
- nilbuf.s("if true")
+ nilbuf.s("if ").s(varname3).s(" != nil")
nilbufed = true
+ } else {
+ nilbuf.s(" && ").s(varname3).s(" != nil")
}
- nilbuf.s(" && ").s(varname3).s(" != nil")
}
}
}
@@ -1190,7 +1277,7 @@ func (x *genRunner) decVarInitPtr(varname, nilvar string, t reflect.Type, si *st
// }
if nilbuf != nil {
if nilbufed {
- nilbuf.s(" { ")
+ nilbuf.s(" { ").s("// remove the if-true\n")
}
if nilvar != "" {
nilbuf.s(nilvar).s(" = true")
@@ -1207,7 +1294,7 @@ func (x *genRunner) decVarInitPtr(varname, nilvar string, t reflect.Type, si *st
nilbuf.s("}")
}
}
- return t2
+ return
}
// decVar takes a variable called varname, of type t
@@ -1324,8 +1411,9 @@ func (x *genRunner) dec(varname string, t reflect.Type, isptr bool) {
mi := x.varsfx()
// x.linef("%sm%s := z.DecBinary()", genTempVarPfx, mi)
// x.linef("_ = %sm%s", genTempVarPfx, mi)
- x.line("if false {") //start if block
- defer func() { x.line("}") }() //end if block
+
+ var hasIf genIfClause
+ defer hasIf.end(x)
var ptrPfx, addrPfx string
if isptr {
@@ -1334,16 +1422,16 @@ func (x *genRunner) dec(varname string, t reflect.Type, isptr bool) {
addrPfx = "&"
}
if t == timeTyp {
- x.linef("} else if !z.DecBasicHandle().TimeNotBuiltin { %s%v = r.DecodeTime()", ptrPfx, varname)
+ x.linef("%s !z.DecBasicHandle().TimeNotBuiltin { %s%v = r.DecodeTime()", hasIf.c(false), ptrPfx, varname)
// return
}
if t == rawTyp {
- x.linef("} else { %s%v = z.DecRaw()", ptrPfx, varname)
+ x.linef("%s %s%v = z.DecRaw()", hasIf.c(true), ptrPfx, varname)
return
}
if t == rawExtTyp {
- x.linef("} else { r.DecodeExt(%s%v, 0, nil)", addrPfx, varname)
+ x.linef("%s r.DecodeExt(%s%v, 0, nil)", hasIf.c(true), addrPfx, varname)
return
}
@@ -1352,19 +1440,19 @@ func (x *genRunner) dec(varname string, t reflect.Type, isptr bool) {
// first check if extensions are configued, before doing the interface conversion
// x.linef("} else if z.HasExtensions() && z.DecExt(%s) {", varname)
yy := fmt.Sprintf("%sxt%s", genTempVarPfx, mi)
- x.linef("} else if %s := z.Extension(z.I2Rtid(%s)); %s != nil { z.DecExtension(%s, %s) ", yy, varname, yy, varname, yy)
+ x.linef("%s %s := z.Extension(z.I2Rtid(%s)); %s != nil { z.DecExtension(%s, %s) ", hasIf.c(false), yy, varname, yy, varname, yy)
}
if ti2.bu || ti2.bup { // t.Implements(binaryUnmarshalerTyp) || tptr.Implements(binaryUnmarshalerTyp) {
- x.linef("} else if z.DecBinary() { z.DecBinaryUnmarshal(%s%v) ", addrPfx, varname)
+ x.linef("%s z.DecBinary() { z.DecBinaryUnmarshal(%s%v) ", hasIf.c(false), addrPfx, varname)
}
if ti2.ju || ti2.jup { // t.Implements(jsonUnmarshalerTyp) || tptr.Implements(jsonUnmarshalerTyp) {
- x.linef("} else if !z.DecBinary() && z.IsJSONHandle() { z.DecJSONUnmarshal(%s%v)", addrPfx, varname)
+ x.linef("%s !z.DecBinary() && z.IsJSONHandle() { z.DecJSONUnmarshal(%s%v)", hasIf.c(false), addrPfx, varname)
} else if ti2.tu || ti2.tup { // t.Implements(textUnmarshalerTyp) || tptr.Implements(textUnmarshalerTyp) {
- x.linef("} else if !z.DecBinary() { z.DecTextUnmarshal(%s%v)", addrPfx, varname)
+ x.linef("%s !z.DecBinary() { z.DecTextUnmarshal(%s%v)", hasIf.c(false), addrPfx, varname)
}
- x.line("} else {")
+ x.lineIf(hasIf.c(true))
if x.decTryAssignPrimitive(varname, t, isptr) {
return
@@ -1383,7 +1471,7 @@ func (x *genRunner) dec(varname string, t reflect.Type, isptr bool) {
x.linef("%s%s = r.DecodeBytes(%s(%s[]byte)(%s), false)",
ptrPfx, varname, ptrPfx, ptrPfx, varname)
} else if fastpathAV.index(rtid) != -1 {
- g := x.newGenV(t)
+ g := x.newFastpathGenV(t)
x.linef("z.F.%sX(%s%s, d)", g.MethodNamePfx("Dec", false), addrPfx, varname)
} else {
x.xtraSM(varname, t, false, isptr)
@@ -1395,7 +1483,7 @@ func (x *genRunner) dec(varname string, t reflect.Type, isptr bool) {
// - if elements are primitives or Selfers, call dedicated function on each member.
// - else call Encoder.encode(XXX) on it.
if fastpathAV.index(rtid) != -1 {
- g := x.newGenV(t)
+ g := x.newFastpathGenV(t)
x.linef("z.F.%sX(%s%s, d)", g.MethodNamePfx("Dec", false), addrPfx, varname)
} else {
x.xtraSM(varname, t, false, isptr)
@@ -1458,7 +1546,7 @@ func (x *genRunner) decTryAssignPrimitive(varname string, t reflect.Type, isptr
x.linef("%s%s = (%s)(z.C.UintV(r.DecodeUint64(), codecSelferBitsize%s))", ptr, varname, x.genTypeName(t), x.xs)
case reflect.Float32:
- x.linef("%s%s = (%s)(r.DecodeFloat32As64())", ptr, varname, x.genTypeName(t))
+ x.linef("%s%s = (%s)(z.DecDecodeFloat32())", ptr, varname, x.genTypeName(t))
case reflect.Float64:
x.linef("%s%s = (%s)(r.DecodeFloat64())", ptr, varname, x.genTypeName(t))
@@ -1583,9 +1671,9 @@ func (x *genRunner) decStructMapSwitch(kName string, varname string, rtid uintpt
x.line("case \"" + si.encName + "\":")
newbuf.reset()
nilbuf.reset()
- t2 := x.decVarInitPtr(varname, "", t, si, &newbuf, &nilbuf)
+ varname3, t2 := x.decVarInitPtr(varname, "", t, si, &newbuf, &nilbuf)
x.linef("if r.TryDecodeAsNil() { %s } else { %s", nilbuf.buf, newbuf.buf)
- x.decVarMain(varname+"."+t2.Name, x.varsfx(), t2.Type, false)
+ x.decVarMain(varname3, x.varsfx(), t2.Type, false)
x.line("}")
}
x.line("default:")
@@ -1611,7 +1699,7 @@ func (x *genRunner) decStructMap(varname, lenvarname string, rtid uintptr, t ref
x.linef("if %shl%s { if %sj%s >= %s { break }", tpfx, i, tpfx, i, lenvarname)
x.line("} else { if r.CheckBreak() { break }; }")
}
- x.line("r.ReadMapElemKey()")
+ x.line("z.DecReadMapElemKey()")
// emulate decstructfieldkey
switch ti.keyType {
@@ -1626,11 +1714,11 @@ func (x *genRunner) decStructMap(varname, lenvarname string, rtid uintptr, t ref
}
// x.linef("%s := z.StringView(r.DecStructFieldKey(codecSelferValueType%s%s, z.DecScratchArrayBuffer()))", kName, ti.keyType.String(), x.xs)
- x.line("r.ReadMapElemValue()")
+ x.line("z.DecReadMapElemValue()")
x.decStructMapSwitch(kName, varname, rtid, t)
x.line("} // end for " + tpfx + "j" + i)
- x.line("r.ReadMapEnd()")
+ x.line("z.DecReadMapEnd()")
}
func (x *genRunner) decStructArray(varname, lenvarname, breakString string, rtid uintptr, t reflect.Type) {
@@ -1646,13 +1734,13 @@ func (x *genRunner) decStructArray(varname, lenvarname, breakString string, rtid
x.linef("%sj%s++; if %shl%s { %sb%s = %sj%s > %s } else { %sb%s = r.CheckBreak() }",
tpfx, i, tpfx, i, tpfx, i,
tpfx, i, lenvarname, tpfx, i)
- x.linef("if %sb%s { r.ReadArrayEnd(); %s }", tpfx, i, breakString)
- x.line("r.ReadArrayElem()")
+ x.linef("if %sb%s { z.DecReadArrayEnd(); %s }", tpfx, i, breakString)
+ x.line("z.DecReadArrayElem()")
newbuf.reset()
nilbuf.reset()
- t2 := x.decVarInitPtr(varname, "", t, si, &newbuf, &nilbuf)
+ varname3, t2 := x.decVarInitPtr(varname, "", t, si, &newbuf, &nilbuf)
x.linef("if r.TryDecodeAsNil() { %s } else { %s", nilbuf.buf, newbuf.buf)
- x.decVarMain(varname+"."+t2.Name, x.varsfx(), t2.Type, false)
+ x.decVarMain(varname3, x.varsfx(), t2.Type, false)
x.line("}")
}
// read remaining values and throw away.
@@ -1661,10 +1749,10 @@ func (x *genRunner) decStructArray(varname, lenvarname, breakString string, rtid
tpfx, i, tpfx, i, tpfx, i,
tpfx, i, lenvarname, tpfx, i)
x.linef("if %sb%s { break }", tpfx, i)
- x.line("r.ReadArrayElem()")
+ x.line("z.DecReadArrayElem()")
x.linef(`z.DecStructFieldNotFound(%sj%s - 1, "")`, tpfx, i)
x.line("}")
- x.line("r.ReadArrayEnd()")
+ x.line("z.DecReadArrayEnd()")
}
func (x *genRunner) decStruct(varname string, rtid uintptr, t reflect.Type) {
@@ -1672,9 +1760,9 @@ func (x *genRunner) decStruct(varname string, rtid uintptr, t reflect.Type) {
i := x.varsfx()
x.linef("%sct%s := r.ContainerType()", genTempVarPfx, i)
x.linef("if %sct%s == codecSelferValueTypeMap%s {", genTempVarPfx, i, x.xs)
- x.line(genTempVarPfx + "l" + i + " := r.ReadMapStart()")
+ x.line(genTempVarPfx + "l" + i + " := z.DecReadMapStart()")
x.linef("if %sl%s == 0 {", genTempVarPfx, i)
- x.line("r.ReadMapEnd()")
+ x.line("z.DecReadMapEnd()")
if genUseOneFunctionForDecStructMap {
x.line("} else { ")
x.linef("%s.codecDecodeSelfFromMap(%sl%s, d)", varname, genTempVarPfx, i)
@@ -1688,9 +1776,9 @@ func (x *genRunner) decStruct(varname string, rtid uintptr, t reflect.Type) {
// else if container is array
x.linef("} else if %sct%s == codecSelferValueTypeArray%s {", genTempVarPfx, i, x.xs)
- x.line(genTempVarPfx + "l" + i + " := r.ReadArrayStart()")
+ x.line(genTempVarPfx + "l" + i + " := z.DecReadArrayStart()")
x.linef("if %sl%s == 0 {", genTempVarPfx, i)
- x.line("r.ReadArrayEnd()")
+ x.line("z.DecReadArrayEnd()")
x.line("} else { ")
x.linef("%s.codecDecodeSelfFromArray(%sl%s, d)", varname, genTempVarPfx, i)
x.line("}")
@@ -1702,15 +1790,17 @@ func (x *genRunner) decStruct(varname string, rtid uintptr, t reflect.Type) {
// --------
-type genV struct {
- // genV is either a primitive (Primitive != "") or a map (MapKey != "") or a slice
- MapKey string
- Elem string
- Primitive string
- Size int
+type fastpathGenV struct {
+ // fastpathGenV is either a primitive (Primitive != "") or a map (MapKey != "") or a slice
+ MapKey string
+ Elem string
+ Primitive string
+ Size int
+ NoCanonical bool
}
-func (x *genRunner) newGenV(t reflect.Type) (v genV) {
+func (x *genRunner) newFastpathGenV(t reflect.Type) (v fastpathGenV) {
+ v.NoCanonical = !genFastpathCanonical
switch t.Kind() {
case reflect.Slice, reflect.Array:
te := t.Elem()
@@ -1722,12 +1812,12 @@ func (x *genRunner) newGenV(t reflect.Type) (v genV) {
v.MapKey = x.genTypeName(tk)
v.Size = int(te.Size() + tk.Size())
default:
- panic("unexpected type for newGenV. Requires map or slice type")
+ panic("unexpected type for newFastpathGenV. Requires map or slice type")
}
return
}
-func (x *genV) MethodNamePfx(prefix string, prim bool) string {
+func (x *fastpathGenV) MethodNamePfx(prefix string, prim bool) string {
var name []byte
if prefix != "" {
name = append(name, prefix...)
@@ -1744,7 +1834,6 @@ func (x *genV) MethodNamePfx(prefix string, prim bool) string {
name = append(name, genTitleCaseName(x.Elem)...)
}
return string(name)
-
}
// genImportPath returns import path of a non-predeclared named typed, or an empty string otherwise.
@@ -1792,6 +1881,8 @@ func genTitleCaseName(s string) string {
switch s {
case "interface{}", "interface {}":
return "Intf"
+ case "[]byte", "[]uint8", "bytes":
+ return "Bytes"
default:
return strings.ToUpper(s[0:1]) + s[1:]
}
@@ -1879,7 +1970,7 @@ func genIsImmutable(t reflect.Type) (v bool) {
type genInternal struct {
Version int
- Values []genV
+ Values []fastpathGenV
}
func (x genInternal) FastpathLen() (l int) {
@@ -1895,6 +1986,8 @@ func genInternalZeroValue(s string) string {
switch s {
case "interface{}", "interface {}":
return "nil"
+ case "[]byte", "[]uint8", "bytes":
+ return "nil"
case "bool":
return "false"
case "string":
@@ -1904,48 +1997,55 @@ func genInternalZeroValue(s string) string {
}
}
-var genInternalNonZeroValueIdx [5]uint64
-var genInternalNonZeroValueStrs = [2][5]string{
- {`"string-is-an-interface"`, "true", `"some-string"`, "11.1", "33"},
- {`"string-is-an-interface-2"`, "true", `"some-string-2"`, "22.2", "44"},
+var genInternalNonZeroValueIdx [6]uint64
+var genInternalNonZeroValueStrs = [2][6]string{
+ {`"string-is-an-interface"`, "true", `"some-string"`, `[]byte("some-string")`, "11.1", "33"},
+ {`"string-is-an-interface-2"`, "true", `"some-string-2"`, `[]byte("some-string-2")`, "22.2", "44"},
}
func genInternalNonZeroValue(s string) string {
+ var i int
switch s {
case "interface{}", "interface {}":
- genInternalNonZeroValueIdx[0]++
- return genInternalNonZeroValueStrs[genInternalNonZeroValueIdx[0]%2][0] // return string, to remove ambiguity
+ i = 0
case "bool":
- genInternalNonZeroValueIdx[1]++
- return genInternalNonZeroValueStrs[genInternalNonZeroValueIdx[1]%2][1]
+ i = 1
case "string":
- genInternalNonZeroValueIdx[2]++
- return genInternalNonZeroValueStrs[genInternalNonZeroValueIdx[2]%2][2]
+ i = 2
+ case "bytes", "[]byte", "[]uint8":
+ i = 3
case "float32", "float64", "float", "double":
- genInternalNonZeroValueIdx[3]++
- return genInternalNonZeroValueStrs[genInternalNonZeroValueIdx[3]%2][3]
+ i = 4
default:
- genInternalNonZeroValueIdx[4]++
- return genInternalNonZeroValueStrs[genInternalNonZeroValueIdx[4]%2][4]
+ i = 5
}
+ genInternalNonZeroValueIdx[i]++
+ return genInternalNonZeroValueStrs[genInternalNonZeroValueIdx[i]%2][i] // return string, to remove ambiguity
}
func genInternalEncCommandAsString(s string, vname string) string {
switch s {
- case "uint", "uint8", "uint16", "uint32", "uint64":
- return "ee.EncodeUint(uint64(" + vname + "))"
- case "int", "int8", "int16", "int32", "int64":
- return "ee.EncodeInt(int64(" + vname + "))"
+ case "uint64":
+ return "e.e.EncodeUint(" + vname + ")"
+ case "uint", "uint8", "uint16", "uint32":
+ return "e.e.EncodeUint(uint64(" + vname + "))"
+ case "int64":
+ return "e.e.EncodeInt(" + vname + ")"
+ case "int", "int8", "int16", "int32":
+ return "e.e.EncodeInt(int64(" + vname + "))"
+ case "[]byte", "[]uint8", "bytes":
+ return "e.e.EncodeStringBytesRaw(" + vname + ")"
case "string":
- return "ee.EncodeStringEnc(cUTF8, " + vname + ")"
+ return "if e.h.StringToRaw { e.e.EncodeStringBytesRaw(bytesView(" + vname + ")) " +
+ "} else { e.e.EncodeStringEnc(cUTF8, " + vname + ") }"
case "float32":
- return "ee.EncodeFloat32(" + vname + ")"
+ return "e.e.EncodeFloat32(" + vname + ")"
case "float64":
- return "ee.EncodeFloat64(" + vname + ")"
+ return "e.e.EncodeFloat64(" + vname + ")"
case "bool":
- return "ee.EncodeBool(" + vname + ")"
+ return "e.e.EncodeBool(" + vname + ")"
// case "symbol":
- // return "ee.EncodeSymbol(" + vname + ")"
+ // return "e.e.EncodeSymbol(" + vname + ")"
default:
return "e.encode(" + vname + ")"
}
@@ -1954,50 +2054,58 @@ func genInternalEncCommandAsString(s string, vname string) string {
func genInternalDecCommandAsString(s string) string {
switch s {
case "uint":
- return "uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))"
+ return "uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize))"
case "uint8":
- return "uint8(chkOvf.UintV(dd.DecodeUint64(), 8))"
+ return "uint8(chkOvf.UintV(d.d.DecodeUint64(), 8))"
case "uint16":
- return "uint16(chkOvf.UintV(dd.DecodeUint64(), 16))"
+ return "uint16(chkOvf.UintV(d.d.DecodeUint64(), 16))"
case "uint32":
- return "uint32(chkOvf.UintV(dd.DecodeUint64(), 32))"
+ return "uint32(chkOvf.UintV(d.d.DecodeUint64(), 32))"
case "uint64":
- return "dd.DecodeUint64()"
+ return "d.d.DecodeUint64()"
case "uintptr":
- return "uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))"
+ return "uintptr(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize))"
case "int":
- return "int(chkOvf.IntV(dd.DecodeInt64(), intBitsize))"
+ return "int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize))"
case "int8":
- return "int8(chkOvf.IntV(dd.DecodeInt64(), 8))"
+ return "int8(chkOvf.IntV(d.d.DecodeInt64(), 8))"
case "int16":
- return "int16(chkOvf.IntV(dd.DecodeInt64(), 16))"
+ return "int16(chkOvf.IntV(d.d.DecodeInt64(), 16))"
case "int32":
- return "int32(chkOvf.IntV(dd.DecodeInt64(), 32))"
+ return "int32(chkOvf.IntV(d.d.DecodeInt64(), 32))"
case "int64":
- return "dd.DecodeInt64()"
+ return "d.d.DecodeInt64()"
case "string":
- return "dd.DecodeString()"
+ return "d.d.DecodeString()"
+ case "[]byte", "[]uint8", "bytes":
+ return "d.d.DecodeBytes(nil, false)"
case "float32":
- return "float32(chkOvf.Float32V(dd.DecodeFloat64()))"
+ return "float32(d.decodeFloat32())"
case "float64":
- return "dd.DecodeFloat64()"
+ return "d.d.DecodeFloat64()"
case "bool":
- return "dd.DecodeBool()"
+ return "d.d.DecodeBool()"
default:
panic(errors.New("gen internal: unknown type for decode: " + s))
}
}
func genInternalSortType(s string, elem bool) string {
- for _, v := range [...]string{"int", "uint", "float", "bool", "string"} {
+ for _, v := range [...]string{
+ "int", "uint", "float",
+ "bool",
+ "string", "bytes", "[]uint8", "[]byte",
+ } {
+ if v == "[]byte" || v == "[]uint8" {
+ v = "bytes"
+ }
if strings.HasPrefix(s, v) {
+ if v == "int" || v == "uint" || v == "float" {
+ v += "64"
+ }
if elem {
- if v == "int" || v == "uint" || v == "float" {
- return v + "64"
- } else {
- return v
- }
+ return v
}
return v + "Slice"
}
@@ -2024,49 +2132,12 @@ var genInternalTmplFuncs template.FuncMap
var genInternalOnce sync.Once
func genInternalInit() {
- types := [...]string{
- "interface{}",
- "string",
- "float32",
- "float64",
- "uint",
- "uint8",
- "uint16",
- "uint32",
- "uint64",
- "uintptr",
- "int",
- "int8",
- "int16",
- "int32",
- "int64",
- "bool",
- }
- // keep as slice, so it is in specific iteration order.
- // Initial order was uint64, string, interface{}, int, int64
- mapvaltypes := [...]string{
- "interface{}",
- "string",
- "uint",
- "uint8",
- "uint16",
- "uint32",
- "uint64",
- "uintptr",
- "int",
- "int8",
- "int16",
- "int32",
- "int64",
- "float32",
- "float64",
- "bool",
- }
wordSizeBytes := int(intBitsize) / 8
- mapvaltypes2 := map[string]int{
+ typesizes := map[string]int{
"interface{}": 2 * wordSizeBytes,
"string": 2 * wordSizeBytes,
+ "[]byte": 3 * wordSizeBytes,
"uint": 1 * wordSizeBytes,
"uint8": 1,
"uint16": 2,
@@ -2082,20 +2153,113 @@ func genInternalInit() {
"float64": 8,
"bool": 1,
}
+
+ // keep as slice, so it is in specific iteration order.
+ // Initial order was uint64, string, interface{}, int, int64, ...
+
+ var types = [...]string{
+ "interface{}",
+ "string",
+ "[]byte",
+ "float32",
+ "float64",
+ "uint",
+ "uint8",
+ "uint16",
+ "uint32",
+ "uint64",
+ "uintptr",
+ "int",
+ "int8",
+ "int16",
+ "int32",
+ "int64",
+ "bool",
+ }
+
+ var primitivetypes, slicetypes, mapkeytypes, mapvaltypes []string
+
+ primitivetypes = types[:]
+ slicetypes = types[:]
+ mapkeytypes = types[:]
+ mapvaltypes = types[:]
+
+ if genFastpathTrimTypes {
+ mapkeytypes = []string{
+ //"interface{}",
+ "string",
+ //"[]byte",
+ //"float32",
+ //"float64",
+ "uint",
+ "uint8",
+ //"uint16",
+ //"uint32",
+ "uint64",
+ //"uintptr",
+ "int",
+ //"int8",
+ //"int16",
+ //"int32",
+ "int64",
+ // "bool",
+ }
+
+ mapvaltypes = []string{
+ "interface{}",
+ "string",
+ "[]byte",
+ "uint",
+ "uint8",
+ //"uint16",
+ //"uint32",
+ "uint64",
+ "uintptr",
+ "int",
+ //"int8",
+ //"int16",
+ //"int32",
+ "int64",
+ "float32",
+ "float64",
+ "bool",
+ }
+ }
+
+ // var mapkeytypes [len(&types) - 1]string // skip bool
+ // copy(mapkeytypes[:], types[:])
+
+ // var mb []byte
+ // mb = append(mb, '|')
+ // for _, s := range mapkeytypes {
+ // mb = append(mb, s...)
+ // mb = append(mb, '|')
+ // }
+ // var mapkeytypestr = string(mb)
+
var gt = genInternal{Version: genVersion}
// For each slice or map type, there must be a (symmetrical) Encode and Decode fast-path function
- for _, s := range types {
- gt.Values = append(gt.Values, genV{Primitive: s, Size: mapvaltypes2[s]})
+
+ for _, s := range primitivetypes {
+ gt.Values = append(gt.Values,
+ fastpathGenV{Primitive: s, Size: typesizes[s], NoCanonical: !genFastpathCanonical})
+ }
+ for _, s := range slicetypes {
// if s != "uint8" { // do not generate fast path for slice of bytes. Treat specially already.
- // gt.Values = append(gt.Values, genV{Elem: s, Size: mapvaltypes2[s]})
+ // gt.Values = append(gt.Values, fastpathGenV{Elem: s, Size: typesizes[s]})
+ // }
+ gt.Values = append(gt.Values,
+ fastpathGenV{Elem: s, Size: typesizes[s], NoCanonical: !genFastpathCanonical})
+ }
+ for _, s := range mapkeytypes {
+ // if _, ok := typesizes[s]; !ok {
+ // if strings.Contains(mapkeytypestr, "|"+s+"|") {
+ // gt.Values = append(gt.Values, fastpathGenV{MapKey: s, Elem: s, Size: 2 * typesizes[s]})
// }
- gt.Values = append(gt.Values, genV{Elem: s, Size: mapvaltypes2[s]})
- if _, ok := mapvaltypes2[s]; !ok {
- gt.Values = append(gt.Values, genV{MapKey: s, Elem: s, Size: 2 * mapvaltypes2[s]})
- }
for _, ms := range mapvaltypes {
- gt.Values = append(gt.Values, genV{MapKey: s, Elem: ms, Size: mapvaltypes2[s] + mapvaltypes2[ms]})
+ gt.Values = append(gt.Values,
+ fastpathGenV{MapKey: s, Elem: ms, Size: typesizes[s] + typesizes[ms], NoCanonical: !genFastpathCanonical})
}
}
diff --git a/vendor/github.com/ugorji/go/codec/go.mod b/vendor/github.com/ugorji/go/codec/go.mod
index ea7ad970..ca967b44 100644
--- a/vendor/github.com/ugorji/go/codec/go.mod
+++ b/vendor/github.com/ugorji/go/codec/go.mod
@@ -1,2 +1,5 @@
module github.com/ugorji/go/codec
+require (
+ github.com/ugorji/go v1.1.5-pre
+)
diff --git a/vendor/github.com/ugorji/go/codec/helper.go b/vendor/github.com/ugorji/go/codec/helper.go
index 2c02f9c1..daca5774 100644
--- a/vendor/github.com/ugorji/go/codec/helper.go
+++ b/vendor/github.com/ugorji/go/codec/helper.go
@@ -127,7 +127,7 @@ const (
// arrayCacheLen is the length of the cache used in encoder or decoder for
// allowing zero-alloc initialization.
- arrayCacheLen = 8
+ // arrayCacheLen = 8
// size of the cacheline: defaulting to value for archs: amd64, arm64, 386
// should use "runtime/internal/sys".CacheLineSize, but that is not exposed.
@@ -149,8 +149,7 @@ const (
// explicitly call SetFinalizer themselves e.g.
// runtime.SetFinalizer(e, (*Encoder).Release)
// runtime.SetFinalizer(d, (*Decoder).Release)
- useFinalizers = false
- removeFinalizerOnRelease = false
+ useFinalizers = false
)
var oneByteArr [1]byte
@@ -171,6 +170,14 @@ func init() {
refBitset.set(byte(reflect.Chan))
}
+type handleFlag uint8
+
+const (
+ initedHandleFlag handleFlag = 1 << iota
+ binaryHandleFlag
+ jsonHandleFlag
+)
+
type clsErr struct {
closed bool // is it closed?
errClosed error // error on closing
@@ -258,11 +265,11 @@ type containerState uint8
const (
_ containerState = iota
- containerMapStart // slot left open, since Driver method already covers it
+ containerMapStart
containerMapKey
containerMapValue
containerMapEnd
- containerArrayStart // slot left open, since Driver methods already cover it
+ containerArrayStart
containerArrayElem
containerArrayEnd
)
@@ -294,6 +301,7 @@ const (
typeInfoLoadArrayBLen = 8 * 4
)
+// typeInfoLoad is a transient object used while loading up a typeInfo.
type typeInfoLoad struct {
// fNames []string
// encNames []string
@@ -301,6 +309,8 @@ type typeInfoLoad struct {
sfis []structFieldInfo
}
+// typeInfoLoadArray is a cache object used to efficiently load up a typeInfo without
+// much allocation.
type typeInfoLoadArray struct {
// fNames [typeInfoLoadArrayLen]string
// encNames [typeInfoLoadArrayLen]string
@@ -310,6 +320,12 @@ type typeInfoLoadArray struct {
b [typeInfoLoadArrayBLen]byte // scratch - used for struct field names
}
+// // cacheLineSafer denotes that a type is safe for cache-line access.
+// // This could mean that
+// type cacheLineSafer interface {
+// cacheLineSafe()
+// }
+
// mirror json.Marshaler and json.Unmarshaler here,
// so we don't import the encoding/json package
@@ -523,10 +539,9 @@ type BasicHandle struct {
intf2impls
- inited uint32
- _ uint32 // padding
+ EncodeOptions
- // ---- cache line
+ DecodeOptions
RPCOptions
@@ -560,37 +575,71 @@ type BasicHandle struct {
// runtime.SetFinalizer(d, (*Decoder).Release)
ExplicitRelease bool
- be bool // is handle a binary encoding?
- js bool // is handle javascript handler?
- n byte // first letter of handle name
- _ uint16 // padding
-
- // ---- cache line
-
- DecodeOptions
+ // flags handleFlag // holds flag for if binaryEncoding, jsonHandler, etc
+ // be bool // is handle a binary encoding?
+ // js bool // is handle javascript handler?
+ // n byte // first letter of handle name
+ // _ uint16 // padding
// ---- cache line
- EncodeOptions
-
// noBuiltInTypeChecker
+ inited uint32 // holds if inited, and also handle flags (binary encoding, json handler, etc)
+ mu sync.Mutex
+ // _ uint32 // padding
rtidFns atomicRtidFnSlice
- mu sync.Mutex
+
// r []uintptr // rtids mapped to s above
}
// basicHandle returns an initialized BasicHandle from the Handle.
func basicHandle(hh Handle) (x *BasicHandle) {
x = hh.getBasicHandle()
- if atomic.CompareAndSwapUint32(&x.inited, 0, 1) {
- x.be = hh.isBinary()
- _, x.js = hh.(*JsonHandle)
- x.n = hh.Name()[0]
+ // ** We need to simulate once.Do, to ensure no data race within the block.
+ // ** Consequently, below would not work.
+ // if atomic.CompareAndSwapUint32(&x.inited, 0, 1) {
+ // x.be = hh.isBinary()
+ // _, x.js = hh.(*JsonHandle)
+ // x.n = hh.Name()[0]
+ // }
+
+ // simulate once.Do using our own stored flag and mutex as a CompareAndSwap
+ // is not sufficient, since a race condition can occur within init(Handle) function.
+ // init is made noinline, so that this function can be inlined by its caller.
+ if atomic.LoadUint32(&x.inited) == 0 {
+ x.init(hh)
}
return
}
+func (x *BasicHandle) isJs() bool {
+ return handleFlag(x.inited)&jsonHandleFlag != 0
+}
+
+func (x *BasicHandle) isBe() bool {
+ return handleFlag(x.inited)&binaryHandleFlag != 0
+}
+
+//go:noinline
+func (x *BasicHandle) init(hh Handle) {
+ // make it uninlineable, as it is called at most once
+ x.mu.Lock()
+ if x.inited == 0 {
+ var f = initedHandleFlag
+ if hh.isBinary() {
+ f |= binaryHandleFlag
+ }
+ if _, b := hh.(*JsonHandle); b {
+ f |= jsonHandleFlag
+ }
+ // _, x.js = hh.(*JsonHandle)
+ // x.n = hh.Name()[0]
+ atomic.StoreUint32(&x.inited, uint32(f))
+ }
+ x.mu.Unlock()
+}
+
func (x *BasicHandle) getBasicHandle() *BasicHandle {
return x
}
@@ -670,20 +719,21 @@ func (x *BasicHandle) fn(rt reflect.Type, checkFastpath, checkCodecSelfer bool)
if rk == reflect.Struct || rk == reflect.Array {
fi.addrE = true
}
- } else if supportMarshalInterfaces && c.be && (ti.bm || ti.bmp) && (ti.bu || ti.bup) {
+ } else if supportMarshalInterfaces && c.isBe() && (ti.bm || ti.bmp) && (ti.bu || ti.bup) {
fn.fe = (*Encoder).binaryMarshal
fn.fd = (*Decoder).binaryUnmarshal
fi.addrF = true
fi.addrD = ti.bup
fi.addrE = ti.bmp
- } else if supportMarshalInterfaces && !c.be && c.js && (ti.jm || ti.jmp) && (ti.ju || ti.jup) {
+ } else if supportMarshalInterfaces && !c.isBe() && c.isJs() &&
+ (ti.jm || ti.jmp) && (ti.ju || ti.jup) {
//If JSON, we should check JSONMarshal before textMarshal
fn.fe = (*Encoder).jsonMarshal
fn.fd = (*Decoder).jsonUnmarshal
fi.addrF = true
fi.addrD = ti.jup
fi.addrE = ti.jmp
- } else if supportMarshalInterfaces && !c.be && (ti.tm || ti.tmp) && (ti.tu || ti.tup) {
+ } else if supportMarshalInterfaces && !c.isBe() && (ti.tm || ti.tmp) && (ti.tu || ti.tup) {
fn.fe = (*Encoder).textMarshal
fn.fd = (*Decoder).textUnmarshal
fi.addrF = true
@@ -954,11 +1004,6 @@ func (x addExtWrapper) UpdateExt(dest interface{}, v interface{}) {
x.ReadExt(dest, v.([]byte))
}
-type extWrapper struct {
- BytesExt
- InterfaceExt
-}
-
type bytesExtFailer struct{}
func (bytesExtFailer) WriteExt(v interface{}) []byte {
@@ -979,6 +1024,21 @@ func (interfaceExtFailer) UpdateExt(dest interface{}, v interface{}) {
panicv.errorstr("InterfaceExt.UpdateExt is not supported")
}
+// type extWrapper struct {
+// BytesExt
+// InterfaceExt
+// }
+
+type bytesExtWrapper struct {
+ interfaceExtFailer
+ BytesExt
+}
+
+type interfaceExtWrapper struct {
+ bytesExtFailer
+ InterfaceExt
+}
+
type binaryEncodingType struct{}
func (binaryEncodingType) isBinary() bool { return true }
@@ -1036,7 +1096,7 @@ type extTypeTagFn struct {
rt reflect.Type
tag uint64
ext Ext
- _ [1]uint64 // padding
+ // _ [1]uint64 // padding
}
type extHandle []extTypeTagFn
@@ -1093,7 +1153,7 @@ func (o *extHandle) SetExt(rt reflect.Type, tag uint64, ext Ext) (err error) {
}
}
rtidptr := rt2id(reflect.PtrTo(rt))
- *o = append(o2, extTypeTagFn{rtid, rtidptr, rt, tag, ext, [1]uint64{}})
+ *o = append(o2, extTypeTagFn{rtid, rtidptr, rt, tag, ext}) // , [1]uint64{}})
return
}
@@ -1201,7 +1261,7 @@ type structFieldInfo struct {
encNameAsciiAlphaNum bool // the encName only contains ascii alphabet and numbers
structFieldInfoFlag
- _ [1]byte // padding
+ // _ [1]byte // padding
}
func (si *structFieldInfo) setToZeroValue(v reflect.Value) {
@@ -1390,7 +1450,8 @@ const (
typeInfoFlagIsZeroerPtr
)
-// typeInfo keeps information about each (non-ptr) type referenced in the encode/decode sequence.
+// typeInfo keeps static (non-changing readonly)information
+// about each (non-ptr) type referenced in the encode/decode sequence.
//
// During an encode/decode sequence, we work as below:
// - If base is a built in type, en/decode base value
@@ -1449,8 +1510,8 @@ type typeInfo struct {
flags typeInfoFlag
infoFieldOmitempty bool
- _ [6]byte // padding
- _ [2]uint64 // padding
+ // _ [6]byte // padding
+ // _ [2]uint64 // padding
}
func (ti *typeInfo) isFlag(f typeInfoFlag) bool {
@@ -1488,8 +1549,9 @@ type TypeInfos struct {
// infos: formerly map[uintptr]*typeInfo, now *[]rtid2ti, 2 words expected
infos atomicTypeInfoSlice
mu sync.Mutex
+ _ uint64 // padding (cache-aligned)
tags []string
- _ [2]uint64 // padding
+ _ uint64 // padding (cache-aligned)
}
// NewTypeInfos creates a TypeInfos given a set of struct tags keys.
@@ -1598,7 +1660,7 @@ func (x *TypeInfos) get(rtid uintptr, rt reflect.Type) (pti *typeInfo) {
} else {
ti.keyType = valueTypeString
}
- pp, pi := pool.tiLoad()
+ pp, pi := &pool.tiload, pool.tiload.Get() // pool.tiLoad()
pv := pi.(*typeInfoLoadArray)
pv.etypes[0] = ti.rtid
// vv := typeInfoLoad{pv.fNames[:0], pv.encNames[:0], pv.etypes[:1], pv.sfis[:0]}
@@ -1812,7 +1874,7 @@ func rgetResolveSFI(rt reflect.Type, x []structFieldInfo, pv *typeInfoLoadArray)
for i := range x {
ui = uint16(i)
xn = x[i].encName // fieldName or encName? use encName for now.
- if len(xn)+2 > cap(pv.b) {
+ if len(xn)+2 > cap(sn) {
sn = make([]byte, len(xn)+2)
} else {
sn = sn[:len(xn)+2]
@@ -1829,24 +1891,22 @@ func rgetResolveSFI(rt reflect.Type, x []structFieldInfo, pv *typeInfoLoadArray)
sa = append(sa, 0xff, byte(ui>>8), byte(ui))
} else {
index := uint16(sa[j+len(sn)+1]) | uint16(sa[j+len(sn)])<<8
- // one of them must be reset to nil,
- // and the index updated appropriately to the other one
- if x[i].nis == x[index].nis {
- } else if x[i].nis < x[index].nis {
+ // one of them must be cleared (reset to nil),
+ // and the index updated appropriately
+ i2clear := ui // index to be cleared
+ if x[i].nis < x[index].nis { // this one is shallower
+ // update the index to point to this later one.
sa[j+len(sn)], sa[j+len(sn)+1] = byte(ui>>8), byte(ui)
- if x[index].ready() {
- x[index].flagClr(structFieldInfoFlagReady)
- n--
- }
- } else {
- if x[i].ready() {
- x[i].flagClr(structFieldInfoFlagReady)
- n--
- }
+ // clear the earlier one, as this later one is shallower.
+ i2clear = index
+ }
+ if x[i2clear].ready() {
+ x[i2clear].flagClr(structFieldInfoFlagReady)
+ n--
}
}
-
}
+
var w []structFieldInfo
sharingArray := len(x) <= typeInfoLoadArraySfisLen // sharing array with typeInfoLoadArray
if sharingArray {
@@ -2016,7 +2076,7 @@ type codecFn struct {
i codecFnInfo
fe func(*Encoder, *codecFnInfo, reflect.Value)
fd func(*Decoder, *codecFnInfo, reflect.Value)
- _ [1]uint64 // padding
+ _ [1]uint64 // padding (cache-aligned)
}
type codecRtidFn struct {
@@ -2106,9 +2166,51 @@ func (x checkOverflow) SignedIntV(v uint64) int64 {
return int64(v)
}
-// ------------------ SORT -----------------
+// ------------------ FLOATING POINT -----------------
+
+func isNaN64(f float64) bool { return f != f }
+func isNaN32(f float32) bool { return f != f }
+func abs32(f float32) float32 {
+ return math.Float32frombits(math.Float32bits(f) &^ (1 << 31))
+}
+
+// Per go spec, floats are represented in memory as
+// IEEE single or double precision floating point values.
+//
+// We also looked at the source for stdlib math/modf.go,
+// reviewed https://github.com/chewxy/math32
+// and read wikipedia documents describing the formats.
+//
+// It became clear that we could easily look at the bits to determine
+// whether any fraction exists.
+//
+// This is all we need for now.
+
+func noFrac64(f float64) (v bool) {
+ x := math.Float64bits(f)
+ e := uint64(x>>52)&0x7FF - 1023 // uint(x>>shift)&mask - bias
+ // clear top 12+e bits, the integer part; if the rest is 0, then no fraction.
+ if e < 52 {
+ // return x&((1<<64-1)>>(12+e)) == 0
+ return x<<(12+e) == 0
+ }
+ return
+}
+func noFrac32(f float32) (v bool) {
+ x := math.Float32bits(f)
+ e := uint32(x>>23)&0xFF - 127 // uint(x>>shift)&mask - bias
+ // clear top 9+e bits, the integer part; if the rest is 0, then no fraction.
+ if e < 23 {
+ // return x&((1<<32-1)>>(9+e)) == 0
+ return x<<(9+e) == 0
+ }
+ return
+}
-func isNaN(f float64) bool { return f != f }
+// func noFrac(f float64) bool {
+// _, frac := math.Modf(float64(f))
+// return frac == 0
+// }
// -----------------------
@@ -2126,132 +2228,11 @@ type ioBuffered interface {
// -----------------------
-type intSlice []int64
-type uintSlice []uint64
-
-// type uintptrSlice []uintptr
-type floatSlice []float64
-type boolSlice []bool
-type stringSlice []string
-
-// type bytesSlice [][]byte
-
-func (p intSlice) Len() int { return len(p) }
-func (p intSlice) Less(i, j int) bool { return p[uint(i)] < p[uint(j)] }
-func (p intSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
-
-func (p uintSlice) Len() int { return len(p) }
-func (p uintSlice) Less(i, j int) bool { return p[uint(i)] < p[uint(j)] }
-func (p uintSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
-
-// func (p uintptrSlice) Len() int { return len(p) }
-// func (p uintptrSlice) Less(i, j int) bool { return p[uint(i)] < p[uint(j)] }
-// func (p uintptrSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
-
-func (p floatSlice) Len() int { return len(p) }
-func (p floatSlice) Less(i, j int) bool {
- return p[uint(i)] < p[uint(j)] || isNaN(p[uint(i)]) && !isNaN(p[uint(j)])
-}
-func (p floatSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
-
-func (p stringSlice) Len() int { return len(p) }
-func (p stringSlice) Less(i, j int) bool { return p[uint(i)] < p[uint(j)] }
-func (p stringSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
-
-// func (p bytesSlice) Len() int { return len(p) }
-// func (p bytesSlice) Less(i, j int) bool { return bytes.Compare(p[uint(i)], p[uint(j)]) == -1 }
-// func (p bytesSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
-
-func (p boolSlice) Len() int { return len(p) }
-func (p boolSlice) Less(i, j int) bool { return !p[uint(i)] && p[uint(j)] }
-func (p boolSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
-
-// ---------------------
-
type sfiRv struct {
v *structFieldInfo
r reflect.Value
}
-type intRv struct {
- v int64
- r reflect.Value
-}
-type intRvSlice []intRv
-type uintRv struct {
- v uint64
- r reflect.Value
-}
-type uintRvSlice []uintRv
-type floatRv struct {
- v float64
- r reflect.Value
-}
-type floatRvSlice []floatRv
-type boolRv struct {
- v bool
- r reflect.Value
-}
-type boolRvSlice []boolRv
-type stringRv struct {
- v string
- r reflect.Value
-}
-type stringRvSlice []stringRv
-type bytesRv struct {
- v []byte
- r reflect.Value
-}
-type bytesRvSlice []bytesRv
-type timeRv struct {
- v time.Time
- r reflect.Value
-}
-type timeRvSlice []timeRv
-
-func (p intRvSlice) Len() int { return len(p) }
-func (p intRvSlice) Less(i, j int) bool { return p[uint(i)].v < p[uint(j)].v }
-func (p intRvSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
-
-func (p uintRvSlice) Len() int { return len(p) }
-func (p uintRvSlice) Less(i, j int) bool { return p[uint(i)].v < p[uint(j)].v }
-func (p uintRvSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
-
-func (p floatRvSlice) Len() int { return len(p) }
-func (p floatRvSlice) Less(i, j int) bool {
- return p[uint(i)].v < p[uint(j)].v || isNaN(p[uint(i)].v) && !isNaN(p[uint(j)].v)
-}
-func (p floatRvSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
-
-func (p stringRvSlice) Len() int { return len(p) }
-func (p stringRvSlice) Less(i, j int) bool { return p[uint(i)].v < p[uint(j)].v }
-func (p stringRvSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
-
-func (p bytesRvSlice) Len() int { return len(p) }
-func (p bytesRvSlice) Less(i, j int) bool { return bytes.Compare(p[uint(i)].v, p[uint(j)].v) == -1 }
-func (p bytesRvSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
-
-func (p boolRvSlice) Len() int { return len(p) }
-func (p boolRvSlice) Less(i, j int) bool { return !p[uint(i)].v && p[uint(j)].v }
-func (p boolRvSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
-
-func (p timeRvSlice) Len() int { return len(p) }
-func (p timeRvSlice) Less(i, j int) bool { return p[uint(i)].v.Before(p[uint(j)].v) }
-func (p timeRvSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
-
-// -----------------
-
-type bytesI struct {
- v []byte
- i interface{}
-}
-
-type bytesISlice []bytesI
-
-func (p bytesISlice) Len() int { return len(p) }
-func (p bytesISlice) Less(i, j int) bool { return bytes.Compare(p[uint(i)].v, p[uint(j)].v) == -1 }
-func (p bytesISlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
-
// -----------------
type set []uintptr
@@ -2259,6 +2240,8 @@ type set []uintptr
func (s *set) add(v uintptr) (exists bool) {
// e.ci is always nil, or len >= 1
x := *s
+ // defer func() { xdebugf("set.add: len: %d", len(x)) }()
+
if x == nil {
x = make([]uintptr, 1, 8)
x[0] = v
@@ -2372,21 +2355,21 @@ func (x *bitset256) set(pos byte) {
type pooler struct {
// function-scoped pooled resources
tiload sync.Pool // for type info loading
- strRv8, strRv16, strRv32, strRv64, strRv128 sync.Pool // for stringRV
+ sfiRv8, sfiRv16, sfiRv32, sfiRv64, sfiRv128 sync.Pool // for struct encoding
// lifetime-scoped pooled resources
// dn sync.Pool // for decNaked
- buf1k, buf2k, buf4k, buf8k, buf16k sync.Pool // for [N]byte
+ buf1k, buf2k, buf4k, buf8k, buf16k, buf32k, buf64k sync.Pool // for [N]byte
}
func (p *pooler) init() {
p.tiload.New = func() interface{} { return new(typeInfoLoadArray) }
- p.strRv8.New = func() interface{} { return new([8]sfiRv) }
- p.strRv16.New = func() interface{} { return new([16]sfiRv) }
- p.strRv32.New = func() interface{} { return new([32]sfiRv) }
- p.strRv64.New = func() interface{} { return new([64]sfiRv) }
- p.strRv128.New = func() interface{} { return new([128]sfiRv) }
+ p.sfiRv8.New = func() interface{} { return new([8]sfiRv) }
+ p.sfiRv16.New = func() interface{} { return new([16]sfiRv) }
+ p.sfiRv32.New = func() interface{} { return new([32]sfiRv) }
+ p.sfiRv64.New = func() interface{} { return new([64]sfiRv) }
+ p.sfiRv128.New = func() interface{} { return new([128]sfiRv) }
// p.dn.New = func() interface{} { x := new(decNaked); x.init(); return x }
@@ -2395,43 +2378,52 @@ func (p *pooler) init() {
p.buf4k.New = func() interface{} { return new([4 * 1024]byte) }
p.buf8k.New = func() interface{} { return new([8 * 1024]byte) }
p.buf16k.New = func() interface{} { return new([16 * 1024]byte) }
+ p.buf32k.New = func() interface{} { return new([32 * 1024]byte) }
+ p.buf64k.New = func() interface{} { return new([64 * 1024]byte) }
}
-func (p *pooler) sfiRv8() (sp *sync.Pool, v interface{}) {
- return &p.strRv8, p.strRv8.Get()
-}
-func (p *pooler) sfiRv16() (sp *sync.Pool, v interface{}) {
- return &p.strRv16, p.strRv16.Get()
-}
-func (p *pooler) sfiRv32() (sp *sync.Pool, v interface{}) {
- return &p.strRv32, p.strRv32.Get()
-}
-func (p *pooler) sfiRv64() (sp *sync.Pool, v interface{}) {
- return &p.strRv64, p.strRv64.Get()
-}
-func (p *pooler) sfiRv128() (sp *sync.Pool, v interface{}) {
- return &p.strRv128, p.strRv128.Get()
-}
+// func (p *pooler) sfiRv8() (sp *sync.Pool, v interface{}) {
+// return &p.strRv8, p.strRv8.Get()
+// }
+// func (p *pooler) sfiRv16() (sp *sync.Pool, v interface{}) {
+// return &p.strRv16, p.strRv16.Get()
+// }
+// func (p *pooler) sfiRv32() (sp *sync.Pool, v interface{}) {
+// return &p.strRv32, p.strRv32.Get()
+// }
+// func (p *pooler) sfiRv64() (sp *sync.Pool, v interface{}) {
+// return &p.strRv64, p.strRv64.Get()
+// }
+// func (p *pooler) sfiRv128() (sp *sync.Pool, v interface{}) {
+// return &p.strRv128, p.strRv128.Get()
+// }
-func (p *pooler) bytes1k() (sp *sync.Pool, v interface{}) {
- return &p.buf1k, p.buf1k.Get()
-}
-func (p *pooler) bytes2k() (sp *sync.Pool, v interface{}) {
- return &p.buf2k, p.buf2k.Get()
-}
-func (p *pooler) bytes4k() (sp *sync.Pool, v interface{}) {
- return &p.buf4k, p.buf4k.Get()
-}
-func (p *pooler) bytes8k() (sp *sync.Pool, v interface{}) {
- return &p.buf8k, p.buf8k.Get()
-}
-func (p *pooler) bytes16k() (sp *sync.Pool, v interface{}) {
- return &p.buf16k, p.buf16k.Get()
-}
-func (p *pooler) tiLoad() (sp *sync.Pool, v interface{}) {
- return &p.tiload, p.tiload.Get()
-}
+// func (p *pooler) bytes1k() (sp *sync.Pool, v interface{}) {
+// return &p.buf1k, p.buf1k.Get()
+// }
+// func (p *pooler) bytes2k() (sp *sync.Pool, v interface{}) {
+// return &p.buf2k, p.buf2k.Get()
+// }
+// func (p *pooler) bytes4k() (sp *sync.Pool, v interface{}) {
+// return &p.buf4k, p.buf4k.Get()
+// }
+// func (p *pooler) bytes8k() (sp *sync.Pool, v interface{}) {
+// return &p.buf8k, p.buf8k.Get()
+// }
+// func (p *pooler) bytes16k() (sp *sync.Pool, v interface{}) {
+// return &p.buf16k, p.buf16k.Get()
+// }
+// func (p *pooler) bytes32k() (sp *sync.Pool, v interface{}) {
+// return &p.buf32k, p.buf32k.Get()
+// }
+// func (p *pooler) bytes64k() (sp *sync.Pool, v interface{}) {
+// return &p.buf64k, p.buf64k.Get()
+// }
+
+// func (p *pooler) tiLoad() (sp *sync.Pool, v interface{}) {
+// return &p.tiload, p.tiload.Get()
+// }
// func (p *pooler) decNaked() (sp *sync.Pool, v interface{}) {
// return &p.dn, p.dn.Get()
@@ -2534,26 +2526,110 @@ func (z *bytesBufPooler) end() {
}
func (z *bytesBufPooler) get(bufsize int) (buf []byte) {
+ // ensure an end is called first (if necessary)
+ if z.pool != nil {
+ z.pool.Put(z.poolbuf)
+ z.pool, z.poolbuf = nil, nil
+ }
+
+ // // Try to use binary search.
+ // // This is not optimal, as most folks select 1k or 2k buffers
+ // // so a linear search is better (sequence of if/else blocks)
+ // if bufsize < 1 {
+ // bufsize = 0
+ // } else {
+ // bufsize--
+ // bufsize /= 1024
+ // }
+ // switch bufsize {
+ // case 0:
+ // z.pool, z.poolbuf = pool.bytes1k()
+ // buf = z.poolbuf.(*[1 * 1024]byte)[:]
+ // case 1:
+ // z.pool, z.poolbuf = pool.bytes2k()
+ // buf = z.poolbuf.(*[2 * 1024]byte)[:]
+ // case 2, 3:
+ // z.pool, z.poolbuf = pool.bytes4k()
+ // buf = z.poolbuf.(*[4 * 1024]byte)[:]
+ // case 4, 5, 6, 7:
+ // z.pool, z.poolbuf = pool.bytes8k()
+ // buf = z.poolbuf.(*[8 * 1024]byte)[:]
+ // case 8, 9, 10, 11, 12, 13, 14, 15:
+ // z.pool, z.poolbuf = pool.bytes16k()
+ // buf = z.poolbuf.(*[16 * 1024]byte)[:]
+ // case 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31:
+ // z.pool, z.poolbuf = pool.bytes32k()
+ // buf = z.poolbuf.(*[32 * 1024]byte)[:]
+ // default:
+ // z.pool, z.poolbuf = pool.bytes64k()
+ // buf = z.poolbuf.(*[64 * 1024]byte)[:]
+ // }
+ // return
+
if bufsize <= 1*1024 {
- z.pool, z.poolbuf = pool.bytes1k()
+ z.pool, z.poolbuf = &pool.buf1k, pool.buf1k.Get() // pool.bytes1k()
buf = z.poolbuf.(*[1 * 1024]byte)[:]
} else if bufsize <= 2*1024 {
- z.pool, z.poolbuf = pool.bytes2k()
+ z.pool, z.poolbuf = &pool.buf2k, pool.buf2k.Get() // pool.bytes2k()
buf = z.poolbuf.(*[2 * 1024]byte)[:]
} else if bufsize <= 4*1024 {
- z.pool, z.poolbuf = pool.bytes4k()
+ z.pool, z.poolbuf = &pool.buf4k, pool.buf4k.Get() // pool.bytes4k()
buf = z.poolbuf.(*[4 * 1024]byte)[:]
} else if bufsize <= 8*1024 {
- z.pool, z.poolbuf = pool.bytes8k()
+ z.pool, z.poolbuf = &pool.buf8k, pool.buf8k.Get() // pool.bytes8k()
buf = z.poolbuf.(*[8 * 1024]byte)[:]
- } else {
- z.pool, z.poolbuf = pool.bytes16k()
+ } else if bufsize <= 16*1024 {
+ z.pool, z.poolbuf = &pool.buf16k, pool.buf16k.Get() // pool.bytes16k()
buf = z.poolbuf.(*[16 * 1024]byte)[:]
+ } else if bufsize <= 32*1024 {
+ z.pool, z.poolbuf = &pool.buf32k, pool.buf32k.Get() // pool.bytes32k()
+ buf = z.poolbuf.(*[32 * 1024]byte)[:]
+ } else {
+ z.pool, z.poolbuf = &pool.buf64k, pool.buf64k.Get() // pool.bytes64k()
+ buf = z.poolbuf.(*[64 * 1024]byte)[:]
}
return
}
-// xdebugf prints the message in red on the terminal.
+// ----------------
+
+type sfiRvPooler struct {
+ pool *sync.Pool
+ poolv interface{}
+}
+
+func (z *sfiRvPooler) end() {
+ if z.pool != nil {
+ z.pool.Put(z.poolv)
+ z.pool, z.poolv = nil, nil
+ }
+}
+
+func (z *sfiRvPooler) get(newlen int) (fkvs []sfiRv) {
+ if newlen < 0 { // bounds-check-elimination
+ // cannot happen // here for bounds-check-elimination
+ } else if newlen <= 8 {
+ z.pool, z.poolv = &pool.sfiRv8, pool.sfiRv8.Get() // pool.sfiRv8()
+ fkvs = z.poolv.(*[8]sfiRv)[:newlen]
+ } else if newlen <= 16 {
+ z.pool, z.poolv = &pool.sfiRv16, pool.sfiRv16.Get() // pool.sfiRv16()
+ fkvs = z.poolv.(*[16]sfiRv)[:newlen]
+ } else if newlen <= 32 {
+ z.pool, z.poolv = &pool.sfiRv32, pool.sfiRv32.Get() // pool.sfiRv32()
+ fkvs = z.poolv.(*[32]sfiRv)[:newlen]
+ } else if newlen <= 64 {
+ z.pool, z.poolv = &pool.sfiRv64, pool.sfiRv64.Get() // pool.sfiRv64()
+ fkvs = z.poolv.(*[64]sfiRv)[:newlen]
+ } else if newlen <= 128 {
+ z.pool, z.poolv = &pool.sfiRv128, pool.sfiRv128.Get() // pool.sfiRv128()
+ fkvs = z.poolv.(*[128]sfiRv)[:newlen]
+ } else {
+ fkvs = make([]sfiRv, newlen)
+ }
+ return
+}
+
+// xdebugf printf. the message in red on the terminal.
// Use it in place of fmt.Printf (which it calls internally)
func xdebugf(pattern string, args ...interface{}) {
var delim string
@@ -2563,6 +2639,16 @@ func xdebugf(pattern string, args ...interface{}) {
fmt.Printf("\033[1;31m"+pattern+delim+"\033[0m", args...)
}
+// xdebug2f printf. the message in blue on the terminal.
+// Use it in place of fmt.Printf (which it calls internally)
+func xdebug2f(pattern string, args ...interface{}) {
+ var delim string
+ if len(pattern) > 0 && pattern[len(pattern)-1] != '\n' {
+ delim = "\n"
+ }
+ fmt.Printf("\033[1;34m"+pattern+delim+"\033[0m", args...)
+}
+
// func isImmutableKind(k reflect.Kind) (v bool) {
// return false ||
// k == reflect.Int ||
@@ -2587,7 +2673,7 @@ func xdebugf(pattern string, args ...interface{}) {
// return "UTC"
// }
// var tzname = []byte("UTC+00:00")
-// //tzname := fmt.Sprintf("UTC%s%02d:%02d", tzsign, tz/60, tz%60) //perf issue using Sprintf. inline below.
+// //tzname := fmt.Sprintf("UTC%s%02d:%02d", tzsign, tz/60, tz%60) //perf issue using Sprintf.. inline below.
// //tzhr, tzmin := tz/60, tz%60 //faster if u convert to int first
// var tzhr, tzmin int16
// if tzint < 0 {
diff --git a/vendor/github.com/ugorji/go/codec/helper_not_unsafe.go b/vendor/github.com/ugorji/go/codec/helper_not_unsafe.go
index eef58636..886eaa34 100644
--- a/vendor/github.com/ugorji/go/codec/helper_not_unsafe.go
+++ b/vendor/github.com/ugorji/go/codec/helper_not_unsafe.go
@@ -182,11 +182,7 @@ func (d *Decoder) kTime(f *codecFnInfo, rv reflect.Value) {
}
func (d *Decoder) kFloat32(f *codecFnInfo, rv reflect.Value) {
- fv := d.d.DecodeFloat64()
- if chkOvf.Float32(fv) {
- d.errorf("float32 overflow: %v", fv)
- }
- rv.SetFloat(fv)
+ rv.SetFloat(d.decodeFloat32())
}
func (d *Decoder) kFloat64(f *codecFnInfo, rv reflect.Value) {
@@ -248,7 +244,12 @@ func (e *Encoder) kTime(f *codecFnInfo, rv reflect.Value) {
}
func (e *Encoder) kString(f *codecFnInfo, rv reflect.Value) {
- e.e.EncodeStringEnc(cUTF8, rv.String())
+ s := rv.String()
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(s))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, s)
+ }
}
func (e *Encoder) kFloat64(f *codecFnInfo, rv reflect.Value) {
diff --git a/vendor/github.com/ugorji/go/codec/helper_unsafe.go b/vendor/github.com/ugorji/go/codec/helper_unsafe.go
index 51de2d68..3f2d71e9 100644
--- a/vendor/github.com/ugorji/go/codec/helper_unsafe.go
+++ b/vendor/github.com/ugorji/go/codec/helper_unsafe.go
@@ -186,7 +186,7 @@ func isEmptyValue(v reflect.Value, tinfos *TypeInfos, deref, checkStruct bool) b
// ----------------------
type atomicTypeInfoSlice struct {
v unsafe.Pointer // *[]rtid2ti
- _ uintptr // padding (atomicXXX expected to be 2 words)
+ _ uint64 // padding (atomicXXX expected to be 2 words)
}
func (x *atomicTypeInfoSlice) load() (s []rtid2ti) {
@@ -204,7 +204,7 @@ func (x *atomicTypeInfoSlice) store(p []rtid2ti) {
// --------------------------
type atomicRtidFnSlice struct {
v unsafe.Pointer // *[]codecRtidFn
- _ uintptr // padding (atomicXXX expected to be 2 words)
+ // _ uint64 // padding (atomicXXX expected to be 2 words) (make 1 word so JsonHandle fits)
}
func (x *atomicRtidFnSlice) load() (s []codecRtidFn) {
@@ -222,7 +222,7 @@ func (x *atomicRtidFnSlice) store(p []codecRtidFn) {
// --------------------------
type atomicClsErr struct {
v unsafe.Pointer // *clsErr
- _ uintptr // padding (atomicXXX expected to be 2 words)
+ _ uint64 // padding (atomicXXX expected to be 2 words)
}
func (x *atomicClsErr) load() (e clsErr) {
@@ -326,12 +326,8 @@ func (d *Decoder) kTime(f *codecFnInfo, rv reflect.Value) {
}
func (d *Decoder) kFloat32(f *codecFnInfo, rv reflect.Value) {
- fv := d.d.DecodeFloat64()
- if chkOvf.Float32(fv) {
- d.errorf("float32 overflow: %v", fv)
- }
urv := (*unsafeReflectValue)(unsafe.Pointer(&rv))
- *(*float32)(urv.ptr) = float32(fv)
+ *(*float32)(urv.ptr) = float32(d.decodeFloat32())
}
func (d *Decoder) kFloat64(f *codecFnInfo, rv reflect.Value) {
@@ -408,7 +404,12 @@ func (e *Encoder) kTime(f *codecFnInfo, rv reflect.Value) {
func (e *Encoder) kString(f *codecFnInfo, rv reflect.Value) {
v := (*unsafeReflectValue)(unsafe.Pointer(&rv))
- e.e.EncodeStringEnc(cUTF8, *(*string)(v.ptr))
+ s := *(*string)(v.ptr)
+ if e.h.StringToRaw {
+ e.e.EncodeStringBytesRaw(bytesView(s))
+ } else {
+ e.e.EncodeStringEnc(cUTF8, s)
+ }
}
func (e *Encoder) kFloat64(f *codecFnInfo, rv reflect.Value) {
diff --git a/vendor/github.com/ugorji/go/codec/json.go b/vendor/github.com/ugorji/go/codec/json.go
index 619bc5b5..7592b6e0 100644
--- a/vendor/github.com/ugorji/go/codec/json.go
+++ b/vendor/github.com/ugorji/go/codec/json.go
@@ -61,7 +61,7 @@ const (
jsonU4Chk1 = 'a' - 10
jsonU4Chk0 = 'A' - 10
- jsonScratchArrayLen = 64
+ jsonScratchArrayLen = cacheLineSize // 64
)
const (
@@ -121,58 +121,39 @@ func init() {
// ----------------
type jsonEncDriverTypical struct {
- w *encWriterSwitch
- b *[jsonScratchArrayLen]byte
- tw bool // term white space
- c containerState
-}
-
-func (e *jsonEncDriverTypical) typical() {}
-
-func (e *jsonEncDriverTypical) reset(ee *jsonEncDriver) {
- e.w = ee.ew
- e.b = &ee.b
- e.tw = ee.h.TermWhitespace
- e.c = 0
+ jsonEncDriver
}
func (e *jsonEncDriverTypical) WriteArrayStart(length int) {
e.w.writen1('[')
- e.c = containerArrayStart
}
func (e *jsonEncDriverTypical) WriteArrayElem() {
- if e.c != containerArrayStart {
+ if e.e.c != containerArrayStart {
e.w.writen1(',')
}
- e.c = containerArrayElem
}
func (e *jsonEncDriverTypical) WriteArrayEnd() {
e.w.writen1(']')
- e.c = containerArrayEnd
}
func (e *jsonEncDriverTypical) WriteMapStart(length int) {
e.w.writen1('{')
- e.c = containerMapStart
}
func (e *jsonEncDriverTypical) WriteMapElemKey() {
- if e.c != containerMapStart {
+ if e.e.c != containerMapStart {
e.w.writen1(',')
}
- e.c = containerMapKey
}
func (e *jsonEncDriverTypical) WriteMapElemValue() {
e.w.writen1(':')
- e.c = containerMapValue
}
func (e *jsonEncDriverTypical) WriteMapEnd() {
e.w.writen1('}')
- e.c = containerMapEnd
}
func (e *jsonEncDriverTypical) EncodeBool(b bool) {
@@ -183,11 +164,6 @@ func (e *jsonEncDriverTypical) EncodeBool(b bool) {
}
}
-func (e *jsonEncDriverTypical) EncodeFloat64(f float64) {
- fmt, prec := jsonFloatStrconvFmtPrec(f)
- e.w.writeb(strconv.AppendFloat(e.b[:0], f, fmt, prec, 64))
-}
-
func (e *jsonEncDriverTypical) EncodeInt(v int64) {
e.w.writeb(strconv.AppendInt(e.b[:0], v, 10))
}
@@ -196,31 +172,32 @@ func (e *jsonEncDriverTypical) EncodeUint(v uint64) {
e.w.writeb(strconv.AppendUint(e.b[:0], v, 10))
}
-func (e *jsonEncDriverTypical) EncodeFloat32(f float32) {
- e.EncodeFloat64(float64(f))
+func (e *jsonEncDriverTypical) EncodeFloat64(f float64) {
+ fmt, prec := jsonFloatStrconvFmtPrec64(f)
+ e.w.writeb(strconv.AppendFloat(e.b[:0], f, fmt, int(prec), 64))
+ // e.w.writeb(strconv.AppendFloat(e.b[:0], f, jsonFloatStrconvFmtPrec64(f), 64))
}
-func (e *jsonEncDriverTypical) atEndOfEncode() {
- if e.tw {
- e.w.writen1(' ')
- }
+func (e *jsonEncDriverTypical) EncodeFloat32(f float32) {
+ fmt, prec := jsonFloatStrconvFmtPrec32(f)
+ e.w.writeb(strconv.AppendFloat(e.b[:0], float64(f), fmt, int(prec), 32))
}
+// func (e *jsonEncDriverTypical) encodeFloat(f float64, bitsize uint8) {
+// fmt, prec := jsonFloatStrconvFmtPrec(f, bitsize == 32)
+// e.w.writeb(strconv.AppendFloat(e.b[:0], f, fmt, prec, int(bitsize)))
+// }
+
+// func (e *jsonEncDriverTypical) atEndOfEncode() {
+// if e.tw {
+// e.w.writen1(' ')
+// }
+// }
+
// ----------------
type jsonEncDriverGeneric struct {
- w *encWriterSwitch
- b *[jsonScratchArrayLen]byte
- c containerState
- // ds string // indent string
- di int8 // indent per
- d bool // indenting?
- dt bool // indent using tabs
- dl uint16 // indent level
- ks bool // map key as string
- is byte // integer as string
- tw bool // term white space
- _ [7]byte // padding
+ jsonEncDriver
}
// indent is done as below:
@@ -228,23 +205,23 @@ type jsonEncDriverGeneric struct {
// - newline and indent are added before each ending,
// except there was no entry (so we can have {} or [])
-func (e *jsonEncDriverGeneric) reset(ee *jsonEncDriver) {
- e.w = ee.ew
- e.b = &ee.b
- e.tw = ee.h.TermWhitespace
- e.c = 0
- e.d, e.dt, e.dl, e.di = false, false, 0, 0
- h := ee.h
- if h.Indent > 0 {
- e.d = true
- e.di = int8(h.Indent)
- } else if h.Indent < 0 {
+func (e *jsonEncDriverGeneric) reset() {
+ e.jsonEncDriver.reset()
+ e.d, e.dl, e.di = false, 0, 0
+ if e.h.Indent != 0 {
e.d = true
- e.dt = true
- e.di = int8(-h.Indent)
- }
- e.ks = h.MapKeyAsString
- e.is = h.IntegerAsString
+ e.di = int8(e.h.Indent)
+ }
+ // if e.h.Indent > 0 {
+ // e.d = true
+ // e.di = int8(e.h.Indent)
+ // } else if e.h.Indent < 0 {
+ // e.d = true
+ // // e.dt = true
+ // e.di = int8(-e.h.Indent)
+ // }
+ e.ks = e.h.MapKeyAsString
+ e.is = e.h.IntegerAsString
}
func (e *jsonEncDriverGeneric) WriteArrayStart(length int) {
@@ -252,28 +229,14 @@ func (e *jsonEncDriverGeneric) WriteArrayStart(length int) {
e.dl++
}
e.w.writen1('[')
- e.c = containerArrayStart
-}
-
-func (e *jsonEncDriverGeneric) WriteArrayElem() {
- if e.c != containerArrayStart {
- e.w.writen1(',')
- }
- if e.d {
- e.writeIndent()
- }
- e.c = containerArrayElem
}
func (e *jsonEncDriverGeneric) WriteArrayEnd() {
if e.d {
e.dl--
- if e.c != containerArrayStart {
- e.writeIndent()
- }
+ e.writeIndent()
}
e.w.writen1(']')
- e.c = containerArrayEnd
}
func (e *jsonEncDriverGeneric) WriteMapStart(length int) {
@@ -281,59 +244,20 @@ func (e *jsonEncDriverGeneric) WriteMapStart(length int) {
e.dl++
}
e.w.writen1('{')
- e.c = containerMapStart
-}
-
-func (e *jsonEncDriverGeneric) WriteMapElemKey() {
- if e.c != containerMapStart {
- e.w.writen1(',')
- }
- if e.d {
- e.writeIndent()
- }
- e.c = containerMapKey
-}
-
-func (e *jsonEncDriverGeneric) WriteMapElemValue() {
- if e.d {
- e.w.writen2(':', ' ')
- } else {
- e.w.writen1(':')
- }
- e.c = containerMapValue
}
func (e *jsonEncDriverGeneric) WriteMapEnd() {
if e.d {
e.dl--
- if e.c != containerMapStart {
+ if e.e.c != containerMapStart {
e.writeIndent()
}
}
e.w.writen1('}')
- e.c = containerMapEnd
-}
-
-func (e *jsonEncDriverGeneric) writeIndent() {
- e.w.writen1('\n')
- x := int(e.di) * int(e.dl)
- if e.dt {
- for x > jsonSpacesOrTabsLen {
- e.w.writeb(jsonTabs[:])
- x -= jsonSpacesOrTabsLen
- }
- e.w.writeb(jsonTabs[:x])
- } else {
- for x > jsonSpacesOrTabsLen {
- e.w.writeb(jsonSpaces[:])
- x -= jsonSpacesOrTabsLen
- }
- e.w.writeb(jsonSpaces[:x])
- }
}
func (e *jsonEncDriverGeneric) EncodeBool(b bool) {
- if e.ks && e.c == containerMapKey {
+ if e.ks && e.e.c == containerMapKey {
if b {
e.w.writeb(jsonLiterals[jsonLitTrueQ : jsonLitTrueQ+6])
} else {
@@ -348,24 +272,31 @@ func (e *jsonEncDriverGeneric) EncodeBool(b bool) {
}
}
-func (e *jsonEncDriverGeneric) EncodeFloat64(f float64) {
- // instead of using 'g', specify whether to use 'e' or 'f'
- fmt, prec := jsonFloatStrconvFmtPrec(f)
-
+func (e *jsonEncDriverGeneric) encodeFloat(f float64, bitsize, fmt byte, prec int8) {
var blen int
- if e.ks && e.c == containerMapKey {
- blen = 2 + len(strconv.AppendFloat(e.b[1:1], f, fmt, prec, 64))
+ if e.ks && e.e.c == containerMapKey {
+ blen = 2 + len(strconv.AppendFloat(e.b[1:1], f, fmt, int(prec), int(bitsize)))
e.b[0] = '"'
e.b[blen-1] = '"'
} else {
- blen = len(strconv.AppendFloat(e.b[:0], f, fmt, prec, 64))
+ blen = len(strconv.AppendFloat(e.b[:0], f, fmt, int(prec), int(bitsize)))
}
e.w.writeb(e.b[:blen])
}
+func (e *jsonEncDriverGeneric) EncodeFloat64(f float64) {
+ fmt, prec := jsonFloatStrconvFmtPrec64(f)
+ e.encodeFloat(f, 64, fmt, prec)
+}
+
+func (e *jsonEncDriverGeneric) EncodeFloat32(f float32) {
+ fmt, prec := jsonFloatStrconvFmtPrec32(f)
+ e.encodeFloat(float64(f), 32, fmt, prec)
+}
+
func (e *jsonEncDriverGeneric) EncodeInt(v int64) {
x := e.is
- if x == 'A' || x == 'L' && (v > 1<<53 || v < -(1<<53)) || (e.ks && e.c == containerMapKey) {
+ if x == 'A' || x == 'L' && (v > 1<<53 || v < -(1<<53)) || (e.ks && e.e.c == containerMapKey) {
blen := 2 + len(strconv.AppendInt(e.b[1:1], v, 10))
e.b[0] = '"'
e.b[blen-1] = '"'
@@ -377,7 +308,7 @@ func (e *jsonEncDriverGeneric) EncodeInt(v int64) {
func (e *jsonEncDriverGeneric) EncodeUint(v uint64) {
x := e.is
- if x == 'A' || x == 'L' && v > 1<<53 || (e.ks && e.c == containerMapKey) {
+ if x == 'A' || x == 'L' && v > 1<<53 || (e.ks && e.e.c == containerMapKey) {
blen := 2 + len(strconv.AppendUint(e.b[1:1], v, 10))
e.b[0] = '"'
e.b[blen-1] = '"'
@@ -387,49 +318,110 @@ func (e *jsonEncDriverGeneric) EncodeUint(v uint64) {
e.w.writeb(strconv.AppendUint(e.b[:0], v, 10))
}
-func (e *jsonEncDriverGeneric) EncodeFloat32(f float32) {
- // e.encodeFloat(float64(f), 32)
- // always encode all floats as IEEE 64-bit floating point.
- // It also ensures that we can decode in full precision even if into a float32,
- // as what is written is always to float64 precision.
- e.EncodeFloat64(float64(f))
-}
+// func (e *jsonEncDriverGeneric) EncodeFloat32(f float32) {
+// // e.encodeFloat(float64(f), 32)
+// // always encode all floats as IEEE 64-bit floating point.
+// // It also ensures that we can decode in full precision even if into a float32,
+// // as what is written is always to float64 precision.
+// e.EncodeFloat64(float64(f))
+// }
-func (e *jsonEncDriverGeneric) atEndOfEncode() {
- if e.tw {
- if e.d {
- e.w.writen1('\n')
- } else {
- e.w.writen1(' ')
- }
- }
-}
+// func (e *jsonEncDriverGeneric) atEndOfEncode() {
+// if e.tw {
+// if e.d {
+// e.w.writen1('\n')
+// } else {
+// e.w.writen1(' ')
+// }
+// }
+// }
// --------------------
type jsonEncDriver struct {
noBuiltInTypes
- e *Encoder
- h *JsonHandle
- ew *encWriterSwitch
- se extWrapper
- // ---- cpu cache line boundary?
- bs []byte // scratch
+ w *encWriterSwitch
+ e *Encoder
+ h *JsonHandle
+
+ bs []byte // for encoding strings
+ se interfaceExtWrapper
+
// ---- cpu cache line boundary?
- b [jsonScratchArrayLen]byte // scratch (encode time,
- _ [2]uint64 // padding
+ // ds string // indent string
+ di int8 // indent per: if negative, use tabs
+ d bool // indenting?
+ // dt bool // indent using tabs
+ dl uint16 // indent level
+ ks bool // map key as string
+ is byte // integer as string
+
+ s *bitset256 // safe set for characters (taking h.HTMLAsIs into consideration)
+ // scratch: encode time, numbers, etc. Note: leave 1 byte for containerState
+ b [jsonScratchArrayLen - 16]byte // leave space for bs(len,cap), containerState
+}
+
+// Keep writeIndent, WriteArrayElem, WriteMapElemKey, WriteMapElemValue
+// in jsonEncDriver, so that *Encoder can directly call them
+
+func (e *jsonEncDriver) getJsonEncDriver() *jsonEncDriver { return e }
+
+func (e *jsonEncDriver) writeIndent() {
+ e.w.writen1('\n')
+ x := int(e.di) * int(e.dl)
+ if e.di < 0 {
+ x = -x
+ for x > jsonSpacesOrTabsLen {
+ e.w.writeb(jsonTabs[:])
+ x -= jsonSpacesOrTabsLen
+ }
+ e.w.writeb(jsonTabs[:x])
+ } else {
+ for x > jsonSpacesOrTabsLen {
+ e.w.writeb(jsonSpaces[:])
+ x -= jsonSpacesOrTabsLen
+ }
+ e.w.writeb(jsonSpaces[:x])
+ }
+}
+
+func (e *jsonEncDriver) WriteArrayElem() {
+ // xdebugf("WriteArrayElem: e.e.c: %d", e.e.c)
+ if e.e.c != containerArrayStart {
+ e.w.writen1(',')
+ }
+ if e.d {
+ e.writeIndent()
+ }
+}
+
+func (e *jsonEncDriver) WriteMapElemKey() {
+ if e.e.c != containerMapStart {
+ e.w.writen1(',')
+ }
+ if e.d {
+ e.writeIndent()
+ }
+}
+
+func (e *jsonEncDriver) WriteMapElemValue() {
+ if e.d {
+ e.w.writen2(':', ' ')
+ } else {
+ e.w.writen1(':')
+ }
}
func (e *jsonEncDriver) EncodeNil() {
// We always encode nil as just null (never in quotes)
// This allows us to easily decode if a nil in the json stream
// ie if initial token is n.
- e.ew.writeb(jsonLiterals[jsonLitNull : jsonLitNull+4])
+ e.w.writeb(jsonLiterals[jsonLitNull : jsonLitNull+4])
- // if e.h.MapKeyAsString && e.c == containerMapKey {
- // e.ew.writeb(jsonLiterals[jsonLitNullQ : jsonLitNullQ+6])
+ // if e.h.MapKeyAsString && e.e.c == containerMapKey {
+ // e.w.writeb(jsonLiterals[jsonLitNullQ : jsonLitNullQ+6])
// } else {
- // e.ew.writeb(jsonLiterals[jsonLitNull : jsonLitNull+4])
+ // e.w.writeb(jsonLiterals[jsonLitNull : jsonLitNull+4])
// }
}
@@ -442,9 +434,9 @@ func (e *jsonEncDriver) EncodeTime(t time.Time) {
e.b[0] = '"'
b := t.AppendFormat(e.b[1:1], time.RFC3339Nano)
e.b[len(b)+1] = '"'
- e.ew.writeb(e.b[:len(b)+2])
+ e.w.writeb(e.b[:len(b)+2])
}
- // v, err := t.MarshalJSON(); if err != nil { e.e.error(err) } e.ew.writeb(v)
+ // v, err := t.MarshalJSON(); if err != nil { e.e.error(err) } e.w.writeb(v)
}
func (e *jsonEncDriver) EncodeExt(rv interface{}, xtag uint64, ext Ext, en *Encoder) {
@@ -464,41 +456,10 @@ func (e *jsonEncDriver) EncodeRawExt(re *RawExt, en *Encoder) {
}
}
-func (e *jsonEncDriver) EncodeString(c charEncoding, v string) {
- e.quoteStr(v)
-}
-
func (e *jsonEncDriver) EncodeStringEnc(c charEncoding, v string) {
e.quoteStr(v)
}
-func (e *jsonEncDriver) EncodeStringBytes(c charEncoding, v []byte) {
- // if encoding raw bytes and RawBytesExt is configured, use it to encode
- if v == nil {
- e.EncodeNil()
- return
- }
- if c == cRAW {
- if e.se.InterfaceExt != nil {
- e.EncodeExt(v, 0, &e.se, e.e)
- return
- }
-
- slen := base64.StdEncoding.EncodedLen(len(v)) + 2
- if cap(e.bs) >= slen {
- e.bs = e.bs[:slen]
- } else {
- e.bs = make([]byte, slen)
- }
- e.bs[0] = '"'
- base64.StdEncoding.Encode(e.bs[1:], v)
- e.bs[slen-1] = '"'
- e.ew.writeb(e.bs)
- } else {
- e.quoteStr(stringView(v))
- }
-}
-
func (e *jsonEncDriver) EncodeStringBytesRaw(v []byte) {
// if encoding raw bytes and RawBytesExt is configured, use it to encode
if v == nil {
@@ -519,30 +480,33 @@ func (e *jsonEncDriver) EncodeStringBytesRaw(v []byte) {
e.bs[0] = '"'
base64.StdEncoding.Encode(e.bs[1:], v)
e.bs[slen-1] = '"'
- e.ew.writeb(e.bs)
+ e.w.writeb(e.bs)
}
func (e *jsonEncDriver) EncodeAsis(v []byte) {
- e.ew.writeb(v)
+ e.w.writeb(v)
}
func (e *jsonEncDriver) quoteStr(s string) {
// adapted from std pkg encoding/json
const hex = "0123456789abcdef"
- w := e.ew
- htmlasis := e.h.HTMLCharsAsIs
+ w := e.w
w.writen1('"')
var start int
- for i, slen := 0, len(s); i < slen; {
+ for i := 0; i < len(s); {
// encode all bytes < 0x20 (except \r, \n).
// also encode < > & to prevent security holes when served to some browsers.
+
+ // We optimize for ascii, by assumining that most characters are in the BMP
+ // and natively consumed by json without much computation.
+
+ // if 0x20 <= b && b != '\\' && b != '"' && b != '<' && b != '>' && b != '&' {
+ // if (htmlasis && jsonCharSafeSet.isset(b)) || jsonCharHtmlSafeSet.isset(b) {
+ if e.s.isset(s[i]) {
+ i++
+ continue
+ }
if b := s[i]; b < utf8.RuneSelf {
- // if 0x20 <= b && b != '\\' && b != '"' && b != '<' && b != '>' && b != '&' {
- // if (htmlasis && jsonCharSafeSet.isset(b)) || jsonCharHtmlSafeSet.isset(b) {
- if jsonCharHtmlSafeSet.isset(b) || (htmlasis && jsonCharSafeSet.isset(b)) {
- i++
- continue
- }
if start < i {
w.writestr(s[start:i])
}
@@ -568,13 +532,15 @@ func (e *jsonEncDriver) quoteStr(s string) {
continue
}
c, size := utf8.DecodeRuneInString(s[i:])
- if c == utf8.RuneError && size == 1 {
- if start < i {
- w.writestr(s[start:i])
+ if c == utf8.RuneError {
+ if size == 1 {
+ if start < i {
+ w.writestr(s[start:i])
+ }
+ w.writestr(`\ufffd`)
+ i++
+ start = i
}
- w.writestr(`\ufffd`)
- i += size
- start = i
continue
}
// U+2028 is LINE SEPARATOR. U+2029 is PARAGRAPH SEPARATOR.
@@ -597,24 +563,41 @@ func (e *jsonEncDriver) quoteStr(s string) {
w.writen1('"')
}
+func (e *jsonEncDriver) atEndOfEncode() {
+ // if e.e.c == 0 { // scalar written, output space
+ // e.w.writen1(' ')
+ // } else if e.h.TermWhitespace { // container written, output new-line
+ // e.w.writen1('\n')
+ // }
+ if e.h.TermWhitespace {
+ if e.e.c == 0 { // scalar written, output space
+ e.w.writen1(' ')
+ } else { // container written, output new-line
+ e.w.writen1('\n')
+ }
+ }
+
+}
+
type jsonDecDriver struct {
noBuiltInTypes
d *Decoder
h *JsonHandle
r *decReaderSwitch
- se extWrapper
+ se interfaceExtWrapper
+ bs []byte // scratch, initialized from b. For parsing strings or numbers.
// ---- writable fields during execution --- *try* to keep in sep cache line
- c containerState
- // tok is used to store the token read right after skipWhiteSpace.
- tok uint8
- fnull bool // found null from appendStringAsBytes
- bs []byte // scratch. Initialized from b. Used for parsing strings or numbers.
- bstr [8]byte // scratch used for string \UXXX parsing
// ---- cpu cache line boundary?
- b [jsonScratchArrayLen]byte // scratch 1, used for parsing strings or numbers or time.Time
- b2 [jsonScratchArrayLen]byte // scratch 2, used only for readUntil, decNumBytes
+ b [jsonScratchArrayLen]byte // scratch 1, used for parsing strings or numbers or time.Time
+ // ---- cpu cache line boundary?
+ // c containerState
+ tok uint8 // used to store the token read right after skipWhiteSpace
+ fnull bool // found null from appendStringAsBytes
+ _ [2]byte // padding
+ bstr [4]byte // scratch used for string \UXXX parsing
+ b2 [jsonScratchArrayLen - 8]byte // scratch 2, used only for readUntil, decNumBytes
// _ [3]uint64 // padding
// n jsonNum
@@ -641,7 +624,6 @@ func (d *jsonDecDriver) ReadMapStart() int {
d.d.errorf("read map - expect char '%c' but got char '%c'", xc, d.tok)
}
d.tok = 0
- d.c = containerMapStart
return -1
}
@@ -654,7 +636,6 @@ func (d *jsonDecDriver) ReadArrayStart() int {
d.d.errorf("read array - expect char '%c' but got char '%c'", xc, d.tok)
}
d.tok = 0
- d.c = containerArrayStart
return -1
}
@@ -668,7 +649,7 @@ func (d *jsonDecDriver) CheckBreak() bool {
// For the ReadXXX methods below, we could just delegate to helper functions
// readContainerState(c containerState, xc uint8, check bool)
// - ReadArrayElem would become:
-// readContainerState(containerArrayElem, ',', d.c != containerArrayStart)
+// readContainerState(containerArrayElem, ',', d.d.c != containerArrayStart)
//
// However, until mid-stack inlining comes in go1.11 which supports inlining of
// one-liners, we explicitly write them all 5 out to elide the extra func call.
@@ -680,13 +661,13 @@ func (d *jsonDecDriver) ReadArrayElem() {
if d.tok == 0 {
d.tok = d.r.skip(&jsonCharWhitespaceSet)
}
- if d.c != containerArrayStart {
+ // xdebugf("ReadArrayElem: d.d.c: %d, token: %c", d.d.c, d.tok)
+ if d.d.c != containerArrayStart {
if d.tok != xc {
d.d.errorf("read array element - expect char '%c' but got char '%c'", xc, d.tok)
}
d.tok = 0
}
- d.c = containerArrayElem
}
func (d *jsonDecDriver) ReadArrayEnd() {
@@ -698,7 +679,6 @@ func (d *jsonDecDriver) ReadArrayEnd() {
d.d.errorf("read array end - expect char '%c' but got char '%c'", xc, d.tok)
}
d.tok = 0
- d.c = containerArrayEnd
}
func (d *jsonDecDriver) ReadMapElemKey() {
@@ -706,13 +686,12 @@ func (d *jsonDecDriver) ReadMapElemKey() {
if d.tok == 0 {
d.tok = d.r.skip(&jsonCharWhitespaceSet)
}
- if d.c != containerMapStart {
+ if d.d.c != containerMapStart {
if d.tok != xc {
d.d.errorf("read map key - expect char '%c' but got char '%c'", xc, d.tok)
}
d.tok = 0
}
- d.c = containerMapKey
}
func (d *jsonDecDriver) ReadMapElemValue() {
@@ -724,7 +703,6 @@ func (d *jsonDecDriver) ReadMapElemValue() {
d.d.errorf("read map value - expect char '%c' but got char '%c'", xc, d.tok)
}
d.tok = 0
- d.c = containerMapValue
}
func (d *jsonDecDriver) ReadMapEnd() {
@@ -736,7 +714,6 @@ func (d *jsonDecDriver) ReadMapEnd() {
d.d.errorf("read map end - expect char '%c' but got char '%c'", xc, d.tok)
}
d.tok = 0
- d.c = containerMapEnd
}
// func (d *jsonDecDriver) readLit(length, fromIdx uint8) {
@@ -789,7 +766,7 @@ func (d *jsonDecDriver) DecodeBool() (v bool) {
if d.tok == 0 {
d.tok = d.r.skip(&jsonCharWhitespaceSet)
}
- fquot := d.c == containerMapKey && d.tok == '"'
+ fquot := d.d.c == containerMapKey && d.tok == '"'
if fquot {
d.tok = d.r.readn1()
}
@@ -929,18 +906,26 @@ func (d *jsonDecDriver) decUint64ViaFloat(s string) (u uint64) {
return uint64(fi)
}
-func (d *jsonDecDriver) DecodeFloat64() (f float64) {
+func (d *jsonDecDriver) decodeFloat(bitsize int) (f float64) {
bs := d.decNumBytes()
if len(bs) == 0 {
return
}
- f, err := strconv.ParseFloat(stringView(bs), 64)
+ f, err := strconv.ParseFloat(stringView(bs), bitsize)
if err != nil {
d.d.errorv(err)
}
return
}
+func (d *jsonDecDriver) DecodeFloat64() (f float64) {
+ return d.decodeFloat(64)
+}
+
+func (d *jsonDecDriver) DecodeFloat32() (f float64) {
+ return d.decodeFloat(32)
+}
+
func (d *jsonDecDriver) DecodeExt(rv interface{}, xtag uint64, ext Ext) (realxtag uint64) {
if ext == nil {
re := rv.(*RawExt)
@@ -1204,7 +1189,7 @@ F:
func (d *jsonDecDriver) bsToString() string {
// if x := d.s.sc; x != nil && x.so && x.st == '}' { // map key
- if jsonAlwaysReturnInternString || d.c == containerMapKey {
+ if jsonAlwaysReturnInternString || d.d.c == containerMapKey {
return d.d.string(d.bs)
}
return string(d.bs)
@@ -1236,7 +1221,7 @@ func (d *jsonDecDriver) DecodeNaked() {
case '"':
// if a string, and MapKeyAsString, then try to decode it as a nil, bool or number first
d.appendStringAsBytes()
- if len(d.bs) > 0 && d.c == containerMapKey && d.h.MapKeyAsString {
+ if len(d.bs) > 0 && d.d.c == containerMapKey && d.h.MapKeyAsString {
switch stringView(d.bs) {
case "null":
z.v = valueTypeNil
@@ -1342,15 +1327,16 @@ type JsonHandle struct {
// The only caveat is that nil value is ALWAYS written as null (never as "null")
MapKeyAsString bool
- // _ [2]byte // padding
+ // _ uint64 // padding (cache line)
- // Note: below, we store hardly-used items e.g. RawBytesExt is cached in the (en|de)cDriver.
+ // Note: below, we store hardly-used items
+ // e.g. RawBytesExt (which is already cached in the (en|de)cDriver).
// RawBytesExt, if configured, is used to encode and decode raw bytes in a custom way.
// If not configured, raw bytes are encoded to/from base64 text.
RawBytesExt InterfaceExt
- _ [2]uint64 // padding
+ // _ [2]uint64 // padding
}
// Name returns the name of the handle: json
@@ -1360,55 +1346,28 @@ func (h *JsonHandle) typical() bool {
return h.Indent == 0 && !h.MapKeyAsString && h.IntegerAsString != 'A' && h.IntegerAsString != 'L'
}
-type jsonTypical interface {
- typical()
-}
-
func (h *JsonHandle) recreateEncDriver(ed encDriver) (v bool) {
- _, v = ed.(jsonTypical)
+ _, v = ed.(*jsonEncDriverTypical)
return v != h.typical()
}
// SetInterfaceExt sets an extension
func (h *JsonHandle) SetInterfaceExt(rt reflect.Type, tag uint64, ext InterfaceExt) (err error) {
- return h.SetExt(rt, tag, &extWrapper{bytesExtFailer{}, ext})
-}
-
-type jsonEncDriverTypicalImpl struct {
- jsonEncDriver
- jsonEncDriverTypical
- _ [1]uint64 // padding
-}
-
-func (x *jsonEncDriverTypicalImpl) reset() {
- x.jsonEncDriver.reset()
- x.jsonEncDriverTypical.reset(&x.jsonEncDriver)
-}
-
-type jsonEncDriverGenericImpl struct {
- jsonEncDriver
- jsonEncDriverGeneric
- // _ [2]uint64 // padding
-}
-
-func (x *jsonEncDriverGenericImpl) reset() {
- x.jsonEncDriver.reset()
- x.jsonEncDriverGeneric.reset(&x.jsonEncDriver)
+ return h.SetExt(rt, tag, &interfaceExtWrapper{InterfaceExt: ext})
}
func (h *JsonHandle) newEncDriver(e *Encoder) (ee encDriver) {
var hd *jsonEncDriver
if h.typical() {
- var v jsonEncDriverTypicalImpl
+ var v jsonEncDriverTypical
ee = &v
hd = &v.jsonEncDriver
} else {
- var v jsonEncDriverGenericImpl
+ var v jsonEncDriverGeneric
ee = &v
hd = &v.jsonEncDriver
}
hd.e, hd.h, hd.bs = e, h, hd.b[:0]
- hd.se.BytesExt = bytesExtFailer{}
ee.reset()
return
}
@@ -1416,47 +1375,82 @@ func (h *JsonHandle) newEncDriver(e *Encoder) (ee encDriver) {
func (h *JsonHandle) newDecDriver(d *Decoder) decDriver {
// d := jsonDecDriver{r: r.(*bytesDecReader), h: h}
hd := jsonDecDriver{d: d, h: h}
- hd.se.BytesExt = bytesExtFailer{}
hd.bs = hd.b[:0]
hd.reset()
return &hd
}
func (e *jsonEncDriver) reset() {
- e.ew = e.e.w
+ e.w = e.e.w()
+ // (htmlasis && jsonCharSafeSet.isset(b)) || jsonCharHtmlSafeSet.isset(b)
+ if e.h.HTMLCharsAsIs {
+ e.s = &jsonCharSafeSet
+ } else {
+ e.s = &jsonCharHtmlSafeSet
+ }
e.se.InterfaceExt = e.h.RawBytesExt
- if e.bs != nil {
+ if e.bs == nil {
+ e.bs = e.b[:0]
+ } else {
e.bs = e.bs[:0]
}
}
func (d *jsonDecDriver) reset() {
- d.r = d.d.r
+ d.r = d.d.r()
d.se.InterfaceExt = d.h.RawBytesExt
if d.bs != nil {
d.bs = d.bs[:0]
}
- d.c, d.tok = 0, 0
+ d.tok = 0
// d.n.reset()
}
-func jsonFloatStrconvFmtPrec(f float64) (fmt byte, prec int) {
+// jsonFloatStrconvFmtPrec ...
+//
+// ensure that every float has an 'e' or '.' in it,/ for easy differentiation from integers.
+// this is better/faster than checking if encoded value has [e.] and appending if needed.
+
+// func jsonFloatStrconvFmtPrec(f float64, bits32 bool) (fmt byte, prec int) {
+// fmt = 'f'
+// prec = -1
+// var abs = math.Abs(f)
+// if abs == 0 || abs == 1 {
+// prec = 1
+// } else if !bits32 && (abs < 1e-6 || abs >= 1e21) ||
+// bits32 && (float32(abs) < 1e-6 || float32(abs) >= 1e21) {
+// fmt = 'e'
+// } else if _, frac := math.Modf(abs); frac == 0 {
+// // ensure that floats have a .0 at the end, for easy identification as floats
+// prec = 1
+// }
+// return
+// }
+
+func jsonFloatStrconvFmtPrec64(f float64) (fmt byte, prec int8) {
+ fmt = 'f'
prec = -1
var abs = math.Abs(f)
- if abs != 0 && (abs < 1e-6 || abs >= 1e21) {
+ if abs == 0 || abs == 1 {
+ prec = 1
+ } else if abs < 1e-6 || abs >= 1e21 {
fmt = 'e'
- } else {
- fmt = 'f'
- // set prec to 1 iff mod is 0.
- // better than using jsonIsFloatBytesB2 to check if a . or E in the float bytes.
- // this ensures that every float has an e or .0 in it.
- if abs <= 1 {
- if abs == 0 || abs == 1 {
- prec = 1
- }
- } else if _, mod := math.Modf(abs); mod == 0 {
- prec = 1
- }
+ } else if noFrac64(abs) { // _, frac := math.Modf(abs); frac == 0 {
+ prec = 1
+ }
+ return
+}
+
+func jsonFloatStrconvFmtPrec32(f float32) (fmt byte, prec int8) {
+ fmt = 'f'
+ prec = -1
+ var abs = abs32(f)
+ if abs == 0 || abs == 1 {
+ prec = 1
+ } else if abs < 1e-6 || abs >= 1e21 {
+ fmt = 'e'
+ } else if noFrac32(abs) { // _, frac := math.Modf(abs); frac == 0 {
+ prec = 1
}
return
}
@@ -1502,7 +1496,13 @@ func jsonParseInteger(s []byte) (n uint64, neg, badSyntax, overflow bool) {
return
}
+var _ decDriverContainerTracker = (*jsonDecDriver)(nil)
+var _ encDriverContainerTracker = (*jsonEncDriver)(nil)
var _ decDriver = (*jsonDecDriver)(nil)
-var _ encDriver = (*jsonEncDriverGenericImpl)(nil)
-var _ encDriver = (*jsonEncDriverTypicalImpl)(nil)
-var _ jsonTypical = (*jsonEncDriverTypical)(nil)
+var _ encDriver = (*jsonEncDriverGeneric)(nil)
+var _ encDriver = (*jsonEncDriverTypical)(nil)
+var _ (interface{ getJsonEncDriver() *jsonEncDriver }) = (*jsonEncDriverTypical)(nil)
+var _ (interface{ getJsonEncDriver() *jsonEncDriver }) = (*jsonEncDriverGeneric)(nil)
+var _ (interface{ getJsonEncDriver() *jsonEncDriver }) = (*jsonEncDriver)(nil)
+
+// var _ encDriver = (*jsonEncDriver)(nil)
diff --git a/vendor/github.com/ugorji/go/codec/msgpack.go b/vendor/github.com/ugorji/go/codec/msgpack.go
index bc3f259a..e07bdcbf 100644
--- a/vendor/github.com/ugorji/go/codec/msgpack.go
+++ b/vendor/github.com/ugorji/go/codec/msgpack.go
@@ -172,23 +172,26 @@ type MsgpackSpecRpcMultiArgs []interface{}
// A MsgpackContainer type specifies the different types of msgpackContainers.
type msgpackContainerType struct {
- fixCutoff int
- bFixMin, b8, b16, b32 byte
- hasFixMin, has8, has8Always bool
+ fixCutoff uint8
+ bFixMin, b8, b16, b32 byte
+ // hasFixMin, has8, has8Always bool
}
var (
+ msgpackContainerRawLegacy = msgpackContainerType{
+ 32, mpFixStrMin, 0, mpStr16, mpStr32,
+ }
msgpackContainerStr = msgpackContainerType{
- 32, mpFixStrMin, mpStr8, mpStr16, mpStr32, true, true, false,
+ 32, mpFixStrMin, mpStr8, mpStr16, mpStr32, // true, true, false,
}
msgpackContainerBin = msgpackContainerType{
- 0, 0, mpBin8, mpBin16, mpBin32, false, true, true,
+ 0, 0, mpBin8, mpBin16, mpBin32, // false, true, true,
}
msgpackContainerList = msgpackContainerType{
- 16, mpFixArrayMin, 0, mpArray16, mpArray32, true, false, false,
+ 16, mpFixArrayMin, 0, mpArray16, mpArray32, // true, false, false,
}
msgpackContainerMap = msgpackContainerType{
- 16, mpFixMapMin, 0, mpMap16, mpMap32, true, false, false,
+ 16, mpFixMapMin, 0, mpMap16, mpMap32, // true, false, false,
}
)
@@ -302,7 +305,7 @@ func (e *msgpackEncDriver) EncodeTime(t time.Time) {
if e.h.WriteExt {
e.encodeExtPreamble(mpTimeExtTagU, l)
} else {
- e.writeContainerLen(msgpackContainerStr, l)
+ e.writeContainerLen(msgpackContainerRawLegacy, l)
}
switch l {
case 4:
@@ -367,39 +370,15 @@ func (e *msgpackEncDriver) WriteMapStart(length int) {
e.writeContainerLen(msgpackContainerMap, length)
}
-func (e *msgpackEncDriver) EncodeString(c charEncoding, s string) {
- slen := len(s)
- if c == cRAW && e.h.WriteExt {
- e.writeContainerLen(msgpackContainerBin, slen)
- } else {
- e.writeContainerLen(msgpackContainerStr, slen)
- }
- if slen > 0 {
- e.w.writestr(s)
- }
-}
-
func (e *msgpackEncDriver) EncodeStringEnc(c charEncoding, s string) {
slen := len(s)
- e.writeContainerLen(msgpackContainerStr, slen)
- if slen > 0 {
- e.w.writestr(s)
- }
-}
-
-func (e *msgpackEncDriver) EncodeStringBytes(c charEncoding, bs []byte) {
- if bs == nil {
- e.EncodeNil()
- return
- }
- slen := len(bs)
- if c == cRAW && e.h.WriteExt {
- e.writeContainerLen(msgpackContainerBin, slen)
- } else {
+ if e.h.WriteExt {
e.writeContainerLen(msgpackContainerStr, slen)
+ } else {
+ e.writeContainerLen(msgpackContainerRawLegacy, slen)
}
if slen > 0 {
- e.w.writeb(bs)
+ e.w.writestr(s)
}
}
@@ -412,7 +391,7 @@ func (e *msgpackEncDriver) EncodeStringBytesRaw(bs []byte) {
if e.h.WriteExt {
e.writeContainerLen(msgpackContainerBin, slen)
} else {
- e.writeContainerLen(msgpackContainerStr, slen)
+ e.writeContainerLen(msgpackContainerRawLegacy, slen)
}
if slen > 0 {
e.w.writeb(bs)
@@ -420,9 +399,9 @@ func (e *msgpackEncDriver) EncodeStringBytesRaw(bs []byte) {
}
func (e *msgpackEncDriver) writeContainerLen(ct msgpackContainerType, l int) {
- if ct.hasFixMin && l < ct.fixCutoff {
+ if ct.fixCutoff > 0 && l < int(ct.fixCutoff) {
e.w.writen1(ct.bFixMin | byte(l))
- } else if ct.has8 && l < 256 && (ct.has8Always || e.h.WriteExt) {
+ } else if ct.b8 > 0 && l < 256 {
e.w.writen2(ct.b8, uint8(l))
} else if l < 65536 {
e.w.writen1(ct.b16)
@@ -518,7 +497,7 @@ func (d *msgpackDecDriver) DecodeNaked() {
n.v = valueTypeInt
n.i = int64(int8(bd))
case bd == mpStr8, bd == mpStr16, bd == mpStr32, bd >= mpFixStrMin && bd <= mpFixStrMax:
- if d.h.RawToString {
+ if d.h.WriteExt || d.h.RawToString {
n.v = valueTypeString
n.s = d.DecodeString()
} else {
@@ -526,8 +505,7 @@ func (d *msgpackDecDriver) DecodeNaked() {
n.l = d.DecodeBytes(nil, false)
}
case bd == mpBin8, bd == mpBin16, bd == mpBin32:
- n.v = valueTypeBytes
- n.l = d.DecodeBytes(nil, false)
+ decNakedReadRawBytes(d, d.d, n, d.h.RawToString)
case bd == mpArray16, bd == mpArray32, bd >= mpFixArrayMin && bd <= mpFixArrayMax:
n.v = valueTypeArray
decodeFurther = true
@@ -692,38 +670,30 @@ func (d *msgpackDecDriver) DecodeBytes(bs []byte, zerocopy bool) (bsOut []byte)
d.readNextBd()
}
- // check if an "array" of uint8's (see ContainerType for how to infer if an array)
bd := d.bd
- // DecodeBytes could be from: bin str fixstr fixarray array ...
var clen int
- vt := d.ContainerType()
- switch vt {
- case valueTypeBytes:
- // valueTypeBytes may be a mpBin or an mpStr container
- if bd == mpBin8 || bd == mpBin16 || bd == mpBin32 {
- clen = d.readContainerLen(msgpackContainerBin)
- } else {
- clen = d.readContainerLen(msgpackContainerStr)
- }
- case valueTypeString:
- clen = d.readContainerLen(msgpackContainerStr)
- case valueTypeArray:
+ if bd == mpNil {
+ d.bdRead = false
+ return
+ } else if bd == mpBin8 || bd == mpBin16 || bd == mpBin32 {
+ clen = d.readContainerLen(msgpackContainerBin) // binary
+ } else if bd == mpStr8 || bd == mpStr16 || bd == mpStr32 ||
+ (bd >= mpFixStrMin && bd <= mpFixStrMax) {
+ clen = d.readContainerLen(msgpackContainerStr) // string/raw
+ } else if bd == mpArray16 || bd == mpArray32 ||
+ (bd >= mpFixArrayMin && bd <= mpFixArrayMax) {
+ // check if an "array" of uint8's
if zerocopy && len(bs) == 0 {
bs = d.d.b[:]
}
bsOut, _ = fastpathTV.DecSliceUint8V(bs, true, d.d)
return
- default:
- d.d.errorf("invalid container type: expecting bin|str|array, got: 0x%x", uint8(vt))
+ } else {
+ d.d.errorf("invalid byte descriptor for decoding bytes, got: 0x%x", d.bd)
return
}
- // these are (bin|str)(8|16|32)
d.bdRead = false
- // bytes may be nil, so handle it. if nil, clen=-1.
- if clen < 0 {
- return nil
- }
if zerocopy {
if d.br {
return d.r.readx(uint(clen))
@@ -759,15 +729,29 @@ func (d *msgpackDecDriver) ContainerType() (vt valueType) {
d.readNextBd()
}
bd := d.bd
+ // if bd == mpNil {
+ // // nil
+ // } else if bd == mpBin8 || bd == mpBin16 || bd == mpBin32 {
+ // // binary
+ // } else if bd == mpStr8 || bd == mpStr16 || bd == mpStr32 ||
+ // (bd >= mpFixStrMin && bd <= mpFixStrMax) {
+ // // string/raw
+ // } else if bd == mpArray16 || bd == mpArray32 ||
+ // (bd >= mpFixArrayMin && bd <= mpFixArrayMax) {
+ // // array
+ // } else if bd == mpMap16 || bd == mpMap32 || (bd >= mpFixMapMin && bd <= mpFixMapMax) {
+ // // map
+ // }
if bd == mpNil {
return valueTypeNil
- } else if bd == mpBin8 || bd == mpBin16 || bd == mpBin32 ||
- (!d.h.RawToString &&
- (bd == mpStr8 || bd == mpStr16 || bd == mpStr32 || (bd >= mpFixStrMin && bd <= mpFixStrMax))) {
+ } else if bd == mpBin8 || bd == mpBin16 || bd == mpBin32 {
return valueTypeBytes
- } else if d.h.RawToString &&
- (bd == mpStr8 || bd == mpStr16 || bd == mpStr32 || (bd >= mpFixStrMin && bd <= mpFixStrMax)) {
- return valueTypeString
+ } else if bd == mpStr8 || bd == mpStr16 || bd == mpStr32 ||
+ (bd >= mpFixStrMin && bd <= mpFixStrMax) {
+ if d.h.WriteExt || d.h.RawToString { // UTF-8 string (new spec)
+ return valueTypeString
+ }
+ return valueTypeBytes // raw (old spec)
} else if bd == mpArray16 || bd == mpArray32 || (bd >= mpFixArrayMin && bd <= mpFixArrayMax) {
return valueTypeArray
} else if bd == mpMap16 || bd == mpMap32 || (bd >= mpFixMapMin && bd <= mpFixMapMax) {
@@ -856,15 +840,17 @@ func (d *msgpackDecDriver) DecodeTime() (t time.Time) {
if !d.bdRead {
d.readNextBd()
}
- if d.bd == mpNil {
+ bd := d.bd
+ var clen int
+ if bd == mpNil {
d.bdRead = false
return
- }
- var clen int
- switch d.ContainerType() {
- case valueTypeBytes, valueTypeString:
- clen = d.readContainerLen(msgpackContainerStr)
- default:
+ } else if bd == mpBin8 || bd == mpBin16 || bd == mpBin32 {
+ clen = d.readContainerLen(msgpackContainerBin) // binary
+ } else if bd == mpStr8 || bd == mpStr16 || bd == mpStr32 ||
+ (bd >= mpFixStrMin && bd <= mpFixStrMax) {
+ clen = d.readContainerLen(msgpackContainerStr) // string/raw
+ } else {
// expect to see mpFixExt4,-1 OR mpFixExt8,-1 OR mpExt8,12,-1
d.bdRead = false
b2 := d.r.readn1()
@@ -875,7 +861,7 @@ func (d *msgpackDecDriver) DecodeTime() (t time.Time) {
} else if d.bd == mpExt8 && b2 == 12 && d.r.readn1() == mpTimeExtTagU {
clen = 12
} else {
- d.d.errorf("invalid bytes for decoding time as extension: got 0x%x, 0x%x", d.bd, b2)
+ d.d.errorf("invalid stream for decoding time as extension: got 0x%x, 0x%x", d.bd, b2)
return
}
}
@@ -952,22 +938,21 @@ func (d *msgpackDecDriver) decodeExtV(verifyTag bool, tag byte) (xtag byte, xbs
type MsgpackHandle struct {
BasicHandle
- // RawToString controls how raw bytes are decoded into a nil interface{}.
- RawToString bool
-
// NoFixedNum says to output all signed integers as 2-bytes, never as 1-byte fixednum.
NoFixedNum bool
- // WriteExt flag supports encoding configured extensions with extension tags.
- // It also controls whether other elements of the new spec are encoded (ie Str8).
+ // WriteExt controls whether the new spec is honored.
+ //
+ // With WriteExt=true, we can encode configured extensions with extension tags
+ // and encode string/[]byte/extensions in a way compatible with the new spec
+ // but incompatible with the old spec.
//
- // With WriteExt=false, configured extensions are serialized as raw bytes
- // and Str8 is not encoded.
+ // For compatibility with the old spec, set WriteExt=false.
//
- // A stream can still be decoded into a typed value, provided an appropriate value
- // is provided, but the type cannot be inferred from the stream. If no appropriate
- // type is provided (e.g. decoding into a nil interface{}), you get back
- // a []byte or string based on the setting of RawToString.
+ // With WriteExt=false:
+ // configured extensions are serialized as raw bytes (not msgpack extensions).
+ // reserved byte descriptors like Str8 and those enabling the new msgpack Binary type
+ // are not encoded.
WriteExt bool
// PositiveIntUnsigned says to encode positive integers as unsigned.
@@ -976,7 +961,7 @@ type MsgpackHandle struct {
binaryEncodingType
noElemSeparators
- // _ [1]uint64 // padding
+ _ [1]uint64 // padding (cache-aligned)
}
// Name returns the name of the handle: msgpack
@@ -984,23 +969,23 @@ func (h *MsgpackHandle) Name() string { return "msgpack" }
// SetBytesExt sets an extension
func (h *MsgpackHandle) SetBytesExt(rt reflect.Type, tag uint64, ext BytesExt) (err error) {
- return h.SetExt(rt, tag, &extWrapper{ext, interfaceExtFailer{}})
+ return h.SetExt(rt, tag, &bytesExtWrapper{BytesExt: ext})
}
func (h *MsgpackHandle) newEncDriver(e *Encoder) encDriver {
- return &msgpackEncDriver{e: e, w: e.w, h: h}
+ return &msgpackEncDriver{e: e, w: e.w(), h: h}
}
func (h *MsgpackHandle) newDecDriver(d *Decoder) decDriver {
- return &msgpackDecDriver{d: d, h: h, r: d.r, br: d.bytes}
+ return &msgpackDecDriver{d: d, h: h, r: d.r(), br: d.bytes}
}
func (e *msgpackEncDriver) reset() {
- e.w = e.e.w
+ e.w = e.e.w()
}
func (d *msgpackDecDriver) reset() {
- d.r, d.br = d.d.r, d.d.bytes
+ d.r, d.br = d.d.r(), d.d.bytes
d.bd, d.bdRead = 0, false
}
diff --git a/vendor/github.com/ugorji/go/codec/prebuild.go b/vendor/github.com/ugorji/go/codec/prebuild.go
new file mode 100644
index 00000000..9e657aff
--- /dev/null
+++ b/vendor/github.com/ugorji/go/codec/prebuild.go
@@ -0,0 +1,119 @@
+// +build prebuild
+
+package main
+
+import (
+ "bytes"
+ "go/format"
+ "io/ioutil"
+ "os"
+ "strings"
+ "text/template"
+)
+
+func genInternalSortableTypes() []string {
+ return []string{
+ "string",
+ "float32",
+ "float64",
+ "uint",
+ "uint8",
+ "uint16",
+ "uint32",
+ "uint64",
+ "uintptr",
+ "int",
+ "int8",
+ "int16",
+ "int32",
+ "int64",
+ "bool",
+ "time",
+ "bytes",
+ }
+}
+
+func genInternalSortablePlusTypes() []string {
+ return []string{
+ "string",
+ "float64",
+ "uint64",
+ "uintptr",
+ "int64",
+ "bool",
+ "time",
+ "bytes",
+ }
+}
+
+func genTypeForShortName(s string) string {
+ switch s {
+ case "time":
+ return "time.Time"
+ case "bytes":
+ return "[]byte"
+ }
+ return s
+}
+
+func genArgs(args ...interface{}) map[string]interface{} {
+ m := make(map[string]interface{}, len(args)/2)
+ for i := 0; i < len(args); {
+ m[args[i].(string)] = args[i+1]
+ i += 2
+ }
+ return m
+}
+
+func genEndsWith(s0 string, sn ...string) bool {
+ for _, s := range sn {
+ if strings.HasSuffix(s0, s) {
+ return true
+ }
+ }
+ return false
+}
+
+func chkerr(err error) {
+ if err != nil {
+ panic(err)
+ }
+}
+
+func run(fnameIn, fnameOut string) {
+ var err error
+
+ funcs := make(template.FuncMap)
+ funcs["sortables"] = genInternalSortableTypes
+ funcs["sortablesplus"] = genInternalSortablePlusTypes
+ funcs["tshort"] = genTypeForShortName
+ funcs["endswith"] = genEndsWith
+ funcs["args"] = genArgs
+
+ t := template.New("").Funcs(funcs)
+ fin, err := os.Open(fnameIn)
+ chkerr(err)
+ defer fin.Close()
+ fout, err := os.Create(fnameOut)
+ chkerr(err)
+ defer fout.Close()
+ tmplstr, err := ioutil.ReadAll(fin)
+ chkerr(err)
+ t, err = t.Parse(string(tmplstr))
+ chkerr(err)
+ var out bytes.Buffer
+ err = t.Execute(&out, 0)
+ chkerr(err)
+ bout, err := format.Source(out.Bytes())
+ if err != nil {
+ fout.Write(out.Bytes()) // write out if error, so we can still see.
+ // w.Write(bout) // write out if error, as much as possible, so we can still see.
+ }
+ chkerr(err)
+ _, err = fout.Write(bout)
+ chkerr(err)
+}
+
+func main() {
+ run("sort-slice.go.tmpl", "sort-slice.generated.go")
+}
diff --git a/vendor/github.com/ugorji/go/codec/simple.go b/vendor/github.com/ugorji/go/codec/simple.go
index 464c2f99..ee9755b3 100644
--- a/vendor/github.com/ugorji/go/codec/simple.go
+++ b/vendor/github.com/ugorji/go/codec/simple.go
@@ -33,15 +33,15 @@ const (
type simpleEncDriver struct {
noBuiltInTypes
+ encDriverNoopContainerWriter
// encNoSeparator
e *Encoder
h *SimpleHandle
w *encWriterSwitch
b [8]byte
// c containerState
- encDriverTrackContainerWriter
- // encDriverNoopContainerWriter
- _ [3]uint64 // padding
+ // encDriverTrackContainerWriter
+ _ [2]uint64 // padding (cache-aligned)
}
func (e *simpleEncDriver) EncodeNil() {
@@ -49,7 +49,7 @@ func (e *simpleEncDriver) EncodeNil() {
}
func (e *simpleEncDriver) EncodeBool(b bool) {
- if e.h.EncZeroValuesAsNil && e.c != containerMapKey && !b {
+ if e.h.EncZeroValuesAsNil && e.e.c != containerMapKey && !b {
e.EncodeNil()
return
}
@@ -61,7 +61,7 @@ func (e *simpleEncDriver) EncodeBool(b bool) {
}
func (e *simpleEncDriver) EncodeFloat32(f float32) {
- if e.h.EncZeroValuesAsNil && e.c != containerMapKey && f == 0.0 {
+ if e.h.EncZeroValuesAsNil && e.e.c != containerMapKey && f == 0.0 {
e.EncodeNil()
return
}
@@ -70,7 +70,7 @@ func (e *simpleEncDriver) EncodeFloat32(f float32) {
}
func (e *simpleEncDriver) EncodeFloat64(f float64) {
- if e.h.EncZeroValuesAsNil && e.c != containerMapKey && f == 0.0 {
+ if e.h.EncZeroValuesAsNil && e.e.c != containerMapKey && f == 0.0 {
e.EncodeNil()
return
}
@@ -91,7 +91,7 @@ func (e *simpleEncDriver) EncodeUint(v uint64) {
}
func (e *simpleEncDriver) encUint(v uint64, bd uint8) {
- if e.h.EncZeroValuesAsNil && e.c != containerMapKey && v == 0 {
+ if e.h.EncZeroValuesAsNil && e.e.c != containerMapKey && v == 0 {
e.EncodeNil()
return
}
@@ -148,21 +148,19 @@ func (e *simpleEncDriver) encodeExtPreamble(xtag byte, length int) {
}
func (e *simpleEncDriver) WriteArrayStart(length int) {
- e.c = containerArrayStart
e.encLen(simpleVdArray, length)
}
func (e *simpleEncDriver) WriteMapStart(length int) {
- e.c = containerMapStart
e.encLen(simpleVdMap, length)
}
// func (e *simpleEncDriver) EncodeSymbol(v string) {
-// e.EncodeString(cUTF8, v)
+// e.EncodeStringEnc(cUTF8, v)
// }
func (e *simpleEncDriver) EncodeStringEnc(c charEncoding, v string) {
- if false && e.h.EncZeroValuesAsNil && e.c != containerMapKey && v == "" {
+ if false && e.h.EncZeroValuesAsNil && e.e.c != containerMapKey && v == "" {
e.EncodeNil()
return
}
@@ -170,14 +168,6 @@ func (e *simpleEncDriver) EncodeStringEnc(c charEncoding, v string) {
e.w.writestr(v)
}
-func (e *simpleEncDriver) EncodeString(c charEncoding, v string) {
- e.EncodeStringEnc(c, v)
-}
-
-func (e *simpleEncDriver) EncodeStringBytes(c charEncoding, v []byte) {
- e.EncodeStringBytesRaw(v)
-}
-
func (e *simpleEncDriver) EncodeStringBytesRaw(v []byte) {
// if e.h.EncZeroValuesAsNil && e.c != containerMapKey && v == nil {
if v == nil {
@@ -213,7 +203,7 @@ type simpleDecDriver struct {
bdRead bool
bd byte
br bool // a bytes reader?
- c containerState
+ // c containerState
// b [scratchByteArrayLen]byte
noBuiltInTypes
// noStreamingCodec
@@ -370,7 +360,6 @@ func (d *simpleDecDriver) ReadMapStart() (length int) {
d.readNextBd()
}
d.bdRead = false
- d.c = containerMapStart
return d.decLen()
}
@@ -379,30 +368,9 @@ func (d *simpleDecDriver) ReadArrayStart() (length int) {
d.readNextBd()
}
d.bdRead = false
- d.c = containerArrayStart
return d.decLen()
}
-func (d *simpleDecDriver) ReadArrayElem() {
- d.c = containerArrayElem
-}
-
-func (d *simpleDecDriver) ReadArrayEnd() {
- d.c = containerArrayEnd
-}
-
-func (d *simpleDecDriver) ReadMapElemKey() {
- d.c = containerMapKey
-}
-
-func (d *simpleDecDriver) ReadMapElemValue() {
- d.c = containerMapValue
-}
-
-func (d *simpleDecDriver) ReadMapEnd() {
- d.c = containerMapEnd
-}
-
func (d *simpleDecDriver) decLen() int {
switch d.bd % 8 {
case 0:
@@ -576,8 +544,7 @@ func (d *simpleDecDriver) DecodeNaked() {
n.s = d.DecodeString()
case simpleVdByteArray, simpleVdByteArray + 1,
simpleVdByteArray + 2, simpleVdByteArray + 3, simpleVdByteArray + 4:
- n.v = valueTypeBytes
- n.l = d.DecodeBytes(nil, false)
+ decNakedReadRawBytes(d, d.d, n, d.h.RawToString)
case simpleVdExt, simpleVdExt + 1, simpleVdExt + 2, simpleVdExt + 3, simpleVdExt + 4:
n.v = valueTypeExt
l := d.decLen()
@@ -631,7 +598,7 @@ type SimpleHandle struct {
// EncZeroValuesAsNil says to encode zero values for numbers, bool, string, etc as nil
EncZeroValuesAsNil bool
- // _ [1]uint64 // padding
+ _ [1]uint64 // padding (cache-aligned)
}
// Name returns the name of the handle: simple
@@ -639,27 +606,25 @@ func (h *SimpleHandle) Name() string { return "simple" }
// SetBytesExt sets an extension
func (h *SimpleHandle) SetBytesExt(rt reflect.Type, tag uint64, ext BytesExt) (err error) {
- return h.SetExt(rt, tag, &extWrapper{ext, interfaceExtFailer{}})
+ return h.SetExt(rt, tag, &bytesExtWrapper{BytesExt: ext})
}
-func (h *SimpleHandle) hasElemSeparators() bool { return true } // as it implements Write(Map|Array)XXX
+// func (h *SimpleHandle) hasElemSeparators() bool { return true } // as it implements Write(Map|Array)XXX
func (h *SimpleHandle) newEncDriver(e *Encoder) encDriver {
- return &simpleEncDriver{e: e, w: e.w, h: h}
+ return &simpleEncDriver{e: e, w: e.w(), h: h}
}
func (h *SimpleHandle) newDecDriver(d *Decoder) decDriver {
- return &simpleDecDriver{d: d, h: h, r: d.r, br: d.bytes}
+ return &simpleDecDriver{d: d, h: h, r: d.r(), br: d.bytes}
}
func (e *simpleEncDriver) reset() {
- e.c = 0
- e.w = e.e.w
+ e.w = e.e.w()
}
func (d *simpleDecDriver) reset() {
- d.c = 0
- d.r, d.br = d.d.r, d.d.bytes
+ d.r, d.br = d.d.r(), d.d.bytes
d.bd, d.bdRead = 0, false
}
diff --git a/vendor/github.com/ugorji/go/codec/sort-slice.generated.go b/vendor/github.com/ugorji/go/codec/sort-slice.generated.go
new file mode 100644
index 00000000..6f82a552
--- /dev/null
+++ b/vendor/github.com/ugorji/go/codec/sort-slice.generated.go
@@ -0,0 +1,338 @@
+// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved.
+// Use of this source code is governed by a MIT license found in the LICENSE file.
+
+// Code generated from sort-slice.go.tmpl - DO NOT EDIT.
+
+package codec
+
+import "time"
+import "reflect"
+import "bytes"
+
+type stringSlice []string
+
+func (p stringSlice) Len() int { return len(p) }
+func (p stringSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
+func (p stringSlice) Less(i, j int) bool {
+ return p[uint(i)] < p[uint(j)]
+}
+
+type float32Slice []float32
+
+func (p float32Slice) Len() int { return len(p) }
+func (p float32Slice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
+func (p float32Slice) Less(i, j int) bool {
+ return p[uint(i)] < p[uint(j)] || isNaN32(p[uint(i)]) && !isNaN32(p[uint(j)])
+}
+
+type float64Slice []float64
+
+func (p float64Slice) Len() int { return len(p) }
+func (p float64Slice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
+func (p float64Slice) Less(i, j int) bool {
+ return p[uint(i)] < p[uint(j)] || isNaN64(p[uint(i)]) && !isNaN64(p[uint(j)])
+}
+
+type uintSlice []uint
+
+func (p uintSlice) Len() int { return len(p) }
+func (p uintSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
+func (p uintSlice) Less(i, j int) bool {
+ return p[uint(i)] < p[uint(j)]
+}
+
+type uint8Slice []uint8
+
+func (p uint8Slice) Len() int { return len(p) }
+func (p uint8Slice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
+func (p uint8Slice) Less(i, j int) bool {
+ return p[uint(i)] < p[uint(j)]
+}
+
+type uint16Slice []uint16
+
+func (p uint16Slice) Len() int { return len(p) }
+func (p uint16Slice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
+func (p uint16Slice) Less(i, j int) bool {
+ return p[uint(i)] < p[uint(j)]
+}
+
+type uint32Slice []uint32
+
+func (p uint32Slice) Len() int { return len(p) }
+func (p uint32Slice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
+func (p uint32Slice) Less(i, j int) bool {
+ return p[uint(i)] < p[uint(j)]
+}
+
+type uint64Slice []uint64
+
+func (p uint64Slice) Len() int { return len(p) }
+func (p uint64Slice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
+func (p uint64Slice) Less(i, j int) bool {
+ return p[uint(i)] < p[uint(j)]
+}
+
+type uintptrSlice []uintptr
+
+func (p uintptrSlice) Len() int { return len(p) }
+func (p uintptrSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
+func (p uintptrSlice) Less(i, j int) bool {
+ return p[uint(i)] < p[uint(j)]
+}
+
+type intSlice []int
+
+func (p intSlice) Len() int { return len(p) }
+func (p intSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
+func (p intSlice) Less(i, j int) bool {
+ return p[uint(i)] < p[uint(j)]
+}
+
+type int8Slice []int8
+
+func (p int8Slice) Len() int { return len(p) }
+func (p int8Slice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
+func (p int8Slice) Less(i, j int) bool {
+ return p[uint(i)] < p[uint(j)]
+}
+
+type int16Slice []int16
+
+func (p int16Slice) Len() int { return len(p) }
+func (p int16Slice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
+func (p int16Slice) Less(i, j int) bool {
+ return p[uint(i)] < p[uint(j)]
+}
+
+type int32Slice []int32
+
+func (p int32Slice) Len() int { return len(p) }
+func (p int32Slice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
+func (p int32Slice) Less(i, j int) bool {
+ return p[uint(i)] < p[uint(j)]
+}
+
+type int64Slice []int64
+
+func (p int64Slice) Len() int { return len(p) }
+func (p int64Slice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
+func (p int64Slice) Less(i, j int) bool {
+ return p[uint(i)] < p[uint(j)]
+}
+
+type boolSlice []bool
+
+func (p boolSlice) Len() int { return len(p) }
+func (p boolSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
+func (p boolSlice) Less(i, j int) bool {
+ return !p[uint(i)] && p[uint(j)]
+}
+
+type timeSlice []time.Time
+
+func (p timeSlice) Len() int { return len(p) }
+func (p timeSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
+func (p timeSlice) Less(i, j int) bool {
+ return p[uint(i)].Before(p[uint(j)])
+}
+
+type bytesSlice [][]byte
+
+func (p bytesSlice) Len() int { return len(p) }
+func (p bytesSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
+func (p bytesSlice) Less(i, j int) bool {
+ return bytes.Compare(p[uint(i)], p[uint(j)]) == -1
+}
+
+type stringRv struct {
+ v string
+ r reflect.Value
+}
+type stringRvSlice []stringRv
+
+func (p stringRvSlice) Len() int { return len(p) }
+func (p stringRvSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
+func (p stringRvSlice) Less(i, j int) bool {
+ return p[uint(i)].v < p[uint(j)].v
+}
+
+type stringIntf struct {
+ v string
+ i interface{}
+}
+type stringIntfSlice []stringIntf
+
+func (p stringIntfSlice) Len() int { return len(p) }
+func (p stringIntfSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
+func (p stringIntfSlice) Less(i, j int) bool {
+ return p[uint(i)].v < p[uint(j)].v
+}
+
+type float64Rv struct {
+ v float64
+ r reflect.Value
+}
+type float64RvSlice []float64Rv
+
+func (p float64RvSlice) Len() int { return len(p) }
+func (p float64RvSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
+func (p float64RvSlice) Less(i, j int) bool {
+ return p[uint(i)].v < p[uint(j)].v || isNaN64(p[uint(i)].v) && !isNaN64(p[uint(j)].v)
+}
+
+type float64Intf struct {
+ v float64
+ i interface{}
+}
+type float64IntfSlice []float64Intf
+
+func (p float64IntfSlice) Len() int { return len(p) }
+func (p float64IntfSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
+func (p float64IntfSlice) Less(i, j int) bool {
+ return p[uint(i)].v < p[uint(j)].v || isNaN64(p[uint(i)].v) && !isNaN64(p[uint(j)].v)
+}
+
+type uint64Rv struct {
+ v uint64
+ r reflect.Value
+}
+type uint64RvSlice []uint64Rv
+
+func (p uint64RvSlice) Len() int { return len(p) }
+func (p uint64RvSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
+func (p uint64RvSlice) Less(i, j int) bool {
+ return p[uint(i)].v < p[uint(j)].v
+}
+
+type uint64Intf struct {
+ v uint64
+ i interface{}
+}
+type uint64IntfSlice []uint64Intf
+
+func (p uint64IntfSlice) Len() int { return len(p) }
+func (p uint64IntfSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
+func (p uint64IntfSlice) Less(i, j int) bool {
+ return p[uint(i)].v < p[uint(j)].v
+}
+
+type uintptrRv struct {
+ v uintptr
+ r reflect.Value
+}
+type uintptrRvSlice []uintptrRv
+
+func (p uintptrRvSlice) Len() int { return len(p) }
+func (p uintptrRvSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
+func (p uintptrRvSlice) Less(i, j int) bool {
+ return p[uint(i)].v < p[uint(j)].v
+}
+
+type uintptrIntf struct {
+ v uintptr
+ i interface{}
+}
+type uintptrIntfSlice []uintptrIntf
+
+func (p uintptrIntfSlice) Len() int { return len(p) }
+func (p uintptrIntfSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
+func (p uintptrIntfSlice) Less(i, j int) bool {
+ return p[uint(i)].v < p[uint(j)].v
+}
+
+type int64Rv struct {
+ v int64
+ r reflect.Value
+}
+type int64RvSlice []int64Rv
+
+func (p int64RvSlice) Len() int { return len(p) }
+func (p int64RvSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
+func (p int64RvSlice) Less(i, j int) bool {
+ return p[uint(i)].v < p[uint(j)].v
+}
+
+type int64Intf struct {
+ v int64
+ i interface{}
+}
+type int64IntfSlice []int64Intf
+
+func (p int64IntfSlice) Len() int { return len(p) }
+func (p int64IntfSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
+func (p int64IntfSlice) Less(i, j int) bool {
+ return p[uint(i)].v < p[uint(j)].v
+}
+
+type boolRv struct {
+ v bool
+ r reflect.Value
+}
+type boolRvSlice []boolRv
+
+func (p boolRvSlice) Len() int { return len(p) }
+func (p boolRvSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
+func (p boolRvSlice) Less(i, j int) bool {
+ return !p[uint(i)].v && p[uint(j)].v
+}
+
+type boolIntf struct {
+ v bool
+ i interface{}
+}
+type boolIntfSlice []boolIntf
+
+func (p boolIntfSlice) Len() int { return len(p) }
+func (p boolIntfSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
+func (p boolIntfSlice) Less(i, j int) bool {
+ return !p[uint(i)].v && p[uint(j)].v
+}
+
+type timeRv struct {
+ v time.Time
+ r reflect.Value
+}
+type timeRvSlice []timeRv
+
+func (p timeRvSlice) Len() int { return len(p) }
+func (p timeRvSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
+func (p timeRvSlice) Less(i, j int) bool {
+ return p[uint(i)].v.Before(p[uint(j)].v)
+}
+
+type timeIntf struct {
+ v time.Time
+ i interface{}
+}
+type timeIntfSlice []timeIntf
+
+func (p timeIntfSlice) Len() int { return len(p) }
+func (p timeIntfSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
+func (p timeIntfSlice) Less(i, j int) bool {
+ return p[uint(i)].v.Before(p[uint(j)].v)
+}
+
+type bytesRv struct {
+ v []byte
+ r reflect.Value
+}
+type bytesRvSlice []bytesRv
+
+func (p bytesRvSlice) Len() int { return len(p) }
+func (p bytesRvSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
+func (p bytesRvSlice) Less(i, j int) bool {
+ return bytes.Compare(p[uint(i)].v, p[uint(j)].v) == -1
+}
+
+type bytesIntf struct {
+ v []byte
+ i interface{}
+}
+type bytesIntfSlice []bytesIntf
+
+func (p bytesIntfSlice) Len() int { return len(p) }
+func (p bytesIntfSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
+func (p bytesIntfSlice) Less(i, j int) bool {
+ return bytes.Compare(p[uint(i)].v, p[uint(j)].v) == -1
+}
diff --git a/vendor/github.com/ugorji/go/codec/sort-slice.go.tmpl b/vendor/github.com/ugorji/go/codec/sort-slice.go.tmpl
new file mode 100644
index 00000000..590b3105
--- /dev/null
+++ b/vendor/github.com/ugorji/go/codec/sort-slice.go.tmpl
@@ -0,0 +1,64 @@
+// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved.
+// Use of this source code is governed by a MIT license found in the LICENSE file.
+
+// Code generated from sort-slice.go.tmpl - DO NOT EDIT.
+
+{{/*
+xxxSlice
+xxxIntf
+xxxIntfSlice
+xxxRv
+xxxRvSlice
+
+I'm not going to create them for
+- sortables
+- sortablesplus
+
+With the parameters passed in sortables or sortablesplus,
+'time, 'bytes' are special, and correspond to time.Time and []byte respectively.
+*/}}
+
+package codec
+
+import "time"
+import "reflect"
+import "bytes"
+
+{{/* func init() { _ = time.Unix } */}}
+
+{{define "T"}}
+func (p {{ .Type }}) Len() int { return len(p) }
+func (p {{ .Type }}) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] }
+func (p {{ .Type }}) Less(i, j int) bool {
+ {{ if eq .Kind "bool" }} return !p[uint(i)]{{.V}} && p[uint(j)]{{.V}}
+ {{ else if eq .Kind "float32" }} return p[uint(i)]{{.V}} < p[uint(j)]{{.V}} || isNaN32(p[uint(i)]{{.V}}) && !isNaN32(p[uint(j)]{{.V}})
+ {{ else if eq .Kind "float64" }} return p[uint(i)]{{.V}} < p[uint(j)]{{.V}} || isNaN64(p[uint(i)]{{.V}}) && !isNaN64(p[uint(j)]{{.V}})
+ {{ else if eq .Kind "time" }} return p[uint(i)]{{.V}}.Before(p[uint(j)]{{.V}})
+ {{ else if eq .Kind "bytes" }} return bytes.Compare(p[uint(i)]{{.V}}, p[uint(j)]{{.V}}) == -1
+ {{ else }} return p[uint(i)]{{.V}} < p[uint(j)]{{.V}}
+ {{ end -}}
+}
+{{end}}
+
+{{range $i, $v := sortables }}{{ $t := tshort $v }}
+type {{ $v }}Slice []{{ $t }}
+{{template "T" args "Kind" $v "Type" (print $v "Slice") "V" ""}}
+{{end}}
+
+{{range $i, $v := sortablesplus }}{{ $t := tshort $v }}
+
+type {{ $v }}Rv struct {
+ v {{ $t }}
+ r reflect.Value
+}
+type {{ $v }}RvSlice []{{ $v }}Rv
+{{template "T" args "Kind" $v "Type" (print $v "RvSlice") "V" ".v"}}
+
+type {{ $v }}Intf struct {
+ v {{ $t }}
+ i interface{}
+}
+type {{ $v }}IntfSlice []{{ $v }}Intf
+{{template "T" args "Kind" $v "Type" (print $v "IntfSlice") "V" ".v"}}
+
+{{end}}
diff --git a/vendor/golang.org/x/net/webdav/webdav.go b/vendor/golang.org/x/net/webdav/webdav.go
index b04c5dd7..01aed8cc 100644
--- a/vendor/golang.org/x/net/webdav/webdav.go
+++ b/vendor/golang.org/x/net/webdav/webdav.go
@@ -557,7 +557,7 @@ func (h *Handler) handlePropfind(w http.ResponseWriter, r *http.Request) (status
return err
}
href := path.Join(h.Prefix, reqPath)
- if info.IsDir() {
+ if href != "/" && info.IsDir() {
href += "/"
}
return mw.write(makePropstatResponse(href, pstats))
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 494005f1..f56fa199 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -15,20 +15,20 @@ github.com/boombuler/barcode/qr
github.com/boombuler/barcode/utils
# github.com/dgrijalva/jwt-go v3.1.0+incompatible
github.com/dgrijalva/jwt-go
-# github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7
+# github.com/gin-contrib/sse v0.1.0
github.com/gin-contrib/sse
-# github.com/gin-gonic/gin v1.3.0
+# github.com/gin-gonic/gin v1.4.0
github.com/gin-gonic/gin
github.com/gin-gonic/gin/binding
-github.com/gin-gonic/gin/json
+github.com/gin-gonic/gin/internal/json
github.com/gin-gonic/gin/render
# github.com/go-ini/ini v1.32.1-0.20180214101753-32e4be5f41bb
github.com/go-ini/ini
# github.com/go-openapi/jsonpointer v0.17.0
github.com/go-openapi/jsonpointer
-# github.com/go-openapi/jsonreference v0.18.0
+# github.com/go-openapi/jsonreference v0.19.0
github.com/go-openapi/jsonreference
-# github.com/go-openapi/spec v0.18.0
+# github.com/go-openapi/spec v0.19.0
github.com/go-openapi/spec
# github.com/go-openapi/swag v0.17.0
github.com/go-openapi/swag
@@ -54,29 +54,29 @@ github.com/json-iterator/go
github.com/mailru/easyjson/buffer
github.com/mailru/easyjson/jlexer
github.com/mailru/easyjson/jwriter
-# github.com/mattn/go-isatty v0.0.4
+# github.com/mattn/go-isatty v0.0.8
github.com/mattn/go-isatty
-# github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421
+# github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd
github.com/modern-go/concurrent
-# github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742
+# github.com/modern-go/reflect2 v1.0.1
github.com/modern-go/reflect2
# github.com/pkg/errors v0.8.1
github.com/pkg/errors
-# github.com/swaggo/gin-swagger v1.0.1-0.20190110070702-0c6fcfd3c7f3
+# github.com/swaggo/gin-swagger v1.2.0
github.com/swaggo/gin-swagger
github.com/swaggo/gin-swagger/swaggerFiles
-# github.com/swaggo/swag v1.4.0
+# github.com/swaggo/swag v1.5.1
github.com/swaggo/swag
# github.com/tealeg/xlsx v1.0.4-0.20180419195153-f36fa3be8893
github.com/tealeg/xlsx
-# github.com/ugorji/go/codec v0.0.0-20181209151446-772ced7fd4c2
+# github.com/ugorji/go/codec v1.1.5-pre
github.com/ugorji/go/codec
# github.com/unknwon/com v1.0.1
github.com/unknwon/com
# golang.org/x/image v0.0.0-20180628062038-cc896f830ced
golang.org/x/image/font
golang.org/x/image/math/fixed
-# golang.org/x/net v0.0.0-20190603091049-60506f45cf65
+# golang.org/x/net v0.0.0-20190611141213-3f473d35a33a
golang.org/x/net/context
golang.org/x/net/idna
golang.org/x/net/webdav
@@ -89,7 +89,7 @@ golang.org/x/text/transform
golang.org/x/text/unicode/bidi
golang.org/x/text/unicode/norm
golang.org/x/text/width
-# golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b
+# golang.org/x/tools v0.0.0-20190611222205-d73e1c7e250b
golang.org/x/tools/go/ast/astutil
golang.org/x/tools/go/buildutil
golang.org/x/tools/go/internal/cgo