Documentation
¶
Overview ¶
Copyright (c) 2026 thorsphere. All Rights Reserved. Use is governed with GNU Affero General Public License v3.0 that can be found in the LICENSE file.
Copyright (c) 2026 thorsphere. All Rights Reserved. Use is governed with GNU Affero General Public License v3.0 that can be found in the LICENSE file.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct {
ID int64 `json:"id"` // Unique identifier for the event, e.g., a database primary key or a UUID. It is expected to be set by the database.
Name string `json:"name"` // Name of the economic event, e.g., "Non-Farm Payrolls", "GDP Growth Rate"
Time time.Time `json:"time"` // Date and time of the event in UTC, when the data is released or expected to be released
Country string `json:"country"` // ISO 3166-1 alpha-2 two-letter country code
Actual *float64 `json:"actual"` // Pointer, because it can be nil if the value is not yet released
Estimate *float64 `json:"estimate"` // Pointer, because it can be nil if the value is not yet released
Previous *float64 `json:"previous"` // Pointer, because it can be nil if the value is not yet released
Unit string `json:"unit"` // Unit of measurement for the values, e.g., "%", "K", "M", "B"
Impact ImpactLevel `json:"impact"` // Impact level of the event
Source string `json:"source"` // Source of the data, e.g., "Bloomberg", "Reuters", "Official Government Website"
}
EconomicEvent represents a single calendar event with its details. Thought: Implement a separate package for country codes and use it here for better type safety and validation.
func (*Event) GenerateDocID ¶
GenerateDocID creates a deterministic, safe, unique document ID for NoSQL databases (like Firestore) based on the event's Time, Country, and Name.
func (*Event) NearEqual ¶
NearEqual compares two Event instances for near-equality, taking into account all fields including the pointer fields for Actual, Estimate, and Previous. It does not compare the ID field, as it is expected to be set by the database and may not be the same for two events that are otherwise identical. It returns true if all fields are equal, and false otherwise.
type ImpactLevel ¶
type ImpactLevel int
ImpactLevel represents the expected market impact of an economic event.
const ( ImpactLow ImpactLevel = iota // iota starts at 0, so ImpactLow = 0 ImpactMedium // ImpactMedium = 1 ImpactHigh // ImpactHigh = 2 )
Define constants for the different impact levels.
func (ImpactLevel) String ¶
func (i ImpactLevel) String() string
String returns a string representation of the ImpactLevel.
type Period ¶
type Period struct {
From time.Time // Start date and time of the period
To time.Time // End date and time of the period
}
Period represents a time period with a start and end date.
func NewPeriodForDate ¶
NewPeriodForDate creates a Period that spans the entire given date (00:00:00 to 23:59:59) in UTC.