Skip to content

Commit

Permalink
Add stringer
Browse files Browse the repository at this point in the history
  • Loading branch information
jutaz committed Apr 9, 2016
1 parent 261c4d4 commit 689aa1e
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func NewInfo(retrievedBytes []byte) *Info {
//read the encryption
encryptionBytes := make([]byte, 4)
byteReader.Read(encryptionBytes)
element.Encryption = info.GetIntegerValue(encryptionBytes)
element.Encryption = RecordEncryption(info.GetIntegerValue(encryptionBytes))

//read the length
lengthBytes := make([]byte, 4)
Expand Down Expand Up @@ -74,7 +74,7 @@ func NewInfo(retrievedBytes []byte) *Info {
//read the encryption
encryptionBytes := make([]byte, 4)
byteReader.Read(encryptionBytes)
element.Encryption = info.GetIntegerValue(encryptionBytes)
element.Encryption = RecordEncryption(info.GetIntegerValue(encryptionBytes))
//read the length
lengthBytes := make([]byte, 4)
byteReader.Read(lengthBytes)
Expand Down
35 changes: 23 additions & 12 deletions src/info_record.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,36 @@ import (
"strconv"
)

// RecordType TODO
//go:generate stringer -type=RecordType
type RecordType int32

// RecordType TODO
//go:generate stringer -type=RecordEncryption
type RecordEncryption int32

const (
// TypeCharString TODO
TypeCharString int32 = 0
TypeCharString RecordType = 0
// TypeIPAddress TODO
TypeIPAddress int32 = 1
TypeIPAddress RecordType = 1
// TypeByteString TODO
TypeByteString int32 = 2
TypeByteString RecordType = 2
// TypePhoneNumber TODO
TypePhoneNumber int32 = 3
TypePhoneNumber RecordType = 3
// TypeUnsignedInteger TODO
TypeUnsignedInteger int32 = 4
TypeUnsignedInteger RecordType = 4
// TypeByte TODO
TypeByte int32 = 5
TypeByte RecordType = 5
// TypeLittleEndianUnsignedInteger TODO
TypeLittleEndianUnsignedInteger int32 = 6
TypeLittleEndianUnsignedInteger RecordType = 6
)

const (
// EncryptionUnencrypted TODO
EncryptionUnencrypted int32 = 0
EncryptionUnencrypted RecordEncryption = 0
// EncryptionEncrypted TODO
EncryptionEncrypted int32 = 2
EncryptionEncrypted RecordEncryption = 2
)

// CipherBytes TODO
Expand All @@ -53,14 +64,14 @@ var CipherBytes = []byte{
type InfoRecord struct {
Tag string
Description string
DataType int32
Encryption int32
DataType RecordType
Encryption RecordEncryption
MaxLength int32
Value []byte
}

// NewInfoRecord TODO
func NewInfoRecord(tag string, description string, dataType int32, encryption int32, maxLength int32, value []byte) *InfoRecord {
func NewInfoRecord(tag string, description string, dataType RecordType, encryption RecordEncryption, maxLength int32, value []byte) *InfoRecord {
airportInfoRecord := &InfoRecord{
Tag: tag,
Description: description,
Expand Down
26 changes: 26 additions & 0 deletions src/recordencryption_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions src/recordtype_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 689aa1e

Please sign in to comment.