// Copyright 2017 PingCAP, Inc. // // 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, // See the License for the specific language governing permissions and // limitations under the License. package json import ( "encoding/binary" "unicode/utf8" "github.com/pingcap/parser/mysql" "github.com/pingcap/parser/terror" ) // TypeCode indicates JSON type. type TypeCode = byte const ( // TypeCodeObject indicates the JSON is an object. TypeCodeObject TypeCode = 0x01 // TypeCodeArray indicates the JSON is an array. TypeCodeArray TypeCode = 0x03 // TypeCodeLiteral indicates the JSON is a literal. TypeCodeLiteral TypeCode = 0x04 // TypeCodeInt64 indicates the JSON is a signed integer. TypeCodeInt64 TypeCode = 0x09 // TypeCodeUint64 indicates the JSON is a unsigned integer. TypeCodeUint64 TypeCode = 0x0a // TypeCodeFloat64 indicates the JSON is a double float number. TypeCodeFloat64 TypeCode = 0x0b // TypeCodeString indicates the JSON is a string. TypeCodeString TypeCode = 0x0c ) const ( // LiteralNil represents JSON null. LiteralNil byte = 0x00 // LiteralTrue represents JSON true. LiteralTrue byte = 0x01 // LiteralFalse represents JSON false. LiteralFalse byte = 0x02 ) const unknownTypeCodeErrorMsg = "unknown type code: %d" const unknownTypeErrorMsg = "unknown type: %s" // htmlSafeSet holds the value true if the ASCII character with the given // array position can be safely represented inside a JSON string, embedded // inside of HTML