Coder Social home page Coder Social logo

memento's Introduction

Memento

Introduction

Memento is an mnesia wrapper for LFE

Installation

Just add it to your rebar.config deps:

{deps, [
 ...
 {memento, {git, "[email protected]:arpunk/memento.git", {branch, "master"}}}
 ...
]}.

And then do the usual:

$ rebar3 compile

Usage

It’s very easy!

(defmodule testing-memento
  (import
    (from memento-table (write 2))
    (from memento-query (select 2))))

(include-lib "memento/include/table.lfe")
(include-lib "memento/include/transaction.lfe")

;; First time?
(memento:stop)
(memento-schema:create)
(memento:start)

;; Let's define some records
(defrecord person
  name
  age)

;; Now let's define our table properties
(set person-opts `[#(type set)
                   #(disc_copies [,(node)])])

;; Once we are ready we can create the table
(create-table person person-opts)

;; And the fun starts
(with-transaction
  (write 'person (make-person name "John Doe" age 31)))

;; Querying
(with-transaction
  (select 'person
          (match-spec
            (((tuple _ name age)) (when (> age 20))
              (tuple 'ok name)))))

memento's People

Stargazers

 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.