This commit is contained in:
2026-06-06 14:16:30 +02:00
parent f91f9ff3b8
commit 17f7a00bd7
19 changed files with 1278 additions and 91 deletions
+110 -4
View File
@@ -156,8 +156,42 @@ type QSO struct {
Comment string `json:"comment,omitempty"`
Notes string `json:"notes,omitempty"`
// --- ADIF 3.1.7 additional promoted fields ---
// Kept in one block so columnList / args() / scanQSO stay trivially in
// sync (they are appended at the end, before extras_json).
SIG string `json:"sig,omitempty"`
SIGInfo string `json:"sig_info,omitempty"`
MySIG string `json:"my_sig,omitempty"`
MySIGInfo string `json:"my_sig_info,omitempty"`
WWFFRef string `json:"wwff_ref,omitempty"`
MyWWFFRef string `json:"my_wwff_ref,omitempty"`
Distance *float64 `json:"distance,omitempty"`
RXPower *float64 `json:"rx_pwr,omitempty"`
AIndex *float64 `json:"a_index,omitempty"`
KIndex *float64 `json:"k_index,omitempty"`
SFI *float64 `json:"sfi,omitempty"`
SKCC string `json:"skcc,omitempty"`
FISTS string `json:"fists,omitempty"`
TenTen string `json:"ten_ten,omitempty"`
ContactedOp string `json:"contacted_op,omitempty"`
EqCall string `json:"eq_call,omitempty"`
PFX string `json:"pfx,omitempty"`
MyName string `json:"my_name,omitempty"`
Class string `json:"class,omitempty"`
DarcDOK string `json:"darc_dok,omitempty"`
MyDarcDOK string `json:"my_darc_dok,omitempty"`
Region string `json:"region,omitempty"`
SilentKey string `json:"silent_key,omitempty"`
SWL string `json:"swl,omitempty"`
QSOComplete string `json:"qso_complete,omitempty"`
QSORandom string `json:"qso_random,omitempty"`
CreditGranted string `json:"credit_granted,omitempty"`
CreditSubmitted string `json:"credit_submitted,omitempty"`
MyARRLSect string `json:"my_arrl_sect,omitempty"`
MyVUCCGrids string `json:"my_vucc_grids,omitempty"`
// Extras holds ADIF fields not promoted to columns. Keys are uppercase
// ADIF field names (e.g. "DARC_DOK"); values are the raw string content.
// ADIF field names (e.g. "MS_SHOWER"); values are the raw string content.
Extras map[string]string `json:"extras,omitempty"`
CreatedAt time.Time `json:"created_at"`
@@ -205,7 +239,13 @@ const columnList = `callsign, qso_date, qso_date_off, band, band_rx, mode, submo
station_callsign, operator, my_grid, my_gridsquare_ext, my_country, my_state, my_cnty, my_iota,
my_sota_ref, my_pota_ref, my_dxcc, my_cq_zone, my_itu_zone, my_lat, my_lon,
my_street, my_city, my_postal_code, my_rig, my_antenna,
tx_pwr, comment, notes, extras_json`
tx_pwr, comment, notes,
sig, sig_info, my_sig, my_sig_info, wwff_ref, my_wwff_ref,
distance, rx_pwr, a_index, k_index, sfi,
skcc, fists, ten_ten, contacted_op, eq_call, pfx, my_name, class,
darc_dok, my_darc_dok, region, silent_key, swl, qso_complete, qso_random,
credit_granted, credit_submitted, my_arrl_sect, my_vucc_grids,
extras_json`
const selectCols = `id, ` + columnList + `, created_at, updated_at`
@@ -258,7 +298,13 @@ func (q *QSO) args() []any {
q.StationCallsign, q.Operator, q.MyGrid, q.MyGridExt, q.MyCountry, q.MyState, q.MyCounty, q.MyIOTA,
q.MySOTARef, q.MyPOTARef, q.MyDXCC, q.MyCQZone, q.MyITUZone, q.MyLat, q.MyLon,
q.MyStreet, q.MyCity, q.MyPostalCode, q.MyRig, q.MyAntenna,
q.TXPower, q.Comment, q.Notes, extras,
q.TXPower, q.Comment, q.Notes,
q.SIG, q.SIGInfo, q.MySIG, q.MySIGInfo, q.WWFFRef, q.MyWWFFRef,
q.Distance, q.RXPower, q.AIndex, q.KIndex, q.SFI,
q.SKCC, q.FISTS, q.TenTen, q.ContactedOp, q.EqCall, q.PFX, q.MyName, q.Class,
q.DarcDOK, q.MyDarcDOK, q.Region, q.SilentKey, q.SWL, q.QSOComplete, q.QSORandom,
q.CreditGranted, q.CreditSubmitted, q.MyARRLSect, q.MyVUCCGrids,
extras,
}
}
@@ -1472,6 +1518,15 @@ func scanQSO(s scanner) (QSO, error) {
myRig, myAntenna sql.NullString
txp sql.NullFloat64
comment, notes sql.NullString
sig, sigInfo, mySig, mySigInfo sql.NullString
wwffRef, myWWFFRef sql.NullString
distance, rxPwr, aIndex, kIndex, sfi sql.NullFloat64
skcc, fists, tenTen sql.NullString
contactedOp, eqCall, pfx, myName sql.NullString
class, darcDOK, myDarcDOK, region sql.NullString
silentKey, swl, qsoComplete, qsoRandom sql.NullString
creditGranted, creditSubmitted sql.NullString
myARRLSect, myVUCCGrids sql.NullString
extrasJSON sql.NullString
createdStr, updatedStr string
)
@@ -1494,7 +1549,13 @@ func scanQSO(s scanner) (QSO, error) {
&stCall, &op, &myGrid, &myGridExt, &myCountry, &myState, &myCnty, &myIOTA,
&mySOTA, &myPOTA, &myDXCC, &myCQZ, &myITUZ, &myLat, &myLon,
&myStreet, &myCity, &myPostal, &myRig, &myAntenna,
&txp, &comment, &notes, &extrasJSON, &createdStr, &updatedStr,
&txp, &comment, &notes,
&sig, &sigInfo, &mySig, &mySigInfo, &wwffRef, &myWWFFRef,
&distance, &rxPwr, &aIndex, &kIndex, &sfi,
&skcc, &fists, &tenTen, &contactedOp, &eqCall, &pfx, &myName, &class,
&darcDOK, &myDarcDOK, &region, &silentKey, &swl, &qsoComplete, &qsoRandom,
&creditGranted, &creditSubmitted, &myARRLSect, &myVUCCGrids,
&extrasJSON, &createdStr, &updatedStr,
); err != nil {
return QSO{}, fmt.Errorf("scan qso: %w", err)
}
@@ -1645,6 +1706,51 @@ func scanQSO(s scanner) (QSO, error) {
}
q.Comment = comment.String
q.Notes = notes.String
q.SIG = sig.String
q.SIGInfo = sigInfo.String
q.MySIG = mySig.String
q.MySIGInfo = mySigInfo.String
q.WWFFRef = wwffRef.String
q.MyWWFFRef = myWWFFRef.String
if distance.Valid {
v := distance.Float64
q.Distance = &v
}
if rxPwr.Valid {
v := rxPwr.Float64
q.RXPower = &v
}
if aIndex.Valid {
v := aIndex.Float64
q.AIndex = &v
}
if kIndex.Valid {
v := kIndex.Float64
q.KIndex = &v
}
if sfi.Valid {
v := sfi.Float64
q.SFI = &v
}
q.SKCC = skcc.String
q.FISTS = fists.String
q.TenTen = tenTen.String
q.ContactedOp = contactedOp.String
q.EqCall = eqCall.String
q.PFX = pfx.String
q.MyName = myName.String
q.Class = class.String
q.DarcDOK = darcDOK.String
q.MyDarcDOK = myDarcDOK.String
q.Region = region.String
q.SilentKey = silentKey.String
q.SWL = swl.String
q.QSOComplete = qsoComplete.String
q.QSORandom = qsoRandom.String
q.CreditGranted = creditGranted.String
q.CreditSubmitted = creditSubmitted.String
q.MyARRLSect = myARRLSect.String
q.MyVUCCGrids = myVUCCGrids.String
q.Extras = decodeExtras(extrasJSON.String)
return q, nil
}