Code Monkey home page Code Monkey logo

couchdb-qt-driver's Introduction

CouchDB-Qt-Driver

simple couchDb driver for Qt

Development

  • Easy to use database/collection method
  auto songs = _mqcouch->getDatabase("songs");
  songs << QJsonDocument(QJsonObject{
                             {"name", "test"},
                             {"title", "New song!"}
                         });

Examples

open the main.cpp and add your changes

  • Init the library On local database,
_mqcouch = new mqcouch(_mqhttp, true);

Or a network connection,

_mqcouch = new mqcouch(_mqhttp, "http://192.168.2.5:5984", true);
  • See database connection is alive
_mqcouch->isActive();
  • Current database array
qDebug() << "Current databases:" <<_mqcouch->allDatabases();
  • Create a database
_mqcouch->createDatabase("testDatabase");
  • Add a document
_mqcouch->addDocument("testDatabase",  QJsonDocument(QJsonObject{
                                                       {"name", "test"},
                                                       {"title", "Hello World!"}
                                                   }));
  • See revision of document
  qDebug() << "Revision List";
  //Sample id
  QString id = "76aa2bb58c4996a414d321e7a8002a21";   
  for(auto item : _mqcouch->getRevisionList("albums", id, false))
  {
      QString rev = _mqcouch->convertRevisionString(item);
      qDebug() << _mqcouch->getDocumentRevision("albums", id, rev).data;
  }  
  • Get database(collection) with limit and order methods
  for(auto i : _mqcouch->getDocumentList("albums", 2, true))
  {
      qDebug() << "New Item:" << i.id << i.rev;
      qDebug() << _mqcouch->getDocument("albums", i.id).data;
  }

couchdb-qt-driver's People

Contributors

phantomxe avatar

Stargazers

DG avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.