Documentation
¶
Overview ¶
the serializer package is responsible for serializing and deserializing objects its main purpose is to provide a way to exclude fields from serialization or deserialization allowing restman to generate DTO using only tags on the struct
Index ¶
- type Serializer
- func (s *Serializer) Deserialize(data string, obj any) error
- func (s *Serializer) DeserializeAndMerge(data string, target any, groups ...string) error
- func (s *Serializer) MergeObjects(target any, source any, groups ...string) error
- func (s *Serializer) Serialize(obj any, groups ...string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Serializer ¶
Serializer is responsible for serializing and deserializing objects
func NewSerializer ¶
func NewSerializer(format format.Format) *Serializer
NewSerializer creates a new Serializer instance with the specified format.
func (*Serializer) Deserialize ¶
func (s *Serializer) Deserialize(data string, obj any) error
Deserialize converts a string representation into an object in the configured format.
func (*Serializer) DeserializeAndMerge ¶
func (s *Serializer) DeserializeAndMerge(data string, target any, groups ...string) error
DeserializeAndMerge deserializes data and merges it into the target object. If groups are provided, only fields with matching group tags will be merged.
func (*Serializer) MergeObjects ¶
func (s *Serializer) MergeObjects(target any, source any, groups ...string) error
MergeObjects merges source object fields into target object, both must be pointers. If groups are provided, only fields with matching group tags will be merged.