Documentation ¶
Overview ¶
Package adif defines basic types (Field, Record, Logfile) for working with amateur radio logs in ADIF format. It also defines I/O types which can read and write ADIF data in several formats, including the ADIF-specified ADI and ADX formats as well as CSV and JSON. The adif package does not have any code dealing with specific fields or enumerations defined by specification; see the adif/spec package for such code.
Index ¶
- Variables
- func FormatNames() []string
- func SeparatorNames() []string
- type ADIIO
- type ADXIO
- type CSVIO
- type CabrilloIO
- type DataType
- type Field
- type Format
- type JSONIO
- type Logfile
- type ReadWriter
- type Reader
- type Record
- func (r *Record) Empty() bool
- func (r *Record) Equal(o *Record) bool
- func (r *Record) Fields() []Field
- func (r *Record) Get(name string) (f Field, ok bool)
- func (r *Record) GetComment() string
- func (r *Record) ParseBool(name string) (bool, error)
- func (r *Record) ParseDate(name string) (time.Time, error)
- func (r *Record) ParseFloat(name string) (float64, error)
- func (r *Record) ParseInt(name string) (int, error)
- func (r *Record) ParseTime(name string) (time.Time, error)
- func (r *Record) Set(f Field) error
- func (r *Record) SetComment(c string)
- func (r *Record) String() string
- type Separator
- type TSVIO
- type UserdefField
- type Writer
Constants ¶
This section is empty.
Variables ¶
var ( // Allowed values for Cabrillo categories. // See https://wwrof.org/cabrillo/cabrillo-v3-header/ CabrilloCategoryValues = map[string][]string{ "ASSISTED": {"ASSISTED", "NON-ASSISTED"}, "BAND": { "ALL", "160M", "80M", "40M", "20M", "15M", "10M", "6M", "4M", "2M", "222", "432", "902", "1.2G", "2.3G", "3.4G", "5.7G", "10G", "24G", "47G", "75G", "122G", "134G", "241G", "LIGHT", "VHF-3-BAND", "VHF-FM-ONLY", }, "MODE": {"CW", "DIGI", "FM", "RTTY", "SSB", "MIXED"}, "OPERATOR": {"SINGLE-OP", "MULTI-OP", "CHECKLOG"}, "OVERLAY": {"CLASSIC", "ROOKIE", "TB-WIRES", "YOUTH", "NOVICE-TECH", "YL"}, "POWER": {"HIGH", "LOW", "QRP"}, "STATION": { "DISTRIBUTED", "FIXED", "MOBILE", "PORTABLE", "ROVER", "ROVER-LIMITED", "ROVER-UNLIMITED", "EXPEDITION", "HQ", "SCHOOL", "EXPLORER", }, "TIME": {"6-HOURS", "8-HOURS", "12-HOURS", "24-HOURS"}, "TRANSMITTER": {"ONE", "TWO", "LIMITED", "UNLIMITED", "SWL"}, } )
var ErrInvalidFormat = fmt.Errorf("not a valid Format, try [%s]", strings.Join(_FormatNames, ", "))
var ErrInvalidSeparator = fmt.Errorf("not a valid Separator, try [%s]", strings.Join(_SeparatorNames, ", "))
Functions ¶
func FormatNames ¶
func FormatNames() []string
FormatNames returns a list of possible string values of Format.
func SeparatorNames ¶
func SeparatorNames() []string
SeparatorNames returns a list of possible string values of Separator.
Types ¶
type ADIIO ¶
type CSVIO ¶
type CabrilloIO ¶ added in v0.1.9
type CabrilloIO struct {
Callsign, Contest, Club, CreatedBy, Email,
GridLocator, Location, Name, Address, Soapbox, MyExchange string
Operators []string
LowPowerMax, QRPPowerMax int
MinReportedOfftime time.Duration
Categories map[string]string
TheirExchangeField, MyExchangeField string
}
CabrilloIO configures the headers and QSO inference for conversion to and from the Cabrillo format. Most fields configure the value of a header with the same name. Categories maps CATEGORY header names to value, e.g. "TIME" to "6-HOURS". See https://wwrof.org/cabrillo/cabrillo-v3-header/ for details about header values.
func NewCabrilloIO ¶ added in v0.1.9
func NewCabrilloIO() *CabrilloIO
func (*CabrilloIO) String ¶ added in v0.1.9
func (_ *CabrilloIO) String() string
type Field ¶
func (Field) IsAppDefined ¶
type Format ¶
type Format string
ENUM(ADI, ADX, Cabrillo, CSV, JSON, TSV)
const ( // FormatADI is a Format of type ADI. FormatADI Format = "ADI" // FormatADX is a Format of type ADX. FormatADX Format = "ADX" // FormatCabrillo is a Format of type Cabrillo. FormatCabrillo Format = "Cabrillo" // FormatCSV is a Format of type CSV. FormatCSV Format = "CSV" // FormatJSON is a Format of type JSON. FormatJSON Format = "JSON" // FormatTSV is a Format of type TSV. FormatTSV Format = "TSV" )
func GuessFormatFromContent ¶
GuessFormatFromContent inspects the beginning bytes of r to guess which Format the data is in. Returns Format("") and an error if no heuristic matched the content.
func GuessFormatFromName ¶
GuessFormatFromName guesses a file's Format based on its extension. If filename doesn't match any known format, Format("") and an error are returned.
func ParseFormat ¶
ParseFormat attempts to convert a string to a Format.
func (*Format) Get ¶
func (x *Format) Get() interface{}
Get implements the Golang flag.Getter interface func.
type Logfile ¶
type Logfile struct { Records []*Record Header *Record Userdef []UserdefField Comment string Filename string FieldOrder []string }
func NewLogfile ¶
func NewLogfile() *Logfile
func (*Logfile) AddUserdef ¶
func (f *Logfile) AddUserdef(u UserdefField) error
func (*Logfile) GetUserdef ¶
func (f *Logfile) GetUserdef(name string) (UserdefField, bool)
type Record ¶
type Record struct {
// contains filtered or unexported fields
}
func (*Record) Equal ¶
Equal compares two records for equality of fields, ignoring order and comments. Records are considered equal even if one has assigned empty fields while the other does not have a field of that name set.
func (*Record) GetComment ¶
func (*Record) ParseFloat ¶ added in v0.1.9
func (*Record) SetComment ¶
type Separator ¶
type Separator int
ENUM(empty, space, tab, newline, 2newline, crlf, 2crlf)
const ( // SeparatorEmpty is a Separator of type Empty. SeparatorEmpty Separator = iota // SeparatorSpace is a Separator of type Space. SeparatorSpace // SeparatorTab is a Separator of type Tab. SeparatorTab // SeparatorNewline is a Separator of type Newline. SeparatorNewline // Separator2Newline is a Separator of type 2Newline. Separator2Newline // SeparatorCrlf is a Separator of type Crlf. SeparatorCrlf // Separator2Crlf is a Separator of type 2Crlf. Separator2Crlf )
func ParseSeparator ¶
ParseSeparator attempts to convert a string to a Separator.
func (*Separator) Get ¶
func (x *Separator) Get() interface{}
Get implements the Golang flag.Getter interface func.
type UserdefField ¶
func (UserdefField) String ¶
func (u UserdefField) String() string
func (UserdefField) Validate ¶
func (u UserdefField) Validate(f Field) error
func (UserdefField) ValidateSelf ¶
func (u UserdefField) ValidateSelf() error
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package spec contains data types, field definitions, and enumerations defined by the ADIF specification from https://adif.org.uk/ Most structures in this package are automatically generated.
|
Package spec contains data types, field definitions, and enumerations defined by the ADIF specification from https://adif.org.uk/ Most structures in this package are automatically generated. |
countrystats
countrystats prints miscellaneous information about DXCC entities and ISO 3166-1 codes, particularly highlighting potential problems.
|
countrystats prints miscellaneous information about DXCC entities and ISO 3166-1 codes, particularly highlighting potential problems. |