bridge

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2023 License: MIT Imports: 4 Imported by: 0

README

aws-lambda-go-dynamodb-type-bridge .github/workflows/check.yml

A library that makes it easier to unmarshal the map[string]events.DynamoDBAttributeValue which comes from aws/aws-lambda-go/events into a target struct that uses dynamodbav custom tags.

This library uses generics, so it requires Go runtimve version 1.18 or later.

Synopsis

type Entry struct {
    ID   uint64 `dynamodbav:"id"`
    Name string `dynamodbav:"name"`
}

lambdaAVMap := map[string]events.DynamoDBAttributeValue{
    "id":   events.NewNumberAttribute("65535"),
    "name": events.NewStringAttribute("John Doe"),
}

converted, err := ConvertLambdaDynamoDBAttributeValue[Entry](lambdaAVMap)
fmt.Println(err) // => <nil>
fmt.Printf("%#v\n", converted) // => &bridge.Entry{ID:0xffff, Name:"John Doe"}

Author

moznion (moznion@mail.moznion.net)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertLambdaDynamoDBAttributeValue

func ConvertLambdaDynamoDBAttributeValue[T any](attributeValue map[string]events.DynamoDBAttributeValue) (*T, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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