Code Monkey home page Code Monkey logo

dynamodb-expressions's Introduction

dynamodb-expressions

https://img.shields.io/travis/brabster/dynamodb-expressions.svg https://img.shields.io/github/release/brabster/dynamodb-expressions.svg

Get the latest version on Clojars

A WIP attempt to write a DSL for DynamoDB expressions in Clojure. Not ready for real-world use yet!

http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.Modifying.html

Unsupported Functionality

delete

nested paths

dynamodb Grammar

To test condition expressions without nasty string hacking, there’s a grammar for condition expressions, based on the documentation.

Examples

This much pretty much works…

(ns foo
  (:require [dynamodb-expressions :as dx]))

(def x 4)
(dx/expr
 '(dx/add ["foo.bar" x]
          ["bar.baz" 8])
 '(dx/add ["-goof-" 76]))


#_({:update-expression "ADD #foo_bar_G__22528 :x_G__22529, #bar_baz_G__22530 :8_G__22531",
    :expression-attribute-names {"#foo_bar_G__22528" "foo.bar",
                                 "#bar_baz_G__22530" "bar.baz",
                                 "#__goof__G__22532" "-goof-"},
    :expression-attribute-values {":x_G__22529" 4,
                                  ":8_G__22531" 8,
                                  ":76_G__22533" 76}})

Next steps to extend the syntax out to set, remove, delete, and tidy up the syntax, something like:

(dx/expr
  (dx/add ["a" x]
          ["b" 8])
  (dx/set (dx/+ "c" 76)
          (dx/= "d" "foo bar"))
  (dx/remove "e" "f" "g")
  (dx/delete ["h" "baz"]))

License

Copyright © 2016 Paul Brabban

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

dynamodb-expressions's People

Contributors

brabster avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.