Skip to content

mazandonline/Nut

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nut

Advanced, Powerful and easy to use ORM for Qt5

Features:

  • Easy to use
  • Support PosgtreSQL, MySQL, SQLite, Microsoft Sql Server
  • 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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 91.1%
  • C 6.8%
  • QMake 1.7%
  • Shell 0.4%