Skip to content

Commit

Permalink
ndr: add marshal_response shortcut
Browse files Browse the repository at this point in the history
  • Loading branch information
oiweiwei committed Feb 14, 2025
1 parent ab7f203 commit 63f7a12
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ndr/ndr20.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ func Marshal(d Marshaler, opts ...any) ([]byte, error) {
return NDR20(nil, opts...).Marshal(context.Background(), d)
}

// MarshalResponse function marshal the operation `d` response using NDR2.0 format.
func MarshalResponse(d Operation, opts ...any) ([]byte, error) {
w := NDR20(nil, opts...)
if err := d.MarshalNDRResponse(context.Background(), w); err != nil {
return nil, err
}
return w.Bytes(), nil
}

// Unmarshal function unmarshals the bytes `b` to the data `d`
// using NDR2.0 format.
func Unmarshal(b []byte, d Unmarshaler, opts ...any) error {
Expand Down

0 comments on commit 63f7a12

Please sign in to comment.