diff --git a/dynamodb/README.md b/dynamodb/README.md new file mode 100644 index 00000000..290f6a11 --- /dev/null +++ b/dynamodb/README.md @@ -0,0 +1,65 @@ +# DynamoDB + +.... + +### Table of Contents +- [Signatures](#signatures) +- [Installation](#installation) +- [Examples](#examples) +- [Config](#config) +- [Default Config](#default-config) + + +### Signatures +```go +func New(config ...Config) Storage + +var ErrNotExist = errors.New("key does not exist") + +func (s *Storage) Get(key string) ([]byte, error) +func (s *Storage) Set(key string, val []byte, exp time.Duration) error +func (s *Storage) Delete(key string) error +func (s *Storage) Reset() error +func (s *Storage) Close() error +``` + +### Installation +DynamoDB is tested on the 2 last [Go versions](https://golang.org/dl/) with support for modules. So make sure to initialize one first if you didn't do that yet: +```bash +go mod init github.com// +``` +And then install the dynamodb implementation: +```bash +go get github.com/gofiber/storage/dynamodb +``` + +### Examples +Import the storage package. +```go +import "github.com/gofiber/storage/dynamodb" +``` + +You can use the following possibilities to create a storage: +```go +// Initialize default config +store := dynamodb.New() + +// Initialize custom config +store := dynamodb.New(dynamodb.Config{ + +}) +``` + +### Config +```go +type Config struct { + +} +``` + +### Default Config +```go +var ConfigDefault = Config{ + +} +``` diff --git a/dynamodb/config.go b/dynamodb/config.go new file mode 100644 index 00000000..f170aea6 --- /dev/null +++ b/dynamodb/config.go @@ -0,0 +1,23 @@ +package dynamodb + +// Config defines the config for storage. +type Config struct { +} + +// ConfigDefault is the default config +var ConfigDefault = Config{} + +// configDefault is a helper function to set default values +func configDefault(config ...Config) Config { + // Return default config if nothing provided + if len(config) < 1 { + return ConfigDefault + } + + // Override default config + cfg := config[0] + + // Set default values + + return cfg +} diff --git a/dynamodb/dynamodb.go b/dynamodb/dynamodb.go new file mode 100644 index 00000000..eeacc196 --- /dev/null +++ b/dynamodb/dynamodb.go @@ -0,0 +1 @@ +package dynamodb diff --git a/dynamodb/dynamodb_test.go b/dynamodb/dynamodb_test.go new file mode 100644 index 00000000..eeacc196 --- /dev/null +++ b/dynamodb/dynamodb_test.go @@ -0,0 +1 @@ +package dynamodb diff --git a/dynamodb/go.mod b/dynamodb/go.mod new file mode 100644 index 00000000..d80c2c89 --- /dev/null +++ b/dynamodb/go.mod @@ -0,0 +1,3 @@ +module github.com/gofiber/storage/dynamodb + +go 1.14