dynamo

package
v0.0.0-...-47f0617 Latest Latest
Warning

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

Go to latest
Published: May 29, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*dynamodb.DynamoDB
}

Client type is a DynamoDB client

func (*Client) ReadFromTable

func (client *Client) ReadFromTable(table string) (*Item, error)

ReadFromTable executes a Select query on the DynamoDB database returning the output in an Item format

func (*Client) WriteToTable

func (client *Client) WriteToTable(table, key string, isLow bool) error

WriteToTable executes an Update query on the DynamoDB updating the provided key with the isLow bool

type DB

type DB interface {
	NewSession() (*session.Session, error)
	NewClient() Client
	ReadFromTable(string) Item
	WriteToTable(string, string, bool) error
}

DB interface is a collection of most of the dyanmo package functions

type Dynamo

type Dynamo struct {
	TableName string
	Region    string
	Key       string
}

Dynamo contains the DyanamoDB basic information needed to connect to the instance

func New

func New(tbl, region, key string) (*Dynamo, error)

New is the Package constructor that initialises the DynamoDB config

func (*Dynamo) NewClient

func (dynamo *Dynamo) NewClient() (*Client, error)

NewClient creates a DynamoDB client

type Item

type Item struct {
	ID          int  `json:"ID"`
	IsLowMemory bool `json:"isLowMemory"`
	IsLowCPU    bool `json:"isLowCPU"`
}

Item represents the structure of the JSON body coming back from DynamoDB after a Select query is executed

Jump to

Keyboard shortcuts

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