storage

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DynamoDBPutItemAPI

type DynamoDBPutItemAPI interface {
	PutItem(ctx context.Context, params *dynamodb.PutItemInput, optFns ...func(*dynamodb.Options)) (*dynamodb.PutItemOutput, error)
}

DynamoDBPutItemAPI defines set of API required by Store functions

type DynamoDBStorage

type DynamoDBStorage interface {
	Store(ctx context.Context, api DynamoDBPutItemAPI, item map[string]types.AttributeValue) error
}

DynamoDBStorage is an interface that defines required DynamoDB functions

var DynamoDB DynamoDBStorage = dynamodbStorage{}

DynamoDB is the default implementation of DynamoDB related functions

type EmailNotification

type EmailNotification struct {
	Event     string `json:"event"`
	MessageID string `json:"messageID"`
	Timestamp string `json:"timestamp"`
}

EmailNotification contains information needed for an email state change notification

type EmailReceipt

type EmailReceipt struct {
	MessageID string
	Timestamp string
}

EmailReceipt contains information needed for an email receipt

type S3DeleteObjectAPI

type S3DeleteObjectAPI interface {
	DeleteObject(ctx context.Context, params *s3.DeleteObjectInput, optFns ...func(*s3.Options)) (*s3.DeleteObjectOutput, error)
}

S3DeleteObjectAPI defines set of API required by DeleteEmail functions

type S3GetObjectAPI

type S3GetObjectAPI interface {
	GetObject(ctx context.Context, params *s3.GetObjectInput, optFns ...func(*s3.Options)) (*s3.GetObjectOutput, error)
}

S3GetObjectAPI defines set of API required by GetEmail functions

type S3Storage

type S3Storage interface {
	GetEmail(ctx context.Context, api S3GetObjectAPI, messageID string) (text, html string, err error)
	DeleteEmail(ctx context.Context, api S3DeleteObjectAPI, messageID string) error
}

S3Storage is an interface that defines required S3 functions

var S3 S3Storage = s3Storage{}

S3 holds functions that handles S3 related operations

type SQSSendMessageAPI

type SQSSendMessageAPI interface {
	GetQueueUrl(ctx context.Context, params *sqs.GetQueueUrlInput, optFns ...func(*sqs.Options)) (*sqs.GetQueueUrlOutput, error)
	SendMessage(ctx context.Context, params *sqs.SendMessageInput, optFns ...func(*sqs.Options)) (*sqs.SendMessageOutput, error)
}

SQSSendMessageAPI defines set of API required by SendEmailReceipt and SendEmailNotification functions

type SQSStorage

type SQSStorage interface {
	// SendEmailHandle sends an email receipt to SQS.
	SendEmailReceipt(ctx context.Context, api SQSSendMessageAPI, input EmailReceipt) error
	// SendEmailNotification notifies about the state change of an email, categorized by event.
	SendEmailNotification(ctx context.Context, api SQSSendMessageAPI, input EmailNotification) error
}

SQSStorage references all SQS related functions

var SQS SQSStorage = sqsStorage{}

SQS is the default implementation of SQSStorage

Jump to

Keyboard shortcuts

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