Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrorNilQsl = errors.New("qsl object is nil") ErrorNilQso = errors.New("qso slice object is nil") ErrorNilLoggingStation = errors.New("logging station object is nil") ErrorNilContactedStation = errors.New("contacted station object is nil") ErrorCallEmpty = errors.New("contacted station's call(sign) parameter is empty") ErrorNameEmpty = errors.New("contacted station's name parameter is empty") ErrorCallsignEmpty = errors.New("logging station's stationCallsign parameter is empty") )
Functions ¶
func UnmarshalADI ¶ added in v0.2.0
UnmarshalADI parses the provided ADI data and populates the given Record. data: the ADI data in byte slice format r: pointer to the Record struct to be populated Returns an error if the input Record pointer is nil or if there are issues during unmarshalling NOTES: As a Record object, use json.Marshal to convert the Record object to JSON format and json.Unmarshal to convert the JSON object back to a Record object or another struct with the same tags.
func Validate ¶ added in v0.2.2
func Validate[T interface{}](obj interface{}) error
Validate checks the provided object against the rules defined by the validators in validate. It registers custom validators if they are not already registered. This function is exported and can be used outside the module to validate structs which embed the adifgo structs. Returns an error if validation fails.
Types ¶
type ContactedStation ¶
type ContactedStation struct {
Address string `json:"address,omitempty"`
AddressIntl string `json:"address_intl,omitempty"`
Age string `json:"age,omitempty"`
Altitude string `json:"altitude,omitempty"`
Call string `json:"call" validate:"required,min=3"` // Call: the contacted station's callsign
Cont string `json:"cont,omitempty"` // Cont: the contacted station's Continent
ContactedOP string `json:"contacted_op,omitempty"` // ContactedOP: the callsign of the individual operating the contacted station
Country string `json:"country,omitempty"` // Country: the contacted station's DXCC entity name
CountryIntl string `json:"country_intl,omitempty"` // CountryIntl: the contacted station's DXCC entity name
CQZ string `json:"cqz,omitempty"` // CQZ: the contacted station's CQ Zone in the range 1 to 40 (inclusive)
DarcDok string `json:"darc_dok,omitempty"` // DarcDok: the contacted station's DARC DOK (District Location Code)
DXCC string `json:"dxcc,omitempty"` // DXCC: the contacted station's DXCC Entity Code
Email string `json:"email,omitempty"` // Email: the contacted station's email address
EQCall string `json:"eq_call,omitempty"` // EQCall: the contacted station's owner's callsign
Gridsquare string `json:"gridsquare,omitempty"` // Gridsquare: the contacted station's 2-character, 4-character, 6-character, or 8-character Maidenhead Grid Square
GridsquareExt string `json:"gridsquare_ext,omitempty"` // GridsquareExt:
IOTA string `json:"iota,omitempty"` // IOTA: the contacted station's IOTA designator, in format CC-XXX
IotaIslandID string `json:"iota_island_id,omitempty"` // IotaIslandID: the contacted station's IOTA Island Identifier, an 8-digit integer in the range 1 to 99999999
ITUZ string `json:"ituz,omitempty"` // ITUZ: the contacted station's ITU zone in the range 1 to 90 (inclusive)
Lat string `json:"lat,omitempty"` // Lat: the contacted station's latitude
Lon string `json:"lon,omitempty"` // Lon: the contacted station's longitude
Name string `json:"name" validate:"required,min=2"` // Name: the contacted station's operator's name
NameIntl string `json:"name_intl,omitempty"`
PFX string `json:"pfx,omitempty"`
PotaRef string `json:"pota_ref,omitempty"`
QTH string `json:"qth,omitempty"`
QTHIntl string `json:"qth_intl,omitempty"`
Region string `json:"region,omitempty"`
Rig string `json:"rig,omitempty"`
RigIntl string `json:"rig_intl,omitempty"`
RxPwr string `json:"rx_pwr,omitempty"`
Sig string `json:"sig,omitempty"`
SigIntl string `json:"sig_intl,omitempty"`
SigInfo string `json:"sig_info,omitempty"`
SigInfoIntl string `json:"sig_info_intl,omitempty"`
SotaRef string `json:"sota_ref,omitempty"`
State string `json:"state,omitempty"`
Web string `json:"web,omitempty"`
}
func NewContactedStation ¶
func NewContactedStation(call, name string) (*ContactedStation, error)
NewContactedStation creates a new ContactedStation struct with the provided call and name. Returns error if call or name is empty.
type LoggingStation ¶
type LoggingStation struct {
AntAZ string `json:"ant_az,omitempty"`
AntEL string `json:"ant_el,omitempty"`
BandRX string `json:"band_rx,omitempty"` // BandRX in a split frequency QSO, the logging station's receiving band
FreqRX string `json:"freq_rx,omitempty"` // FreqRX in a split frequency QSO, the logging station's receiving frequency in Megahertz
MyAltitude string `json:"my_altitude,omitempty"`
MyAntenna string `json:"my_antenna,omitempty"`
MyAntennaIntl string `json:"my_antenna_intl,omitempty"`
MyCity string `json:"my_city,omitempty"`
MyCountry string `json:"my_country,omitempty"`
MyCountryIntl string `json:"my_country_intl,omitempty"`
MyCQZone string `json:"my_cq_zone,omitempty"`
MyDXCC string `json:"my_dxcc,omitempty"`
MyGridsquare string `json:"my_gridsquare,omitempty"`
MyGridsquareExt string `json:"my_gridsquare_ext,omitempty"`
MyIOTA string `json:"my_iota,omitempty"`
MyIotaIslandID string `json:"my_iota_island_id,omitempty"`
MyItuZone string `json:"my_itu_zone,omitempty"`
MyLat string `json:"my_lat,omitempty"`
MyLon string `json:"my_lon,omitempty"`
MyName string `json:"my_name"` // Name: the logging operator's name
MyNameIntl string `json:"my_name_intl,omitempty"` // NameIntl: the logging operator's name
MyPostalCode string `json:"my_postal_code,omitempty"`
MyPostalCodeIntl string `json:"my_postal_code_intl,omitempty"`
MyPotaRef string `json:"my_pota_ref,omitempty"`
MyRig string `json:"my_rig,omitempty"`
MyRigIntl string `json:"my_rig_intl,omitempty"`
MySig string `json:"my_sig,omitempty"`
MySigIntl string `json:"my_sig_intl,omitempty"`
MySigInfo string `json:"my_sig_info,omitempty"`
MySigInfoIntl string `json:"my_sig_info_intl,omitempty"`
MySotaRef string `json:"my_sota_ref,omitempty"`
MyState string `json:"my_state,omitempty"`
MyStreet string `json:"my_street,omitempty"`
MyStreetIntl string `json:"my_street_intl,omitempty"`
Notes string `json:"notes,omitempty"`
NotesIntl string `json:"notes_intl,omitempty"`
Operator string `json:"operator,omitempty"` // Operator: the logging operator's callsign if StationCallsign is absent
OwnerCallsign string `json:"owner_callsign,omitempty"`
StationCallsign string `json:"station_callsign" validate:"required"` // StationCallsign: the logging station's callsign (the callsign used over the air). If StationCallsign is absent, Operator shall be treated as both the logging station's callsign and the logging operator's callsign
TxPwr string `json:"tx_pwr,omitempty"`
}
func NewLoggingStation ¶
func NewLoggingStation(stationCallsign string) (*LoggingStation, error)
NewLoggingStation creates a new LoggingStation object with the specified station callsign. Returns an error if the callsign is empty.
type Qsl ¶
type Qsl struct {
QslMsg string `json:"qslmsg,omitempty"`
QslMsgIntl string `json:"qslmsg_intl,omitempty"`
QslRDate string `json:"qslrdate,omitempty"`
QslSDate string `json:"qslsdate,omitempty"`
QslRcvd string `json:"qsl_rcvd" validate:"required,len=1"` // QslRcvd: the QSL received status
QslSent string `json:"qsl_sent" validate:"required,len=1"` // QslSent: the QSL sent status
QslSentVia string `json:"qsl_sent_via,omitempty"`
QslVia string `json:"qsl_via,omitempty"`
}
type Qso ¶
type Qso struct {
*ContactedStation
*LoggingStation
*Qsl
AntPath string `json:"ant_path,omitempty"`
AntSect string `json:"ant_sect,omitempty"`
AIndex string `json:"a_index,omitempty"`
Band string `json:"band" validate:"band-check" errormsg:"Invalid band"` // Band: the QSO band
Comment string `json:"comment,omitempty"`
CommentIntl string `json:"comment_intl,omitempty"`
Distance string `json:"distance,omitempty"`
Freq string `json:"freq" validate:"freqency-check" errormsg:"Invalid frequency"` // Freq: QSO frequency in Megahertz
KIndex string `json:"k_index,omitempty"`
Mode string `json:"mode" validate:"mode-check" errormsg:"Invalid mode"` // Mode: the QSO mode
QsoComplete string `json:"qso_complete,omitempty"`
QsoDate string `json:"qso_date" validate:"required,len=8,numeric"` // QsoDate: the QSO date in the format YYYYMMDD
QsoDateOff string `json:"qso_date_off,omitempty"`
QsoRandom string `json:"qso_random,omitempty"`
RstRcvd string `json:"rst_rcvd" validate:"required,min=2,max=3,numeric"` // RstRcvd: the RST code received
RstSent string `json:"rst_sent" validate:"required,min=2,max=3,numeric"` // RstSent: the RST code sent
TimeOff string `json:"time_off,omitempty"`
TimeOn string `json:"time_on" validate:"required,len=4,numeric"` // TimeOn: the QSO time in the format HHMM
}
func NewQso ¶
NewQso creates a new Qso object populated with the given data, which is the minimum required for a valid QSO in the opinion of this module.
func (*Qso) ADIQsoString ¶ added in v0.2.0
ADIQsoString returns the ADI string representation of the Qso object
func (*Qso) SetContactedStation ¶
func (q *Qso) SetContactedStation(ptr *ContactedStation) error
func (*Qso) SetLoggingStation ¶
func (q *Qso) SetLoggingStation(ptr *LoggingStation) error
type Record ¶
type Record struct {
ADIFVer string `json:"adif_ver"` // ADIFVer: the ADIF version number
CreatedTimestamp string `json:"created_timestamp"` // CreatedTimestamp: the timestamp when the ADIF file was created
ProgramID string `json:"programid"` // ProgramID: the name of the logging program
ProgramVersion string `json:"programversion"` // ProgramVersion: the version of the logging program
QsoSlice `validate:"required" errormsg:"QSOS slice is required"`
}