moov-io / iso8583

A golang implementation to marshal and unmarshal iso8583 message.
https://moov.io
Apache License 2.0
304 stars 100 forks source link

Update `Marshal` method for the fields to accept Go native types #279

Closed alovak closed 9 months ago

alovak commented 10 months ago

We want to support Go's native types such as string, int, etc. when we set data to the field using Marshal method

So, the idea is to implement the following:

f := field.NewString(someSpec)

err := f.Marshal("hello")
f.Value() // "hello"

err := f.Marshal(5)
f.Value() // "5"

str := "hello"
err := f.Marshal(&str)
f.Value() // "hello"

i := 5
err := f.Marshal(&i)
f.Value() // "5"

We want to be able to use:

Reference implementation is in this PR: https://github.com/moov-io/iso8583/pull/273/files

alovak commented 9 months ago

closed by #289