types

package
v1.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 12, 2025 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Overview

Package types provides type conversion between Go types and DynamoDB AttributeValues

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Converter

type Converter struct {
	// contains filtered or unexported fields
}

Converter handles conversion between Go types and DynamoDB AttributeValues

func NewConverter

func NewConverter() *Converter

NewConverter creates a new type converter

func (*Converter) ConvertToSet

func (c *Converter) ConvertToSet(slice any, isSet bool) (types.AttributeValue, error)

ConvertToSet determines if a slice should be converted to a DynamoDB set

func (*Converter) FromAttributeValue

func (c *Converter) FromAttributeValue(av types.AttributeValue, target any) error

FromAttributeValue converts a DynamoDB AttributeValue to Go value

func (*Converter) RegisterConverter

func (c *Converter) RegisterConverter(typ reflect.Type, converter CustomConverter)

RegisterConverter registers a custom converter for a specific type

func (*Converter) ToAttributeValue

func (c *Converter) ToAttributeValue(value any) (types.AttributeValue, error)

ToAttributeValue converts a Go value to DynamoDB AttributeValue

type CustomConverter

type CustomConverter interface {
	// ToAttributeValue converts a Go value to DynamoDB AttributeValue
	ToAttributeValue(value any) (types.AttributeValue, error)

	// FromAttributeValue converts a DynamoDB AttributeValue to Go value
	FromAttributeValue(av types.AttributeValue, target any) error
}

CustomConverter defines the interface for custom type converters

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL