dynamodb

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2022 License: BSD-2-Clause, MIT Imports: 13 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).
delete_item(+Table, +Key).

% 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) DeleteItem added in v0.0.6

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

func (Dynamo) GetItem added in v0.0.6

func (d Dynamo) GetItem(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) Query added in v0.0.6

func (d Dynamo) Query(table, keys, 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