Help us shape the future of Go! Take the 2026 Go Developer Survey

cloudcounter

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2019 License: Apache-2.0 Imports: 5 Imported by: 1

README

cloudcounter

serverless counter implementation.

# test with mem docstore
go test

# test with dynamodb-local
go test -tags dynamodb

License

Apache 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Counter

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

func NewCounter

func NewCounter(collection *docstore.Collection, opt ...Option) *Counter

func (*Counter) Decrement

func (c *Counter) Decrement(ctx context.Context, key CounterKey) error

func (*Counter) Get

func (c *Counter) Get(ctx context.Context, key CounterKey) (int, error)

func (*Counter) Increment

func (c *Counter) Increment(ctx context.Context, key CounterKey) (int, error)

func (*Counter) Register

func (c *Counter) Register(ctx context.Context, key CounterKey) error

type CounterEntity

type CounterEntity struct {
	ID    string `docstore:"id"`
	Count int    `docstore:"count"`
}

type CounterKey

type CounterKey string

type Option added in v0.0.2

type Option struct {
	Concurrency int
	Prefix      string
}

Jump to

Keyboard shortcuts

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