Documentation ¶
Index ¶
Constants ¶
const ( CategoryAssisted = "ASSISTED" CategoryBand = "BAND" CategoryMode = "MODE" CategoryOperator = "OPERATOR" CategoryPower = "POWER" CategoryStation = "STATION" CategoryTime = "TIME" CategoryTransmitter = "TRANSMITTER" CategoryOverlay = "OVERLAY" )
Various constants for category names.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address struct { // Maximum of 6 lines Address []string City string StateProvince string PostalCode string Country string }
Address represents someone's physical address.
type CategoryValidationRule ¶
CategoryValidationRule is a rule to validate a category. Some categories have fixed lists of permissible values. This likely needs to be changed into an interface.
func DefaultRules ¶
func DefaultRules() []CategoryValidationRule
DefaultRules tries to capture a default list of rules from the Cabrillo spec definition.
func (*CategoryValidationRule) Evaluate ¶
func (r *CategoryValidationRule) Evaluate(cat Category) error
Evaluate runs the rule annd determines if the specific instance of Catetgory fulfills the rule.
type ExtensibleField ¶
ExtensibleField represents a line prefixed by "X-" in the log other than "X-QSO". Each entry in Values represents a separate line on which the field was found. Thus if you had: X-COMMENT: some comment X-COMMENT: some other comment You would end up with one ExtensibleField with Name="COMMENT" with two entries in Values.
type Log ¶
type Log struct { Address Address CallSign string Categories []Category Certificate bool ClaimedScore int Club string Contest string CreatedBy string Email string ExtensibleFields []ExtensibleField GridLocator string Location string Name string OffTimes []OffTime //TODO: when generating the line, each line is a max of 75 chars long. Use multiple lines. Host station prefixed with `@` Operators []string QSOs []QSO SoapBox []string Version string XQSOs []QSO }
Log is a data structure representing an entire Cabrillo formatted Log file. Data can be parsed into the structure. The long-term plan is to be able to generate a Cabrillo formatted log file from the data structure.
func ParseLog ¶
func ParseLog(r io.Reader, opts ...ParserOption) (Log, error)
ParseLog attempts to parse the data from the reader into a Log structure.
func (*Log) AddCategory ¶
AddCategory adds a category to the existing Log.
func (*Log) AddExtensibleField ¶
AddExtensibleField adds an extenisble field to the existing Log. If the field has been added previously, appends to the existing field.
func (*Log) Category ¶
Category returns the value for the specified category or an empty string if a value has not been specified for that category.
func (*Log) ExtendedField ¶
ExtendedField returns the values for the specified extended field.
type OffTime ¶
OffTime is used to indicate off-time. OFFTIME: 2002-03-22 0300 2002-03-22 0743 yyyy-mm-dd nnnn yyyy-mm-dd nnnn -----begin----- ------end------
type ParserOption ¶
type ParserOption func(*options)
ParserOption is used to customize the log parser.
func WithExchangeFields ¶
func WithExchangeFields(exchangeFields int) ParserOption
WithExchangeFields sets how many space delimited fields to expect in the exchange column.
type QSO ¶
type QSO struct { Frequency string Mode string Timestamp time.Time TxInfo Info RxInfo Info Transmitter int }
QSO represents a contact.