Skip to content

Conversation

@alovak
Copy link
Contributor

@alovak alovak commented Nov 22, 2025

This PR introduces path-based operations for accessing and manipulating fields and subfields in ISO 8583 messages using dot notation (e.g., "3.2.1" or "11.1").

New interfaces:

  • field.PathMarshaler - marshal field values by path
  • field.PathUnmarshaler - unmarshal field values by path
  • field.PathUnsetter - unset fields by path

Changes:

  • Added MarshalPath(path string, value any) to Message and Composite - sets field values using path notation
  • Added UnmarshalPath(path string, value any) to Message and Composite - retrieves field values using path notation
  • Added UnsetPath(idPaths ...string) to Message and Composite - unsets fields using path notation (replaces deprecated
    UnsetFields/UnsetSubfields)
  • Fixed concurrency issue in UnsetPath methods by ensuring field operations stay within mutex locks
  • Deprecated Message.UnsetFields() and Composite.UnsetSubfields() in favor of UnsetPath()

Example:

message := iso8583.NewMessage(spec)

message.MarshalPath("3.1", "12")      // Set subfield 1 of field 3

var val string
message.UnmarshalPath("3.1", &val)    // Get subfield 1 of field 3

message.UnsetPath("3.1", "4")         // Unset multiple fields

solves #383

@alovak alovak marked this pull request as ready for review November 23, 2025 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants