gonorm

package module
v0.0.0-...-79e7a06 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2021 License: MIT Imports: 12 Imported by: 1

Documentation

Overview

Use AWS Dynamodb as storage

Index

Constants

View Source
const AppendToStrListExpr = "SET strList = list_append(strList, :AppendItems)"
View Source
const ConditionKeyDoesntExist = "attribute_not_exists(#key)"
View Source
const ConditionKeyExists = "attribute_exists(#key)"
View Source
const RenameNewItems = ":AppendItems"
View Source
const RenameTableKey = "#key"
View Source
const RequestTokenSize = 36
View Source
const StrListCreatedMarker = "<CREATED>"
View Source
const TableJsonField = "rawJson"
View Source
const TableKey = "key"
View Source
const TableStrListField = "strList"

Variables

This section is empty.

Functions

func GetUUID

func GetUUID() (string, error)

Types

type DynDB

type DynDB struct {
	AwsConfig *aws.Config
	DB        *dyndb.Client
	Table     string
}

func NewDynDB

func NewDynDB(table string) (*DynDB, error)

func (*DynDB) DoWriteTransaction

func (todo *DynDB) DoWriteTransaction(t WriteTransaction) error

func (*DynDB) GetJson

func (todo *DynDB) GetJson(key string, valueOut interface{}) error

func (*DynDB) GetStringList

func (todo *DynDB) GetStringList(key string, valueOut *[]string) error

func (*DynDB) HasKey

func (todo *DynDB) HasKey(key string) (bool, error)

type KeyValueDB

type KeyValueDB interface {
	HasKey(key string) (bool, error)
	GetJson(key string, valueOut interface{}) error
	GetStringList(key string, valueOut *[]string) error
	DoWriteTransaction(transaction WriteTransaction) error
}

type RAMDB

type RAMDB struct {
	Jsons            sync.Map
	StrLists         sync.Map
	TransactionLocks sync.Map
}

func NewRAMDB

func NewRAMDB() *RAMDB

func (*RAMDB) DoWriteTransaction

func (todo *RAMDB) DoWriteTransaction(t WriteTransaction) error

func (*RAMDB) GetJson

func (todo *RAMDB) GetJson(key string, valueOut interface{}) error

func (*RAMDB) GetStringList

func (todo *RAMDB) GetStringList(key string, valueOut *[]string) error

func (*RAMDB) HasKey

func (todo *RAMDB) HasKey(key string) (bool, error)

func (*RAMDB) SetJson

func (todo *RAMDB) SetJson(key string, value interface{}) error

type WriteTransaction

type WriteTransaction struct {
	// Create json items that must not already exist
	Creates map[string]interface{}

	Overwrites map[string]interface{}

	// Sets fields of json items
	SetFields map[string]map[string]interface{}

	// Append strings to lists of strings
	StrListAppends map[string][]string

	// Create empty lists of strings
	StrListCreates []string
}

Jump to

Keyboard shortcuts

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