Documentation
¶
Index ¶
- Variables
- func Marshal(in any, opts ...EncoderOption) (av types.AttributeValue, err error)
- func MarshalFuncV1[T any](fn func(T) (types.AttributeValue, error)) (res customMarshaler)
- func NewUnSupportedTypeError(av types.AttributeValue, t reflect.Type) error
- func OmitZeroStructFields() encoderOptionAdapter
- func UnMarshalFuncV1[T any](fn func(types.AttributeValue, *T) error) (res customUnMarshaler)
- func WithTag(tag string) tagOption
- type ArrayUnmarshalOverflowOption
- type Decoder
- type DecoderConfig
- type DecoderOption
- type DynamoKind
- type Encoder
- type EncoderConfig
- type EncoderOption
- type IsZeroer
- type SerializerError
- type SerializerErrorData
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidUnmarshalInputType = fmt.Errorf("unmarshal input have to be non nil pointer:%w", errors.ErrUnsupported)
View Source
var ErrUnMarshalArrayOverflow = errors.New("array overflow")
View Source
var ErrUnMarshalArrayUnderflow = errors.New("array underflow")
Functions ¶
func Marshal ¶
func Marshal(in any, opts ...EncoderOption) (av types.AttributeValue, err error)
func MarshalFuncV1 ¶
func MarshalFuncV1[T any](fn func(T) (types.AttributeValue, error)) (res customMarshaler)
func NewUnSupportedTypeError ¶
func NewUnSupportedTypeError(av types.AttributeValue, t reflect.Type) error
func OmitZeroStructFields ¶
func OmitZeroStructFields() encoderOptionAdapter
func UnMarshalFuncV1 ¶
func UnMarshalFuncV1[T any](fn func(types.AttributeValue, *T) error) (res customUnMarshaler)
Types ¶
type ArrayUnmarshalOverflowOption ¶
type ArrayUnmarshalOverflowOption uint8
const ( //fail on attempt to unmarshal into go array if the data length is not exact match to the array length CheckOverFlowAndUnderflowArrayOnUnmarshal ArrayUnmarshalOverflowOption = iota //0b0 //allow unmarshal into go array if the data length is longer then the array length - any data that is beyond the array length will be discarded CheckUnderflowArrayOnUnmarshaling ArrayUnmarshalOverflowOption = iota //0b01 //allow unmarshal into go array if the data length is shorter then the array length - rest of the array will contain the zero value for the un-marshaled type CheckOverflowUnmarshalArrayOnUnmarshaling ArrayUnmarshalOverflowOption = iota //0b10 //will allow to attempt unmarshaling into go array data of any length the behavior will be like other options described AllowUnmarshalArrayFromAnyLen ArrayUnmarshalOverflowOption = iota //0b11 )
func (ArrayUnmarshalOverflowOption) IsOverflowAllowed ¶
func (overFlowOption ArrayUnmarshalOverflowOption) IsOverflowAllowed() bool
return true if decoder is allowed to ignore items when unmarshaling array incase array length is smaller then data slice length
func (ArrayUnmarshalOverflowOption) IsUnderflowAllowed ¶
func (overFlowOption ArrayUnmarshalOverflowOption) IsUnderflowAllowed() bool
return true if decoder is allowed to zero items when unmarshaling array incase array length is larger then data slice length
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
func NewDecoder ¶
func NewDecoder(opts ...DecoderOption) *Decoder
type DecoderConfig ¶
type DecoderConfig struct {
// contains filtered or unexported fields
}
func NewDecoderConfig ¶
func NewDecoderConfig(opts ...DecoderOption) DecoderConfig
type DecoderOption ¶
type DecoderOption interface {
// contains filtered or unexported methods
}
func WithArrayBoundCheckMode ¶
func WithArrayBoundCheckMode(m ArrayUnmarshalOverflowOption) DecoderOption
func WithUnmarshalers ¶
func WithUnmarshalers(m customUnMarshaler, more ...customUnMarshaler) DecoderOption
type DynamoKind ¶
type DynamoKind int8
const ( DynamoKindUnknown DynamoKind = iota DynamoKindNull DynamoKind = iota DynamoKindString DynamoKind = iota DynamoKindNumber DynamoKind = iota DynamoKindBool DynamoKind = iota DynamoKindBinary DynamoKind = iota DynamoKindList DynamoKind = iota DynamoKindMap DynamoKind = iota DynamoKindStringSet DynamoKind = iota DynamoKindNumberSet DynamoKind = iota DynamoKindBinarySet DynamoKind = iota )
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
func NewEncoder ¶
func NewEncoder(opts ...EncoderOption) *Encoder
type EncoderConfig ¶
type EncoderConfig struct {
// contains filtered or unexported fields
}
func NewEncoderConfig ¶
func NewEncoderConfig(opts ...EncoderOption) EncoderConfig
type EncoderOption ¶
type EncoderOption interface {
// contains filtered or unexported methods
}
func WithMarshalers ¶
func WithMarshalers(marshaler customMarshaler, more ...customMarshaler) EncoderOption
type SerializerError ¶
type SerializerError struct {
SerializerErrorData
// contains filtered or unexported fields
}
func (SerializerError) Error ¶
func (e SerializerError) Error() string
type SerializerErrorData ¶
type SerializerErrorData struct {
Path string
Kind DynamoKind //optional
GoType reflect.Type //may be nill
Err error //may be nill if there is no underlying error
}
func (SerializerErrorData) Unwrap ¶
func (e SerializerErrorData) Unwrap(err error) error
Click to show internal directories.
Click to hide internal directories.