From c3612d8a1992a81a3a2358778c5fc53a8d2f2f47 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Wed, 6 Nov 2019 15:59:49 +0100 Subject: [PATCH] Add RawValue Signed-off-by: Knut Ahlers --- datatypes.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/datatypes.go b/datatypes.go index a1ed09c..23b6a2b 100644 --- a/datatypes.go +++ b/datatypes.go @@ -105,3 +105,18 @@ func (p *Ptr) UnmarshalSII(in []byte) error { } // resource_tie => native type string + +// RawValue is used in places where a key can has multiple types and +// clean parsing into Go types is no longer possible. Sadly even parsing +// into interface{} is not possible as even for that the type of the value +// must be known +type RawValue []byte + +func (r RawValue) MarshalSII() ([]byte, error) { return r, nil } + +func (r *RawValue) UnmarshalSII(in []byte) error { + *r = in + return nil +} + +// TODO: Add converter functions from / to RawValue