-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathlibp2p_join.gen.go
More file actions
192 lines (178 loc) · 8.45 KB
/
Copy pathlibp2p_join.gen.go
File metadata and controls
192 lines (178 loc) · 8.45 KB
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
// Code generated by chgo-rowgen; DO NOT EDIT.
package libp2p
import (
"net"
"github.com/ClickHouse/ch-go/proto"
"github.com/ethpandaops/xatu/pkg/clickhouse/route"
"github.com/ethpandaops/xatu/pkg/proto/xatu"
)
const libp2pJoinTableName route.TableName = "libp2p_join"
type libp2pJoinBatch struct {
UpdatedDateTime proto.ColDateTime
EventDateTime proto.ColDateTime64
TopicLayer proto.ColStr
TopicForkDigestValue proto.ColStr
TopicName proto.ColStr
TopicEncoding proto.ColStr
LocalPeerIDUniqueKey proto.ColInt64
MetaClientName proto.ColStr
MetaClientVersion proto.ColStr
MetaClientImplementation proto.ColStr
MetaClientOS proto.ColStr
MetaClientIP *proto.ColNullable[proto.IPv6]
MetaClientGeoCity proto.ColStr
MetaClientGeoCountry proto.ColStr
MetaClientGeoCountryCode proto.ColStr
MetaClientGeoContinentCode proto.ColStr
MetaClientGeoLongitude *proto.ColNullable[float64]
MetaClientGeoLatitude *proto.ColNullable[float64]
MetaClientGeoAutonomousSystemNumber *proto.ColNullable[uint32]
MetaClientGeoAutonomousSystemOrganization *proto.ColNullable[string]
MetaNetworkName proto.ColStr
rows int
}
func newlibp2pJoinBatch() *libp2pJoinBatch {
return &libp2pJoinBatch{
EventDateTime: func() proto.ColDateTime64 { var c proto.ColDateTime64; c.WithPrecision(proto.Precision(3)); return c }(),
MetaClientIP: new(proto.ColIPv6).Nullable(),
MetaClientGeoLongitude: new(proto.ColFloat64).Nullable(),
MetaClientGeoLatitude: new(proto.ColFloat64).Nullable(),
MetaClientGeoAutonomousSystemNumber: new(proto.ColUInt32).Nullable(),
MetaClientGeoAutonomousSystemOrganization: new(proto.ColStr).Nullable(),
}
}
func (b *libp2pJoinBatch) Rows() int {
return b.rows
}
func (b *libp2pJoinBatch) appendMetadata(event *xatu.DecoratedEvent) {
if event == nil || event.GetMeta() == nil {
b.MetaClientName.Append("")
b.MetaClientVersion.Append("")
b.MetaClientImplementation.Append("")
b.MetaClientOS.Append("")
b.MetaClientIP.Append(proto.Nullable[proto.IPv6]{})
b.MetaClientGeoCity.Append("")
b.MetaClientGeoCountry.Append("")
b.MetaClientGeoCountryCode.Append("")
b.MetaClientGeoContinentCode.Append("")
b.MetaClientGeoLongitude.Append(proto.Nullable[float64]{})
b.MetaClientGeoLatitude.Append(proto.Nullable[float64]{})
b.MetaClientGeoAutonomousSystemNumber.Append(proto.Nullable[uint32]{})
b.MetaClientGeoAutonomousSystemOrganization.Append(proto.Nullable[string]{})
b.MetaNetworkName.Append("")
return
}
b.MetaClientName.Append(event.GetMeta().GetClient().GetName())
b.MetaClientVersion.Append(event.GetMeta().GetClient().GetVersion())
b.MetaClientImplementation.Append(event.GetMeta().GetClient().GetImplementation())
b.MetaClientOS.Append(event.GetMeta().GetClient().GetOs())
b.MetaClientIP.Append(route.NormalizeIPToIPv6Nullable(event.GetMeta().GetServer().GetClient().GetIP()))
b.MetaClientGeoCity.Append(event.GetMeta().GetServer().GetClient().GetGeo().GetCity())
b.MetaClientGeoCountry.Append(event.GetMeta().GetServer().GetClient().GetGeo().GetCountry())
b.MetaClientGeoCountryCode.Append(event.GetMeta().GetServer().GetClient().GetGeo().GetCountryCode())
b.MetaClientGeoContinentCode.Append(event.GetMeta().GetServer().GetClient().GetGeo().GetContinentCode())
b.MetaClientGeoLongitude.Append(proto.NewNullable[float64](event.GetMeta().GetServer().GetClient().GetGeo().GetLongitude()))
b.MetaClientGeoLatitude.Append(proto.NewNullable[float64](event.GetMeta().GetServer().GetClient().GetGeo().GetLatitude()))
b.MetaClientGeoAutonomousSystemNumber.Append(proto.NewNullable[uint32](event.GetMeta().GetServer().GetClient().GetGeo().GetAutonomousSystemNumber()))
b.MetaClientGeoAutonomousSystemOrganization.Append(proto.NewNullable[string](event.GetMeta().GetServer().GetClient().GetGeo().GetAutonomousSystemOrganization()))
b.MetaNetworkName.Append(event.GetMeta().GetClient().GetEthereum().GetNetwork().GetName())
}
func (b *libp2pJoinBatch) Input() proto.Input {
return proto.Input{
{Name: "updated_date_time", Data: &b.UpdatedDateTime},
{Name: "event_date_time", Data: &b.EventDateTime},
{Name: "topic_layer", Data: &b.TopicLayer},
{Name: "topic_fork_digest_value", Data: &b.TopicForkDigestValue},
{Name: "topic_name", Data: &b.TopicName},
{Name: "topic_encoding", Data: &b.TopicEncoding},
{Name: "local_peer_id_unique_key", Data: &b.LocalPeerIDUniqueKey},
{Name: "meta_client_name", Data: &b.MetaClientName},
{Name: "meta_client_version", Data: &b.MetaClientVersion},
{Name: "meta_client_implementation", Data: &b.MetaClientImplementation},
{Name: "meta_client_os", Data: &b.MetaClientOS},
{Name: "meta_client_ip", Data: b.MetaClientIP},
{Name: "meta_client_geo_city", Data: &b.MetaClientGeoCity},
{Name: "meta_client_geo_country", Data: &b.MetaClientGeoCountry},
{Name: "meta_client_geo_country_code", Data: &b.MetaClientGeoCountryCode},
{Name: "meta_client_geo_continent_code", Data: &b.MetaClientGeoContinentCode},
{Name: "meta_client_geo_longitude", Data: b.MetaClientGeoLongitude},
{Name: "meta_client_geo_latitude", Data: b.MetaClientGeoLatitude},
{Name: "meta_client_geo_autonomous_system_number", Data: b.MetaClientGeoAutonomousSystemNumber},
{Name: "meta_client_geo_autonomous_system_organization", Data: b.MetaClientGeoAutonomousSystemOrganization},
{Name: "meta_network_name", Data: &b.MetaNetworkName},
}
}
func (b *libp2pJoinBatch) Reset() {
b.UpdatedDateTime.Reset()
b.EventDateTime.Reset()
b.TopicLayer.Reset()
b.TopicForkDigestValue.Reset()
b.TopicName.Reset()
b.TopicEncoding.Reset()
b.LocalPeerIDUniqueKey.Reset()
b.MetaClientName.Reset()
b.MetaClientVersion.Reset()
b.MetaClientImplementation.Reset()
b.MetaClientOS.Reset()
b.MetaClientIP.Reset()
b.MetaClientGeoCity.Reset()
b.MetaClientGeoCountry.Reset()
b.MetaClientGeoCountryCode.Reset()
b.MetaClientGeoContinentCode.Reset()
b.MetaClientGeoLongitude.Reset()
b.MetaClientGeoLatitude.Reset()
b.MetaClientGeoAutonomousSystemNumber.Reset()
b.MetaClientGeoAutonomousSystemOrganization.Reset()
b.MetaNetworkName.Reset()
b.rows = 0
}
func (b *libp2pJoinBatch) Snapshot() []map[string]any {
n := b.rows
out := make([]map[string]any, n)
for i := 0; i < n; i++ {
row := make(map[string]any, 21)
row["updated_date_time"] = b.UpdatedDateTime.Row(i).Unix()
row["event_date_time"] = b.EventDateTime.Row(i).UnixMilli()
row["topic_layer"] = b.TopicLayer.Row(i)
row["topic_fork_digest_value"] = b.TopicForkDigestValue.Row(i)
row["topic_name"] = b.TopicName.Row(i)
row["topic_encoding"] = b.TopicEncoding.Row(i)
row["local_peer_id_unique_key"] = b.LocalPeerIDUniqueKey.Row(i)
row["meta_client_name"] = b.MetaClientName.Row(i)
row["meta_client_version"] = b.MetaClientVersion.Row(i)
row["meta_client_implementation"] = b.MetaClientImplementation.Row(i)
row["meta_client_os"] = b.MetaClientOS.Row(i)
if v := b.MetaClientIP.Row(i); v.Set {
row["meta_client_ip"] = net.IP(v.Value[:]).String()
} else {
row["meta_client_ip"] = nil
}
row["meta_client_geo_city"] = b.MetaClientGeoCity.Row(i)
row["meta_client_geo_country"] = b.MetaClientGeoCountry.Row(i)
row["meta_client_geo_country_code"] = b.MetaClientGeoCountryCode.Row(i)
row["meta_client_geo_continent_code"] = b.MetaClientGeoContinentCode.Row(i)
if v := b.MetaClientGeoLongitude.Row(i); v.Set {
row["meta_client_geo_longitude"] = v.Value
} else {
row["meta_client_geo_longitude"] = nil
}
if v := b.MetaClientGeoLatitude.Row(i); v.Set {
row["meta_client_geo_latitude"] = v.Value
} else {
row["meta_client_geo_latitude"] = nil
}
if v := b.MetaClientGeoAutonomousSystemNumber.Row(i); v.Set {
row["meta_client_geo_autonomous_system_number"] = v.Value
} else {
row["meta_client_geo_autonomous_system_number"] = nil
}
if v := b.MetaClientGeoAutonomousSystemOrganization.Row(i); v.Set {
row["meta_client_geo_autonomous_system_organization"] = v.Value
} else {
row["meta_client_geo_autonomous_system_organization"] = nil
}
row["meta_network_name"] = b.MetaNetworkName.Row(i)
out[i] = row
}
return out
}