Closed alovak closed 12 months ago
It should be possible to use native types in data structures like this when we extract data from the message into the struct using Unmarshal:
Unmarshal
// define a struct for the authorization request type AuthorizationResponse struct { MTI string `index:"0"` STAN string `index:"11"` // ... } // usage request := &AuthorizationResponse{} message := iso8583.NewMessage(Spec) err := message.Unpack(someBinaryData) // handle error err = message.Unmarshal(request) // handle error // request.MTI => "0110" // request.STAN => "000123"
It should include the following:
Message
field.String
field.Numeric
field.Binary
[]byte
string
*string
field.Hex
the reference implementation is here and it includes update of the message.Unmarshal (src) and field.String/Unmarshal (src):
message.Unmarshal
closed by #291
It should be possible to use native types in data structures like this when we extract data from the message into the struct using
Unmarshal
:It should include the following:
Message
field.String
-> supported target types string, int (+pointers)field.Numeric
-> supported target types string, int (+pointers)field.Binary
-> supported target types are[]byte
,string
,*string
. If target isstring
, we should convert the value into hexfield.Hex
-> same asfield.Binary
the reference implementation is here and it includes update of the
message.Unmarshal
(src) andfield.String
/Unmarshal
(src):