Skip to content

Commit

Permalink
Documentation update 1
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenvelozo committed Aug 31, 2015
1 parent c6521b2 commit 368acab
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 4 deletions.
63 changes: 61 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,67 @@ Meadow

A Javascript Data Broker.

[![Code Climate](https://codeclimate.com/github/stevenvelozo/meadow/badges/gpa.svg)](https://codeclimate.com/github/stevenvelozo/meadow) [![Coverage Status](https://coveralls.io/repos/stevenvelozo/meadow/badge.svg?branch=master)](https://coveralls.io/r/stevenvelozo/meadow?branch=master) [![Build Status](https://travis-ci.org/stevenvelozo/meadow.svg?branch=master)](https://travis-ci.org/stevenvelozo/meadow) [![Dependency Status](https://david-dm.org/stevenvelozo/meadow.svg)](https://david-dm.org/stevenvelozo/meadow) [![devDependency Status](https://david-dm.org/stevenvelozo/meadow/dev-status.svg)](https://david-dm.org/stevenvelozo/meadow#info=devDependencies)
[![Code Climate](https://codeclimate.com/github/stevenvelozo/meadow/badges/gpa.svg)](https://codeclimate.com/github/stevenvelozo/meadow)
[![Coverage Status](https://coveralls.io/repos/stevenvelozo/meadow/badge.svg?branch=master)](https://coveralls.io/r/stevenvelozo/meadow?branch=master)
[![Build Status](https://travis-ci.org/stevenvelozo/meadow.svg?branch=master)](https://travis-ci.org/stevenvelozo/meadow)
[![Dependency Status](https://david-dm.org/stevenvelozo/meadow.svg)](https://david-dm.org/stevenvelozo/meadow)
[![devDependency Status](https://david-dm.org/stevenvelozo/meadow/dev-status.svg)](https://david-dm.org/stevenvelozo/meadow#info=devDependencies)

Who doesn't love writing the same code over and over again? Good question. Anybody who doesn't probably wants something to do simple data access stuff. And some of the complicated interactions as well. Meadow aims to provide a simple “magic where you want it, programmability where you don't” pattern.

_Do not use this yet._
## Install

```sh
$ npm install meadow
```

Because meadow requires the [fable](https://github.com/stevenvelozo/fable) library, you will also need to install that dependency:

```sh
$ npm install fable
```

## Quick Start

It is pretty easy to perform CRUD access on your database. And facilities are there to go crazy with custom queries and stored procedures.

```js
// These settings are read automatically from the fable.settings object by meadow
var databaseSettings = {
MySQL:
{
Server: "localhost",
Port: 3306,
User: "root",
Password: "",
Database: "sales_data",
ConnectionPoolLimit: 20
}
};

var fable = require('fable').new();

// Create a new meadow DAL object for the "Customers" data set
var meadow = require('meadow').new(fable, 'Customers')
.setProvider('MySQL')
.setDefaultIdentifier('customerID');

// Construct a query, filtering to a specific customer, number 17
var queryCustomer = testMeadow.query.addFilter('customerID', 17);

// Now pass the read query into the customer DAL, with a callback
testMeadow.doRead(queryCustomer,
function(error, query, customer)
{
// The customer parameter will contain a javascript object if there is:
// 1) a record with customerID = 17
// 2) in the customers table
// 3) in the sales_data database
if (error)
{
return console.log('Error querying customer data: '+error);
}
console.log('Found customer ID '+customer.customerID+' who is named '+customer.name);
}
);
```
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"start": "node source/Meadow.js",
"coverage": "./node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha -- -u tdd -R spec",
"test": "./node_modules/mocha/bin/_mocha -u tdd -R spec",
"doc": "./node_modules/groc/bin/groc --style retold ./README.md ./source/**/*.js ./source/*.js",
"doc-stage-retold": "./node_modules/groc/bin/groc --style retold -o ../retold/meadow ./README.md ./source/**/*.js ./source/*.js"
"doc": "./node_modules/groc/bin/groc --index-page-title Overview ./README.md ./source/**/*.js ./source/*.js",
"doc-stage-retold": "./node_modules/groc/bin/groc --index-page-title Overview -o ../retold/meadow ./README.md ./source/**/*.js ./source/*.js"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit 368acab

Please sign in to comment.