Skip to content

feat: Add directive for "encoding" binary interfaces #409

@klauspost

Description

@klauspost

Allow specifying directives for (external) types that support BinaryMarshaler + BinaryUnmarshaler and optionally BinaryAppender.

  • //msgp:binmarshal pkg.Type pkg.Type2 will use BinaryMarshaler/BinaryUnmarshaler.
  • //msgp:binappend pkg.Type pkg.Type2 will use BinaryAppender/BinaryUnmarshaler.

Serialized data will be added an bin data, no special header.

I guess we could also add the text interfaces. But the user would probably need to specify the storage type...

  • //msgp:textmarshal pkg.Type pkg.Type2 will use TextMarshaler/TextUnmarshaler; data saved as bin (default)
  • //msgp:textappend pkg.Type pkg.Type2 will use TextAppender/TextUnmarshaler; data saved as bin (default)
  • //msgp:textmarshal as:string pkg.Type pkg.Type2 will use TextMarshaler/TextUnmarshaler; data saved as string.
  • //msgp:textappend as:string pkg.Type pkg.Type2 will use TextAppender/TextUnmarshaler; data saved as string.

Missing anything, suggestions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions