Documentation ¶
Overview ¶
Package serializer contains
Index ¶
- type Serializer
- func (s *Serializer) Add(field string, value interface{}) *Serializer
- func (s *Serializer) AddFunc(field string, f converter) *Serializer
- func (s *Serializer) AddFuncIf(p predicate, field string, f converter) *Serializer
- func (s *Serializer) AddIf(p predicate, field string, value interface{}) *Serializer
- func (s *Serializer) Convert(field string, f converter) *Serializer
- func (s *Serializer) ConvertIf(p predicate, field string, f converter) *Serializer
- func (s *Serializer) Omit(fields ...string) *Serializer
- func (s *Serializer) OmitIf(p predicate, fields ...string) *Serializer
- func (s *Serializer) Pick(fields ...string) *Serializer
- func (s *Serializer) PickAll() *Serializer
- func (s *Serializer) PickIf(p predicate, fields ...string) *Serializer
- func (s *Serializer) Result() map[string]interface{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Serializer ¶
type Serializer struct {
// contains filtered or unexported fields
}
func (*Serializer) Add ¶
func (s *Serializer) Add(field string, value interface{}) *Serializer
Add a custom field to the result
func (*Serializer) AddFunc ¶
func (s *Serializer) AddFunc(field string, f converter) *Serializer
Add a computed custom field to the result
func (*Serializer) AddFuncIf ¶
func (s *Serializer) AddFuncIf(p predicate, field string, f converter) *Serializer
Add a computed custom field to the result if the predicate returns true
func (*Serializer) AddIf ¶
func (s *Serializer) AddIf(p predicate, field string, value interface{}) *Serializer
Add a custom field to the result if the predicate returns true
func (*Serializer) Convert ¶
func (s *Serializer) Convert(field string, f converter) *Serializer
Convert the field using the given converter
func (*Serializer) ConvertIf ¶
func (s *Serializer) ConvertIf(p predicate, field string, f converter) *Serializer
Convert the field using the given converter if the predicate returns true
func (*Serializer) Omit ¶
func (s *Serializer) Omit(fields ...string) *Serializer
Omit the given fields from the result
func (*Serializer) OmitIf ¶
func (s *Serializer) OmitIf(p predicate, fields ...string) *Serializer
Omit the given fields from the result if the predicate returns true
func (*Serializer) Pick ¶
func (s *Serializer) Pick(fields ...string) *Serializer
Add the given fields to the result
func (*Serializer) PickAll ¶
func (s *Serializer) PickAll() *Serializer
Add all the exported fields to the result
func (*Serializer) PickIf ¶
func (s *Serializer) PickIf(p predicate, fields ...string) *Serializer
Add the given fields to the result if the predicate returns true
func (*Serializer) Result ¶
func (s *Serializer) Result() map[string]interface{}
Returns the result of the serialization as a map[string]interface{}