few lines of doc & travis build only master branch

This commit is contained in:
Hamed Masafi 2019-06-20 12:59:57 +04:30
parent 126f214146
commit 97a9424163
6 changed files with 72 additions and 19 deletions

View File

@ -1,6 +1,10 @@
#Based on https://github.com/pcolby/libqtaws/blob/master/.travis.yml #Based on https://github.com/pcolby/libqtaws/blob/master/.travis.yml
language: cpp language: cpp
branches:
only:
- master
os: os:
- linux - linux
- osx - osx

Binary file not shown.

View File

@ -19,7 +19,13 @@ Badge](https://api.codacy.com/project/badge/Grade/f3802610beb946068f6cd2c2b6608a
- Table join detect - Table join detect
- Suppor every Qt types. [Full list](doc/datatypes.md) - 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 ### Donate
Butcoin address: 1Dn1WHKkaxanXe4cTGDk4cFRRABxLUpEVj Butcoin address: 1Dn1WHKkaxanXe4cTGDk4cFRRABxLUpEVj

View File

@ -56,12 +56,12 @@ auto count = q.count(Post::idField());
## Checking field exists in list of values ## Checking field exists in list of values
```cpp ```cpp
auto post = db.posts().query() auto post = db.posts().query()
->setWhete(Post::idField().in(QList<int>() << 1 << 2 << 3 << 4) || Post::isAccepted()) ->where(Post::idField().in(QList<int>() << 1 << 2 << 3 << 4) || Post::isAccepted())
->first(); ->first();
``` ```
Or Or
```cpp ```cpp
auto post = db.posts().query() 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(); ->first();
``` ```

59
doc/sharedpointer.md Normal file
View File

@ -0,0 +1,59 @@
Nut can compile in *shared pointer* mode or *regular* mode
In *shared pointer* mode reqults of queries is QList<QSharedPointer<T>> and in *regular* mode results are QList<T*>
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 <class T>
using RowList = QList<QSharedPointer<T>>;
template <typename T>
using Row = QSharedPointer<T>;
#else
template <typename T>
using RowList = QList<T*>;
template <typename T>
using Row = T*;
#endif
```
In other words these types are defined by this table:
| Mode | Nut::Row | Nut::RowList |
|------ |----- |--------- |
|Regular|T* | QList\<T\*\> |
|Shared pointer|QSharedPointer\<T\> | QList\<QSharedPointer\<T\>\> |
For the integration of your source, you can use these aliases.
Ans also Nut::create<T>() method are defined for two mode
```cpp
#ifdef NUT_SHARED_POINTER
template<class T>
inline Row<T> create(QObject *parent) {
return QSharedPointer<T>(new T(parent));
}
#else
template<class T>
inline Row<T> 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<Post>();
```
In above example if *NUT_SHARED_POINTER* is defined *post* is *QSharedPointer<Post>* else is *Post\**
I recommand use *NUT_SHARED_POINTER* always!

View File

@ -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: ### Read data from database:
```cpp ```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)