An open API service indexing awesome lists of open source software.

https://github.com/131/umod

Micro data model for nodejs
https://github.com/131/umod

Last synced: about 1 year ago
JSON representation

Micro data model for nodejs

Awesome Lists containing this project

README

          

# umod
Micro data model mapper for nodejs, works best with [pg-aa](https://github.com/131/pg-co).

[![Build Status](https://travis-ci.org/131/umod.svg?branch=master)](https://travis-ci.org/131/umod)
[![Coverage Status](https://coveralls.io/repos/github/131/umod/badge.svg?branch=master)](https://coveralls.io/github/131/umod?branch=master)
[![NPM version](https://img.shields.io/npm/v/umod.svg)](https://www.npmjs.com/package/umod)

# Example
```
const uMod = require('umod');

class File extends uMod {
//dostuff
static get sql_table() { return "some_table"; }
static get sql_key() { return "some_key"; }
}

var lnk = pg.connect("somecreds@somehost");

(async function(){
var foo = await File.instanciate(lnk, some_guid);
//results in SELECT * FROM sometable WHERE some_key=?, some_guid
//return a simple File instance with all columns as properties

var foos = await File.from_ids(lnk, [some_guid, some_other_guid]);
//same thing here
}();

```

# API
## Static instanciate
Search for a model through data connector, throw if missing

## Static from_ids
Instanciate a list of model, return a key indexed dictionnary

# TODO
* Get rich or die tryin'

# Shoutbox, keywords, SEO love
model, data model, micro model, co, sql, yks, static inheritance, pg, pg-aa, model collection, "Let's have a beer & talk in Paris"

# Credits
* [131](https://github.com/131)