sample

package
v0.0.0-...-27e07c4 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Details

type Details struct {
	Description string `json:"description,omitempty"`
	Location    string `json:"location,omitempty"`
	Quantity    int    `json:"quantity,omitempty"`
}

Details of the item

type Item

type Item struct {
	ID        string     `json:"id,omitempty"`
	Name      string     `json:"name,omitempty"`
	CreatedAt *time.Time `json:"createdAt,omitempty"`
	UpdatedAt *time.Time `json:"updatedAt,omitempty"`
	Details   Details    `json:"details,omitempty"`
}

Item structure

type Repo

type Repo struct {
	Client    dynamodbiface.DynamoDBAPI
	TableName string
}

Repo provides DynamoDB client capabilities

func Repository

func Repository(tableName string) *Repo

Repository returns a configured DynamoDB client

func (*Repo) Delete

func (r *Repo) Delete(itemID string) error

Delete an existing resource by ID

func (*Repo) Get

func (r *Repo) Get(itemID string) (*Item, error)

Get an existing resource by ID

func (*Repo) Save

func (r *Repo) Save(item Item) (*Item, error)

Save an item as a new database resource

type Topic

type Topic struct {
	Client snsiface.SNSAPI
	ARN    string
}

Topic provides SNS client capabilities

func SnsTopic

func SnsTopic(arn string) *Topic

SnsTopic returns a configured topic client

func (Topic) Publish

func (t Topic) Publish(item Item) (string, error)

Publish an item to the SNS topic and return MessageId

Jump to

Keyboard shortcuts

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