blob: 71eb91a94c6b99d1521bc125e1a2ccd0ef8f9ab2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
// Package benchmark provides a simple benchmark for easyjson against default serialization and ffjson.
// The data example is taken from https://dev.twitter.com/rest/reference/get/search/tweets
package benchmark
import (
"io/ioutil"
)
var largeStructText, _ = ioutil.ReadFile("example.json")
var xlStructData XLStruct
func init() {
for i := 0; i < 50; i++ {
xlStructData.Data = append(xlStructData.Data, largeStructData)
}
}
var smallStructText = []byte(`{"hashtags":[{"indices":[5, 10],"text":"some-text"}],"urls":[],"user_mentions":[]}`)
var smallStructData = Entities{
Hashtags: []Hashtag{{Indices: []int{5, 10}, Text: "some-text"}},
Urls: []*string{},
UserMentions: []*string{},
}
type SearchMetadata struct {
CompletedIn float64 `json:"completed_in"`
Count int `json:"count"`
MaxID int64 `json:"max_id"`
MaxIDStr string `json:"max_id_str"`
NextResults string `json:"next_results"`
Query string `json:"query"`
RefreshURL string `json:"refresh_url"`
SinceID int64 `json:"since_id"`
SinceIDStr string `json:"since_id_str"`
}
type Hashtag struct {
Indices []int `json:"indices"`
Text string `json:"text"`
}
//easyjson:json
type Entities struct {
Hashtags []Hashtag `json:"hashtags"`
Urls []*string `json:"urls"`
UserMentions []*string `json:"user_mentions"`
}
type UserEntityDescription struct {
Urls []*string `json:"urls"`
}
type URL struct {
ExpandedURL *string `json:"expanded_url"`
Indices []int `json:"indices"`
URL string `json:"url"`
}
type UserEntityURL struct {
Urls []URL `json:"urls"`
}
type UserEntities struct {
Description UserEntityDescription `json:"description"`
URL UserEntityURL `json:"url"`
}
type User struct {
ContributorsEnabled bool `json:"contributors_enabled"`
CreatedAt string `json:"created_at"`
DefaultProfile bool `json:"default_profile"`
DefaultProfileImage bool `json:"default_profile_image"`
Description string `json:"description"`
Entities UserEntities `json:"entities"`
FavouritesCount int `json:"favourites_count"`
FollowRequestSent *string `json:"follow_request_sent"`
FollowersCount int `json:"followers_count"`
Following *string `json:"following"`
FriendsCount int `json:"friends_count"`
GeoEnabled bool `json:"geo_enabled"`
ID int `json:"id"`
IDStr string `json:"id_str"`
IsTranslator bool `json:"is_translator"`
Lang string `json:"lang"`
ListedCount int `json:"listed_count"`
Location string `json:"location"`
Name string `json:"name"`
Notifications *string `json:"notifications"`
ProfileBackgroundColor string `json:"profile_background_color"`
ProfileBackgroundImageURL string `json:"profile_background_image_url"`
ProfileBackgroundImageURLHTTPS string `json:"profile_background_image_url_https"`
ProfileBackgroundTile bool `json:"profile_background_tile"`
ProfileImageURL string `json:"profile_image_url"`
ProfileImageURLHTTPS string `json:"profile_image_url_https"`
ProfileLinkColor string `json:"profile_link_color"`
ProfileSidebarBorderColor string `json:"profile_sidebar_border_color"`
ProfileSidebarFillColor string `json:"profile_sidebar_fill_color"`
ProfileTextColor string `json:"profile_text_color"`
ProfileUseBackgroundImage bool `json:"profile_use_background_image"`
Protected bool `json:"protected"`
ScreenName string `json:"screen_name"`
ShowAllInlineMedia bool `json:"show_all_inline_media"`
StatusesCount int `json:"statuses_count"`
TimeZone string `json:"time_zone"`
URL *string `json:"url"`
UtcOffset int `json:"utc_offset"`
Verified bool `json:"verified"`
}
type StatusMetadata struct {
IsoLanguageCode string `json:"iso_language_code"`
ResultType string `json:"result_type"`
}
type Status struct {
Contributors *string `json:"contributors"`
Coordinates *string `json:"coordinates"`
CreatedAt string `json:"created_at"`
Entities Entities `json:"entities"`
Favorited bool `json:"favorited"`
Geo *string `json:"geo"`
ID int64 `json:"id"`
IDStr string `json:"id_str"`
InReplyToScreenName *string `json:"in_reply_to_screen_name"`
InReplyToStatusID *string `json:"in_reply_to_status_id"`
InReplyToStatusIDStr *string `json:"in_reply_to_status_id_str"`
InReplyToUserID *string `json:"in_reply_to_user_id"`
InReplyToUserIDStr *string `json:"in_reply_to_user_id_str"`
Metadata StatusMetadata `json:"metadata"`
Place *string `json:"place"`
RetweetCount int `json:"retweet_count"`
Retweeted bool `json:"retweeted"`
Source string `json:"source"`
Text string `json:"text"`
Truncated bool `json:"truncated"`
User User `json:"user"`
}
//easyjson:json
type LargeStruct struct {
SearchMetadata SearchMetadata `json:"search_metadata"`
Statuses []Status `json:"statuses"`
}
//easyjson:json
type XLStruct struct {
Data []LargeStruct
}
|