godynamo

package module
v0.0.0-...-7be3ace Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

README

Godynamo

Object document mapper for dynamodb

Objective

  • To make interactions with dynamodb easier.
  • Circumvent the use of aws sdk while providing the same flexibility.
  • Data mapping for CRUD operations

Disclaimer

WIP. Do not use until made stable.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Svc *dynamodb.DynamoDB
	// contains filtered or unexported fields
}

Client struct that holds the connection objects

func NewClient

func NewClient(config *Config) *Client

NewClient function to create a Client with the given Config

func NewClientWithSession

func NewClientWithSession(s *session.Session, config *Config) *Client

NewClientWithSession function to create a client with the provided aws sessio object

func (*Client) CreateTable

func (s *Client) CreateTable(name string, t interface{}) error

CreateTable function to create a new table in Dynamo. Throws error if it already exists

func (*Client) Ctx

func (s *Client) Ctx() context.Context

Ctx function returns the context with the specified Timeout value

func (*Client) Table

func (s *Client) Table(t string) *Table

Table function to fetch the abstract Table interface for further interaction

type Config

type Config struct {
	Timeout         time.Duration
	TagName         string
	PartitionKeyTag string
	SortKeyTag      string
}

Config struct to provide initial configuration for the connection

type CreateTableOp

type CreateTableOp struct {
	Input *dynamodb.CreateTableInput
	// contains filtered or unexported fields
}

type DeleteItemOp

type DeleteItemOp struct {
	Input *dynamodb.DeleteItemInput
	// contains filtered or unexported fields
}

func (*DeleteItemOp) Bind

func (d *DeleteItemOp) Bind(in interface{}) *DeleteItemOp

func (*DeleteItemOp) Execute

func (d *DeleteItemOp) Execute() error

func (*DeleteItemOp) ExecuteWithCtx

func (d *DeleteItemOp) ExecuteWithCtx(ctx context.Context) error

func (*DeleteItemOp) Request

func (*DeleteItemOp) UseExpr

func (d *DeleteItemOp) UseExpr(expr expression.Expression) *DeleteItemOp

type GetItemOp

type GetItemOp struct {
	Input *dynamodb.GetItemInput
	// contains filtered or unexported fields
}

GetItemOp struct that represents the GetItem operation

func (*GetItemOp) Bind

func (g *GetItemOp) Bind(in interface{}) *GetItemOp

Bind function to bind a struct/map as input

func (*GetItemOp) Execute

func (g *GetItemOp) Execute(out interface{}) error

Execute function to execute the GetItem operation with the default context

func (*GetItemOp) ExecuteWithCtx

func (g *GetItemOp) ExecuteWithCtx(ctx context.Context, out interface{}) error

ExecuteWithCtx function to execute the GetItem operation with the given context

func (*GetItemOp) Request

func (g *GetItemOp) Request() (*request.Request, *dynamodb.GetItemOutput)

func (*GetItemOp) UseExpr

func (g *GetItemOp) UseExpr(expr expression.Expression) *GetItemOp

type Item

type Item map[string]interface{}

Item type to create Items on the go

type PutItemOp

type PutItemOp struct {
	Input *dynamodb.PutItemInput
	// contains filtered or unexported fields
}

PutItemOp struct that represents a PutItem operation

func (*PutItemOp) Bind

func (p *PutItemOp) Bind(in interface{}) *PutItemOp

Bind function to bind a struct/map as input

func (*PutItemOp) Execute

func (p *PutItemOp) Execute() error

Execute function to execute the PutItem operation with default context

func (*PutItemOp) ExecuteWithCtx

func (p *PutItemOp) ExecuteWithCtx(ctx context.Context) error

ExecuteWithCtx function to execute the PutItem operation with the given context

func (*PutItemOp) Request

func (p *PutItemOp) Request() (*request.Request, *dynamodb.PutItemOutput)

func (*PutItemOp) UseExpr

func (p *PutItemOp) UseExpr(expr expression.Expression) *PutItemOp

type Table

type Table struct {
	// contains filtered or unexported fields
}

Table interface for interactive with dynamo

func (*Table) DeleteItem

func (t *Table) DeleteItem() *DeleteItemOp

func (*Table) GetItem

func (t *Table) GetItem() *GetItemOp

GetItem function to fetch an item from dynamo

func (*Table) Name

func (t *Table) Name() string

func (*Table) PutItem

func (t *Table) PutItem() *PutItemOp

PutItem function to create a new dynamo document

func (*Table) UpdateItem

func (t *Table) UpdateItem() *UpdateItemOp

type UpdateItemOp

type UpdateItemOp struct {
	Input *dynamodb.UpdateItemInput
	// contains filtered or unexported fields
}

func (*UpdateItemOp) Bind

func (u *UpdateItemOp) Bind(in interface{}) *UpdateItemOp

func (*UpdateItemOp) Execute

func (u *UpdateItemOp) Execute() error

func (*UpdateItemOp) ExecuteWithCtx

func (u *UpdateItemOp) ExecuteWithCtx(ctx context.Context) error

func (*UpdateItemOp) Request

func (*UpdateItemOp) UseExpr

func (u *UpdateItemOp) UseExpr(expr expression.Expression) *UpdateItemOp

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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