From 97a94241630690f6d6255cd3947c8124623ccfe9 Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Thu, 20 Jun 2019 12:59:57 +0430 Subject: [PATCH] few lines of doc & travis build only master branch --- .travis.yml | 4 ++ .../ipch/38f51fe5930ec860/mmap_address.bin | Bin 0 -> 8 bytes README.md | 8 ++- doc/query.md | 4 +- doc/sharedpointer.md | 59 ++++++++++++++++++ doc/start.md | 16 ----- 6 files changed, 72 insertions(+), 19 deletions(-) create mode 100644 .vscode/ipch/38f51fe5930ec860/mmap_address.bin create mode 100644 doc/sharedpointer.md diff --git a/.travis.yml b/.travis.yml index 31fe73e..1502709 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,10 @@ #Based on https://github.com/pcolby/libqtaws/blob/master/.travis.yml language: cpp +branches: + only: + - master + os: - linux - osx diff --git a/.vscode/ipch/38f51fe5930ec860/mmap_address.bin b/.vscode/ipch/38f51fe5930ec860/mmap_address.bin new file mode 100644 index 0000000000000000000000000000000000000000..f015e039298aa6a178e9be8160337a72102bb65a GIT binary patch literal 8 PcmZQzU|`u-&%gix1d#zk literal 0 HcmV?d00001 diff --git a/README.md b/README.md index 50da158..0b5a8a0 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,13 @@ Badge](https://api.codacy.com/project/badge/Grade/f3802610beb946068f6cd2c2b6608a - Table join detect - Suppor every Qt types. [Full list](doc/datatypes.md) -[Getting start](doc/start.md) +##Getting start +* [Sample codes](doc/start.md) +* [Shared pointer and regular mode](sharedpointer.md) +* [Create database class](database.md) +* [Create table class](table.md) +* [Using queries](query.md) +* [Supported data types](datatypes.md) ### Donate Butcoin address: 1Dn1WHKkaxanXe4cTGDk4cFRRABxLUpEVj diff --git a/doc/query.md b/doc/query.md index b752f34..ffb8d0c 100644 --- a/doc/query.md +++ b/doc/query.md @@ -56,12 +56,12 @@ auto count = q.count(Post::idField()); ## Checking field exists in list of values ```cpp auto post = db.posts().query() - ->setWhete(Post::idField().in(QList() << 1 << 2 << 3 << 4) || Post::isAccepted()) + ->where(Post::idField().in(QList() << 1 << 2 << 3 << 4) || Post::isAccepted()) ->first(); ``` Or ```cpp auto post = db.posts().query() - ->setWhete(Post::idField().in({1, 2, 3, 4}) || Post::isAccepted()) + ->where(Post::idField().in({1, 2, 3, 4}) || Post::isAccepted()) ->first(); ``` \ No newline at end of file diff --git a/doc/sharedpointer.md b/doc/sharedpointer.md new file mode 100644 index 0000000..85195f1 --- /dev/null +++ b/doc/sharedpointer.md @@ -0,0 +1,59 @@ +Nut can compile in *shared pointer* mode or *regular* mode + +In *shared pointer* mode reqults of queries is QList> and in *regular* mode results are QList + +Almost in every case shared pointer mode is better, But nut support regular mode for backward comptability. + +To compiling in *shared pointer* define **NUT_SHARED_POINTER** macro + +Nut has template alias + +```cpp +#ifdef NUT_SHARED_POINTER + template + using RowList = QList>; + + template + using Row = QSharedPointer; +#else + template + using RowList = QList; + + template + using Row = T*; +#endif +``` + +In other words these types are defined by this table: + +| Mode | Nut::Row | Nut::RowList | +|------ |----- |--------- | +|Regular|T* | QList\ | +|Shared pointer|QSharedPointer\ | QList\\> | + +For the integration of your source, you can use these aliases. + +Ans also Nut::create() method are defined for two mode + +```cpp +#ifdef NUT_SHARED_POINTER + template + inline Row create(QObject *parent) { + return QSharedPointer(new T(parent)); + } +#else + template + inline Row create() { + return new T; + } +#endif +``` + +So you can use the Nut::create function without considering in what way the library is being compiled. Example: +```cpp +auto post = Nut::create(); +``` + +In above example if *NUT_SHARED_POINTER* is defined *post* is *QSharedPointer* else is *Post\** + +I recommand use *NUT_SHARED_POINTER* always! \ No newline at end of file diff --git a/doc/start.md b/doc/start.md index a980903..8ce946d 100644 --- a/doc/start.md +++ b/doc/start.md @@ -1,10 +1,3 @@ -Welcome to the Nut wiki! - -# What is Nut - -Nut is advanced, Powerful and easy to use ORM for Qt5 - -## Sample Codes ### Read data from database: ```cpp @@ -50,12 +43,3 @@ if(post) { } ``` -## How to use nut - -* [Create database class](database.md) - -* [Create table class](table.md) - -* [Using queries](query.md) - -* [SUpported data types](datatypes.md) \ No newline at end of file