Categorygithub.com/andream16/aws-sdk-go-bindings
modulepackage
2.0.0+incompatible
Repository: https://github.com/andream16/aws-sdk-go-bindings.git
Documentation: pkg.go.dev

# README

aws-sdk-go-bindings CircleCI GoDoc Go Report Card Apache V2 License

Helper to easily access some aws-sdk-go's methods and lambda utilities like preparing an sns default message and unmarshal an image coming out from a stream like:

// UnmarshalDynamoEvent unmarshals a events.DynamoDBEventRecord into a given target.
// Out has to be a pointer.
func UnmarshalDynamoEvent(event events.DynamoDBEventRecord, out interface{}) error {

	if reflect.DeepEqual(event, reflect.Zero(reflect.TypeOf(event)).Interface()) {
		return errors.Wrap(bindings.ErrInvalidParameter, "event")
	}
	if reflect.ValueOf(out).Kind() != reflect.Ptr {
		return errors.Wrap(bindings.ErrInvalidParameter, "out")
	}

	img := event.Change.NewImage
	if len(img) == 0 {
		return errors.New("event's image is empty")
	}

	m := make(map[string]*dynamodb.AttributeValue, len(img))

	for k, v := range img {

		b, err := v.MarshalJSON()
		if err != nil {
			return errors.Wrap(err, "unable to marshal current element to json")
		}

		var attr dynamodb.AttributeValue

		err = json.Unmarshal(b, &attr)
		if err != nil {
			return errors.Wrap(err, "unable to unmarshal current element to json")
		}

		m[k] = &attr

	}

	return dynamodbattribute.UnmarshalMap(m, out)

}

Contributors

Special thanks to:

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

Package level related errors.