github.com/bytedance/sonic@v1.11.7-0.20240517092252-d2edb31b167b/testdata/small.go (about) 1 2 /* 3 * Copyright 2021 ByteDance Inc. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 package testdata 19 20 // ffjson: skip 21 // easyjson:skip 22 type Book struct { 23 BookId int `json:"id"` 24 BookIds []int `json:"ids"` 25 Title string `json:"title"` 26 Titles []string `json:"titles"` 27 Price float64 `json:"price"` 28 Prices []float64 `json:"prices"` 29 Hot bool `json:"hot"` 30 Hots []bool `json:"hots"` 31 Author Author `json:"author"` 32 Authors []Author `json:"authors"` 33 Weights []int `json:"weights"` 34 } 35 36 // ffjson: skip 37 // easyjson:skip 38 type Author struct { 39 Name string `json:"name"` 40 Age int `json:"age"` 41 Male bool `json:"male"` 42 } 43 44 var book = Book{ 45 BookId: 12125925, 46 BookIds: []int{-2147483648, 2147483647}, 47 Title: "未来简史-从智人到智神", 48 Titles: []string{"hello", "world"}, 49 Price: 40.8, 50 Prices: []float64{-0.1, 0.1}, 51 Hot: true, 52 Hots: []bool{true, true, true}, 53 Author: author, 54 Authors: []Author{author, author, author}, 55 Weights: nil, 56 } 57 58 var author = Author{ 59 Name: "json", 60 Age: 99, 61 Male: true, 62 } 63 64 var data = []byte(`{"id":12125925,"ids":[-2147483648,2147483647],"title":"未来简史-从智人到智神","titles":["hello","world"],"price":40.8,"prices":[-0.1,0.1],"hot":true,"hots":[true,true,true],"author":{"name":"json","age":99,"male":true},"authors":[{"name":"json","age":99,"male":true},{"name":"json","age":99,"male":true},{"name":"json","age":99,"male":true}],"weights":[]}`)