Files
beacon-server/db/sqlc/models.go
T
MrAlders0n 91b4b457b5 perf(db): resolve packet endpoints at read time (#163)
Storing a full candidate snapshot on every observation was the wrong call. The same node lists got copied thousands of times, about 22 GB on prod. Resolve endpoints live like path hops and drop the column.
2026-09-25 13:59:07 -04:00

374 lines
15 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.31.1
package db
import (
"github.com/google/uuid"
"github.com/jackc/pgx/v5/pgtype"
)
type Account struct {
ID uuid.UUID `json:"id"`
Name string `json:"name"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
DeactivatedAt pgtype.Timestamptz `json:"deactivated_at"`
}
type Channel struct {
ID int32 `json:"id"`
ChannelHash []byte `json:"channel_hash"`
KeyFingerprint []byte `json:"key_fingerprint"`
Name *string `json:"name"`
Hashtag *string `json:"hashtag"`
IsHashtag *bool `json:"is_hashtag"`
IsPublic *bool `json:"is_public"`
KeyKnown *bool `json:"key_known"`
FirstSeen pgtype.Timestamptz `json:"first_seen"`
LastSeen pgtype.Timestamptz `json:"last_seen"`
MessageCount *int64 `json:"message_count"`
}
type ChannelIata struct {
ChannelHash []byte `json:"channel_hash"`
Iata string `json:"iata"`
LastHeard pgtype.Timestamptz `json:"last_heard"`
}
type ChannelKey struct {
ChannelID int32 `json:"channel_id"`
KeyBytes []byte `json:"key_bytes"`
KeyFingerprint []byte `json:"key_fingerprint"`
AddedAt pgtype.Timestamptz `json:"added_at"`
AddedBy *string `json:"added_by"`
}
type ChannelMessage struct {
ID int64 `json:"id"`
ChannelID int32 `json:"channel_id"`
PacketHash []byte `json:"packet_hash"`
SenderName *string `json:"sender_name"`
SenderPubkey []byte `json:"sender_pubkey"`
Content *string `json:"content"`
SentAt pgtype.Timestamptz `json:"sent_at"`
}
type IataCode struct {
Iata string `json:"iata"`
DisplayName *string `json:"display_name"`
ApproxLat *float64 `json:"approx_lat"`
ApproxLng *float64 `json:"approx_lng"`
AddedAt pgtype.Timestamptz `json:"added_at"`
Border []byte `json:"border"`
}
type KnownRoute struct {
ID int64 `json:"id"`
PathKey []byte `json:"path_key"`
NodeIds []uuid.UUID `json:"node_ids"`
HashPrefix [][]byte `json:"hash_prefix"`
Iata string `json:"iata"`
HopCount int32 `json:"hop_count"`
FirstSeen pgtype.Timestamptz `json:"first_seen"`
LastSeen pgtype.Timestamptz `json:"last_seen"`
ObservationCount int64 `json:"observation_count"`
LastReconfirmedAt pgtype.Timestamptz `json:"last_reconfirmed_at"`
}
type MvHourlyIataStat struct {
Iata string `json:"iata"`
Hour pgtype.Timestamptz `json:"hour"`
ObservationCount int64 `json:"observation_count"`
UniquePackets int64 `json:"unique_packets"`
ActiveObservers int64 `json:"active_observers"`
}
type MvObserverActivityHourly struct {
ObserverID uuid.UUID `json:"observer_id"`
PayloadType *int16 `json:"payload_type"`
Bucket pgtype.Timestamptz `json:"bucket"`
Observations int64 `json:"observations"`
AirtimeMs float32 `json:"airtime_ms"`
AirtimeN int64 `json:"airtime_n"`
SnrSum float32 `json:"snr_sum"`
SnrN int64 `json:"snr_n"`
SnrMin float32 `json:"snr_min"`
RssiSum int64 `json:"rssi_sum"`
RssiN int64 `json:"rssi_n"`
}
type MvPathStatsHourly struct {
Iata string `json:"iata"`
Hour interface{} `json:"hour"`
Category int32 `json:"category"`
HashBytes int32 `json:"hash_bytes"`
Entries int32 `json:"entries"`
Receptions int64 `json:"receptions"`
}
type MvPayloadBreakdownByIatum struct {
Iata string `json:"iata"`
PayloadType *int16 `json:"payload_type"`
Bucket pgtype.Timestamptz `json:"bucket"`
Count int64 `json:"count"`
}
type MvRadioPreset struct {
Preset string `json:"preset"`
Iata string `json:"iata"`
SourceType string `json:"source_type"`
Count int64 `json:"count"`
}
type MvSignalStatsHourly struct {
Iata string `json:"iata"`
Hour interface{} `json:"hour"`
Kind int32 `json:"kind"`
SnrBin int32 `json:"snr_bin"`
RssiBin int32 `json:"rssi_bin"`
Receptions int64 `json:"receptions"`
SnrSamples int64 `json:"snr_samples"`
SnrSum float64 `json:"snr_sum"`
RssiSamples int64 `json:"rssi_samples"`
RssiSum float64 `json:"rssi_sum"`
}
type MvTopAdvertisersByIatum struct {
Iata string `json:"iata"`
NodeID uuid.UUID `json:"node_id"`
Name *string `json:"name"`
NodeType int16 `json:"node_type"`
Bucket pgtype.Timestamptz `json:"bucket"`
AdvertCount int64 `json:"advert_count"`
FloodAdvertCount int64 `json:"flood_advert_count"`
DirectAdvertCount int64 `json:"direct_advert_count"`
LastHeard interface{} `json:"last_heard"`
}
type MvTopNodesByIatum struct {
Iata string `json:"iata"`
NodeID uuid.UUID `json:"node_id"`
Name *string `json:"name"`
NodeType int16 `json:"node_type"`
ObservationCount *int64 `json:"observation_count"`
LastHeard pgtype.Timestamptz `json:"last_heard"`
}
type MvTopObserversByIatum struct {
Iata string `json:"iata"`
ObserverID uuid.UUID `json:"observer_id"`
DisplayName *string `json:"display_name"`
ObserverType *string `json:"observer_type"`
Bucket pgtype.Timestamptz `json:"bucket"`
ObservationCount int64 `json:"observation_count"`
}
type MvTopTalkersByIatum struct {
Iata string `json:"iata"`
SenderName *string `json:"sender_name"`
Bucket pgtype.Timestamptz `json:"bucket"`
MessageCount int64 `json:"message_count"`
LastSent interface{} `json:"last_sent"`
}
type Node struct {
ID uuid.UUID `json:"id"`
PublicKey []byte `json:"public_key"`
NodeType int16 `json:"node_type"`
Name *string `json:"name"`
Latitude *float64 `json:"latitude"`
Longitude *float64 `json:"longitude"`
LocationSource *string `json:"location_source"`
LastAdvertAt pgtype.Timestamptz `json:"last_advert_at"`
SupportsMultibytePaths bool `json:"supports_multibyte_paths"`
SupportsMultibyteTraces bool `json:"supports_multibyte_traces"`
DefaultScopeID *int32 `json:"default_scope_id"`
MinFirmwareVersion *string `json:"min_firmware_version"`
FirstSeen pgtype.Timestamptz `json:"first_seen"`
LastSeen pgtype.Timestamptz `json:"last_seen"`
RadioFreqMhz *float32 `json:"radio_freq_mhz"`
RadioSf *int16 `json:"radio_sf"`
RadioBwKhz *float32 `json:"radio_bw_khz"`
Metadata []byte `json:"metadata"`
DeviceClockDriftSeconds *int32 `json:"device_clock_drift_seconds"`
}
type NodeIata struct {
NodeID uuid.UUID `json:"node_id"`
Iata string `json:"iata"`
FirstHeard pgtype.Timestamptz `json:"first_heard"`
LastHeard pgtype.Timestamptz `json:"last_heard"`
ObservationCount *int64 `json:"observation_count"`
}
type NodeNeighbor struct {
NodeID uuid.UUID `json:"node_id"`
NeighborID uuid.UUID `json:"neighbor_id"`
Iata string `json:"iata"`
FirstSeen pgtype.Timestamptz `json:"first_seen"`
LastSeen pgtype.Timestamptz `json:"last_seen"`
ObservationCount int64 `json:"observation_count"`
Snr *float32 `json:"snr"`
RegionScope *string `json:"region_scope"`
}
type NodeShortID struct {
NodeID uuid.UUID `json:"node_id"`
Iata string `json:"iata"`
Prefix4 []byte `json:"prefix_4"`
Prefix1 []byte `json:"prefix_1"`
Prefix2 []byte `json:"prefix_2"`
Prefix3 []byte `json:"prefix_3"`
}
type Observer struct {
ID uuid.UUID `json:"id"`
PublicKey []byte `json:"public_key"`
DisplayName *string `json:"display_name"`
ObserverType *string `json:"observer_type"`
SoftwareVersion *string `json:"software_version"`
HardwareModel *string `json:"hardware_model"`
FirmwareVersion *string `json:"firmware_version"`
FirmwareBuild *string `json:"firmware_build"`
RadioFreqMhz *float32 `json:"radio_freq_mhz"`
RadioSf *int16 `json:"radio_sf"`
RadioBwKhz *float32 `json:"radio_bw_khz"`
RadioCr *int16 `json:"radio_cr"`
BatteryLevel *float32 `json:"battery_level"`
UptimeSeconds *int64 `json:"uptime_seconds"`
StatusMetadata []byte `json:"status_metadata"`
LastStatusAt pgtype.Timestamptz `json:"last_status_at"`
FirstSeen pgtype.Timestamptz `json:"first_seen"`
LastSeen pgtype.Timestamptz `json:"last_seen"`
ObservationCount *int64 `json:"observation_count"`
Metadata []byte `json:"metadata"`
RegionScope *string `json:"region_scope"`
}
type ObserverBroker struct {
ObserverID uuid.UUID `json:"observer_id"`
BrokerName string `json:"broker_name"`
FirstSeen pgtype.Timestamptz `json:"first_seen"`
LastSeen pgtype.Timestamptz `json:"last_seen"`
LastPacketAt pgtype.Timestamptz `json:"last_packet_at"`
AuthOk *bool `json:"auth_ok"`
}
type ObserverLocation struct {
ObserverID uuid.UUID `json:"observer_id"`
Iata *string `json:"iata"`
Latitude *float64 `json:"latitude"`
Longitude *float64 `json:"longitude"`
ReportedAt pgtype.Timestamptz `json:"reported_at"`
}
type ObserverOwner struct {
ObserverID uuid.UUID `json:"observer_id"`
OwnerNodeID pgtype.UUID `json:"owner_node_id"`
OwnerPubkey []byte `json:"owner_pubkey"`
ContactName *string `json:"contact_name"`
ContactEmail *string `json:"contact_email"`
Notes *string `json:"notes"`
Source *string `json:"source"`
AddedAt pgtype.Timestamptz `json:"added_at"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
}
type ObserverScope struct {
ObserverID uuid.UUID `json:"observer_id"`
ScopeID int32 `json:"scope_id"`
FirstSeen pgtype.Timestamptz `json:"first_seen"`
LastSeen pgtype.Timestamptz `json:"last_seen"`
}
type ObserverTelemetry struct {
ID int64 `json:"id"`
ObserverID uuid.UUID `json:"observer_id"`
ReportedAt pgtype.Timestamptz `json:"reported_at"`
BatteryVoltageMv *int32 `json:"battery_voltage_mv"`
AirtimeTxSecs *float32 `json:"airtime_tx_secs"`
AirtimeRxSecs *float32 `json:"airtime_rx_secs"`
NoiseFloorDb *float32 `json:"noise_floor_db"`
UptimeSeconds *int64 `json:"uptime_seconds"`
QueueLength *int32 `json:"queue_length"`
DebugFlags *int32 `json:"debug_flags"`
ReceiveErrors *int32 `json:"receive_errors"`
}
type Packet struct {
PacketHash []byte `json:"packet_hash"`
PayloadType int16 `json:"payload_type"`
PayloadVersion int16 `json:"payload_version"`
RouteType int16 `json:"route_type"`
TransportCodesPresent *bool `json:"transport_codes_present"`
RegionCode *int32 `json:"region_code"`
SubRegionCode *int32 `json:"sub_region_code"`
ScopeID *int32 `json:"scope_id"`
OriginPubkey []byte `json:"origin_pubkey"`
RawPayload []byte `json:"raw_payload"`
RawHeader []byte `json:"raw_header"`
ParsedPayload []byte `json:"parsed_payload"`
Decrypted *bool `json:"decrypted"`
ChannelHash []byte `json:"channel_hash"`
TraceTag []byte `json:"trace_tag"`
FirstHeardAt pgtype.Timestamptz `json:"first_heard_at"`
LastHeardAt pgtype.Timestamptz `json:"last_heard_at"`
}
type PacketObservation struct {
ID int64 `json:"id"`
PacketHash []byte `json:"packet_hash"`
ObserverID uuid.UUID `json:"observer_id"`
Iata string `json:"iata"`
HeardAt pgtype.Timestamptz `json:"heard_at"`
PathLengthByte int16 `json:"path_length_byte"`
HashSize int16 `json:"hash_size"`
HopCount int16 `json:"hop_count"`
PathBytes []byte `json:"path_bytes"`
Rssi *int16 `json:"rssi"`
Snr *float32 `json:"snr"`
PropagationTimeMs *int32 `json:"propagation_time_ms"`
RadioFreqMhz *float32 `json:"radio_freq_mhz"`
SpreadFactor *int16 `json:"spread_factor"`
BandwidthKhz *float32 `json:"bandwidth_khz"`
CodingRate *int16 `json:"coding_rate"`
SourceBroker *string `json:"source_broker"`
PayloadType *int16 `json:"payload_type"`
AirtimeMs *float32 `json:"airtime_ms"`
}
type Region struct {
ID int32 `json:"id"`
Slug string `json:"slug"`
Name string `json:"name"`
Description *string `json:"description"`
DisplayOrder *int32 `json:"display_order"`
CenterLat *float64 `json:"center_lat"`
CenterLng *float64 `json:"center_lng"`
ZoomLevel *int32 `json:"zoom_level"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
}
type RegionIata struct {
RegionID int32 `json:"region_id"`
Iata string `json:"iata"`
AddedAt pgtype.Timestamptz `json:"added_at"`
}
type TraceIata struct {
TraceTag []byte `json:"trace_tag"`
Iata string `json:"iata"`
LastHeard pgtype.Timestamptz `json:"last_heard"`
}
type TransportScope struct {
ID int32 `json:"id"`
Name string `json:"name"`
DisplayName *string `json:"display_name"`
TransportKey []byte `json:"transport_key"`
KeyFingerprint []byte `json:"key_fingerprint"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
}