dynamodb

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2016 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package dynamodb provides types to support unmarshalling generic `event *json.RawMessage` types into DynamoDB specific event structures. Sparta-based DynamoDB event listeners can unmarshall the RawMesssage into source-specific data. Example:

func s3EventListener(event *json.RawMessage,
                      context *sparta.LambdaContext,
                      w http.ResponseWriter,
                      logger *logrus.Logger) {
  var lambdaEvent spartaDynamoDB.Event
  err := json.Unmarshal([]byte(*event), &lambdaEvent)
  if err != nil {
    logger.Error("Failed to unmarshal event data: ", err.Error())
    http.Error(w, err.Error(), http.StatusInternalServerError)
  }
  for _, eachRecord := range lambdaEvent.Records {
    logger.Info("Operation type: ", eachRecord.EventName)
  }
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DynamoDB

type DynamoDB struct {
	Keys     map[string]awsDynamoDB.AttributeValue
	NewImage map[string]awsDynamoDB.AttributeValue
	OldImage map[string]awsDynamoDB.AttributeValue
}

DynamoDB event information

type Event

type Event struct {
	Records []EventRecord
}

Event data

type EventRecord

type EventRecord struct {
	EventID        string   `json:"eventID"`
	EventName      string   `json:"eventName"`
	EventVersion   string   `json:"eventVersion"`
	EventSource    string   `json:"eventSource"`
	EventSourceARN string   `json:"eventSourceARN"`
	AWSRegion      string   `json:"awsRegion"`
	DynamoDB       DynamoDB `json:"dynamodb"`
}

EventRecord event data

Jump to

Keyboard shortcuts

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