dynamodb

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2022 License: BSD-2-Clause, MIT Imports: 11 Imported by: 0

README

dynamodb GoDoc

import "github.com/guregu/predicates/dynamodb"

DynamoDB client for ichiban/prolog. It uses guregu/dynamo under the hood. Very experimental, still playing around with the API.

Predicates

% tables
list_tables(-Table).

% records
scan(+Table, -Item).
get_item(+Table, +Key, -Item).
put_item(+Table, +Item).

% converting between DynamoDB attribute values (Attr) and friendly Prolog values (Value).
attribute_value(+Attr, -Value).
attribute_value(-Attr, +Value).

Data representation

% attributes have their DynamoDB type as their functor
n('42').
s('hello world').
% numbers can be atoms or numbers
n(42).
% maps use key-value lists
m([key-s(value)]).

% for predicates like get_item that take a Key, the Key is in partitionkey-type(value) form
get_item(table, my_attribute-s(some_value), Item).
% use the -&- operator to specify the sort key (range key)
% such that the key is in pk-type(v)-&-sk-type(v) form
get_item(table, userid-n(42)-&-date-s('2022'), Item).
% you can also use key(pk-type(v), sk-type(v)) if you don't want to use my ugly operator

TODO

  • query/3
  • delete_item/2
  • update_item/?
  • describe_table/2
  • options: conditions, filters, expressions (query/4 etc.)
  • transactions

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dynamo

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

func New

func New(db *dynamo.DB) Dynamo

func (Dynamo) AttributeValue added in v0.0.2

func (d Dynamo) AttributeValue(attribute, value engine.Term, k func(*engine.Env) *engine.Promise, env *engine.Env) *engine.Promise

func (Dynamo) Bootstrap

func (d Dynamo) Bootstrap(p *prolog.Interpreter)

func (Dynamo) GetItem3

func (d Dynamo) GetItem3(table, keys, item engine.Term, k func(*engine.Env) *engine.Promise, env *engine.Env) *engine.Promise

func (Dynamo) ListTables

func (d Dynamo) ListTables(name engine.Term, k func(*engine.Env) *engine.Promise, env *engine.Env) *engine.Promise

func (Dynamo) PutItem added in v0.0.2

func (d Dynamo) PutItem(table, item engine.Term, k func(*engine.Env) *engine.Promise, env *engine.Env) *engine.Promise

func (Dynamo) Register

func (d Dynamo) Register(p *prolog.Interpreter)

func (Dynamo) Scan

func (d Dynamo) Scan(table, item engine.Term, k func(*engine.Env) *engine.Promise, env *engine.Env) *engine.Promise

Jump to

Keyboard shortcuts

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