From b776ebbbf4e9df0342e92cade1eaca98ecf5a05d Mon Sep 17 00:00:00 2001 From: Mudassir Chapra <37051110+muddi900@users.noreply.github.com> Date: Thu, 9 Jan 2025 05:54:16 +0500 Subject: [PATCH 1/2] change type references in README to native types[Issue #341] --- README.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index cef3625..3fb9ae4 100644 --- a/README.md +++ b/README.md @@ -246,20 +246,20 @@ First, you need to define a struct with fields you want to set. Fields should co // list fields you want to set, add `index` tag with field index or tag (for // composite subfields) use the same types from message specification type NetworkManagementRequest struct { - MTI *field.String `index:"0"` - TransmissionDateTime *field.String `index:"7"` - STAN *field.String `index:"11"` - InformationCode *field.String `index:"70"` + MTI string `index:"0"` + TransmissionDateTime string `index:"7"` + STAN string `index:"11"` + InformationCode string `index:"70"` } message := NewMessage(spec) // now, pass data with fields into the message err := message.Marshal(&NetworkManagementRequest{ - MTI: field.NewStringValue("0800"), - TransmissionDateTime: field.NewStringValue(time.Now().UTC().Format("060102150405")), - STAN: field.NewStringValue("000001"), - InformationCode: field.NewStringValue("001"), + MTI: "0800", + TransmissionDateTime: time.Now().UTC().Format("060102150405"), + STAN: "000001", + InformationCode: "001", }) // pack the message and send it to your provider @@ -301,10 +301,10 @@ To get values of multiple fields with their types just pass a pointer to a struc // list fields you want to set, add `index` tag with field index or tag (for // composite subfields) use the same types from message specification type NetworkManagementRequest struct { - MTI *field.String `index:"0"` - TransmissionDateTime *field.String `index:"7"` - STAN *field.String `index:"11"` - InformationCode *field.String `index:"70"` + MTI string `index:"0"` + TransmissionDateTime string `index:"7"` + STAN string `index:"11"` + InformationCode string `index:"70"` } message := NewMessage(spec) From 4419fe7a98187771e2a59d0e7fa3809d66dedfad Mon Sep 17 00:00:00 2001 From: Mudassir Chapra <37051110+muddi900@users.noreply.github.com> Date: Fri, 10 Jan 2025 06:07:43 +0500 Subject: [PATCH 2/2] Removed the `field` methods --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3fb9ae4..ca80d88 100644 --- a/README.md +++ b/README.md @@ -320,10 +320,10 @@ err = message.Unmarshal(data) // handle error // now you can access field values -data.MTI.Value() // "0100" -data.TransmissionDateTime.Value() // "220102103212" -data.STAN.Value() // "000001" -data.InformationCode.Value() // "001" +data.MTI // "0100" +data.TransmissionDateTime // "220102103212" +data.STAN // "000001" +data.InformationCode // "001" ``` For complete code samples please check [./message_test.go](./message_test.go).