0.3.2 • Published 11 years ago
mambo v0.3.2
mambo
Little wrapper for dynamo models
Install
npm install mambo
Testing
git clone
npm install
mocha
Example
var mambo = require('mambo'),
Schema = mambo.Schema,
StringField = mambo.StringField,
NumberField = mambo.NumberField,
JSONField = mambo.JSONField,
DateField = mambo.DateField;
var Comment = new mambo.Model(new Schema(
'Comments', ['post_id', 'created'],
{
'post_id': NumberField,
'created': DateField,
'comment': StringField,
'author': StringField,
'liked_by': JSONField
}
), new Schema('Users', 'username', {
'username': StringField,
'name': StringField,
'lastCommentPosted': DateField
})
);
Comment.getAll = function(postId){
this.objects('comments', postId)
.limit(5)
.fetch().then(function(comments){
console.log('Comments for post ' + postId + ':\n'); console.log(JSON.stringify(comments, null, 4));
});
};
Comment.post = function(postId, author, comment){
this.insert('comments',
{
'post_id': postId,
'created': new Date(),
'author': author,
'comment': comment,
'liked_by': []
})
.commit().then(function(){
console.log('Comment added!');
});
};
module.exports = Comment;
0.3.2
11 years ago
0.3.1
11 years ago
0.3.0
11 years ago
0.2.14
11 years ago
0.2.13
11 years ago
0.2.12
11 years ago
0.2.11
11 years ago
0.2.10
11 years ago
0.2.9
11 years ago
0.2.8
11 years ago
0.2.7
11 years ago
0.2.6
11 years ago
0.2.5
11 years ago
0.2.4
12 years ago
0.2.3
12 years ago
0.2.2
12 years ago
0.2.1
12 years ago
0.2.0
12 years ago
0.0.22
12 years ago
0.0.21
12 years ago
0.0.20
12 years ago
0.0.19
12 years ago
0.0.18
12 years ago
0.0.17
12 years ago
0.0.16
12 years ago
0.0.15
12 years ago
0.0.14
12 years ago
0.0.13
12 years ago
0.0.12
12 years ago
0.0.11
12 years ago
0.0.10
12 years ago
0.0.9
12 years ago
0.0.8
12 years ago
0.0.7
12 years ago
0.0.6
12 years ago
0.0.5
12 years ago
0.0.4
12 years ago
0.0.3
12 years ago
0.0.2
12 years ago
0.0.1
12 years ago