ddbproto

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

README

DdbProto: Streamlined CRUD Operations with AWS Dynamodb and Protocol Buffers

The ddbproto package offers a collection of CRUD operations for interaction with AWS Dynamodb, utilizing Protocol Buffers for serialization purposes.

Documentation

Overview

Package ddbproto package offers a collection of CRUD operations for interaction with AWS Dynamodb, utilizing Protocol Buffers for serialization purposes.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidFieldMask = errors.New("invalid field mask")

Functions

This section is empty.

Types

type DdbProto

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

func NewClient

func NewClient(tableName string, region string) *DdbProto

NewClient creates a new instance of DbdProto. Region must a valid aws region like "us-east-1" or "af-south-1". Either you need to have configured your aws credentials in ~/.aws/credentials, or you need to set the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables

func (*DdbProto) DeleteProto

func (b *DdbProto) DeleteProto(ctx context.Context, columnFamily string, rowKey string) error

DeleteProto permanently deletes the proto message from the database.

func (*DdbProto) ListProtos

func (b *DdbProto) ListProtos(ctx context.Context, columnFamily string, messageType proto.Message, opts PageOptions) ([]proto.Message, string, error)

ListProtos returns an array of proto messages.

func (*DdbProto) ReadProto

func (b *DdbProto) ReadProto(ctx context.Context, rowKey string, columnFamily string, message proto.Message, readMask *fieldmaskpb.FieldMask) error

ReadProto reads the proto message from the database.

func (*DdbProto) UpdateProto

func (b *DdbProto) UpdateProto(ctx context.Context, rowKey string, columnFamily string, message proto.Message, updateMask *fieldmaskpb.FieldMask) error

UpdateProto updates the proto message in the database.

func (*DdbProto) WriteProto

func (b *DdbProto) WriteProto(ctx context.Context, rowKey string, columnFamily string, message proto.Message) error

WriteProto writes the proto message to the database.

type ErrInvalidNextToken

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

func (ErrInvalidNextToken) Error

func (e ErrInvalidNextToken) Error() string

type ErrMismatchedTypes

type ErrMismatchedTypes struct {
	Expected reflect.Type
	Actual   reflect.Type
}

func (ErrMismatchedTypes) Error

func (e ErrMismatchedTypes) Error() string

type ErrNegativePageSize

type ErrNegativePageSize struct{}

func (ErrNegativePageSize) Error

func (e ErrNegativePageSize) Error() string

type ErrNotFound

type ErrNotFound struct {
	RowKey string // unavailable locations
}

ErrNotFound is returned when the desired resource is not found in Bigtable.

func (ErrNotFound) Error

func (e ErrNotFound) Error() string

type Item

type Item struct {
	PK    string
	SK    string
	Proto string
}

Item struct to hold info about new item

type PageOptions

type PageOptions struct {
	RowKeyPrefix string
	PageSize     int32
	NextToken    string
	MaxPageSize  int32
	ReadMask     *fieldmaskpb.FieldMask
}

PageOptions are used with the ListProtos method

Jump to

Keyboard shortcuts

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