Go to file
Hamed Masafi 0a971815c4 order phrase completed 2016-06-05 16:52:26 +04:30
doc order phrase completed 2016-06-05 16:52:26 +04:30
include order phrase completed 2016-06-05 16:52:26 +04:30
src order phrase completed 2016-06-05 16:52:26 +04:30
test order phrase completed 2016-06-05 16:52:26 +04:30
.gitignore Initial commit 2016-03-09 11:05:49 +03:30
LICENSE Initial commit 2016-03-09 11:05:49 +03:30
README.md Read me wiki link 2016-05-24 11:29:29 +04:30
include.tar.gz order phrase completed 2016-06-05 16:52:26 +04:30
nut.pri order phrase completed 2016-06-05 16:52:26 +04:30
nut.qdocconf order phrase completed 2016-06-05 16:52:26 +04:30

README.md

Nut

Advanced, Powerful and easy to use ORM for Qt5

Features:

  • Easy to use
  • Automatically create and update database
  • IDE auto complete support, No hard-code nedded
  • Table join detect

Sample Codes

Read data from database:

autoq = FROM(db.posts())
        WHERE(Post::idField() == postId);

auto posts = q->toList();
// now posts is a QList<Post*> contain all posts in
//  database that has id equal to postId variable
auto post = q->first();
// post is first row in database that its id is equal to postId

Adding to database:

Post *newPost = new Post;
newPost->setTitle("post title");

db.posts()->append(newPost);

for(int i = 0 ; i < 3; i++){
    Comment *comment = new Comment;
    comment->setMessage("comment #" + QString::number(i));

    newPost->comments()->append(comment);
}
db.saveChanges();

Modify database data:

auto q = FROM(db.posts())
        WHERE(Post::idField() == postId);

Post *post = q->first();

if(post) {
    post->setTitle("new name");
    db.saveChanges();
} else {
    qWarning("No post found!");
}

For more information read Wiki.