-
-
Notifications
You must be signed in to change notification settings - Fork 322
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #910 from fnc12/dev
1.8
- Loading branch information
Showing
279 changed files
with
24,797 additions
and
15,927 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,9 +2,14 @@ | |
<img src="https://github.com/fnc12/sqlite_orm/blob/master/logo.png" alt="Sublime's custom image" width="557"/> | ||
</p> | ||
|
||
[![Donate using PayPal](https://img.shields.io/badge/donate-PayPal-brightgreen.svg)](https://paypal.me/fnc12) | ||
[![Twitter URL](https://img.shields.io/twitter/url/https/twitter.com/fold_left.svg?style=social&label=Follow%20%40sqlite_orm)](https://twitter.com/sqlite_orm) | ||
|
||
[![C++](https://img.shields.io/badge/c++-%2300599C.svg?style=for-the-badge&logo=c%2B%2B&logoColor=white)](https://en.cppreference.com/w/) | ||
[![SQLite](https://img.shields.io/badge/sqlite-%2307405e.svg?style=for-the-badge&logo=sqlite&logoColor=white)](https://www.sqlite.org/index.html) | ||
[![GitHub Actions](https://img.shields.io/badge/githubactions-%232671E5.svg?style=for-the-badge&logo=githubactions&logoColor=white)](https://github.com/fnc12/sqlite_orm/actions) | ||
[![CMake](https://img.shields.io/badge/CMake-%23008FBA.svg?style=for-the-badge&logo=cmake&logoColor=white)](https://github.com/fnc12/sqlite_orm/blob/dev/CMakeLists.txt) | ||
[![Stack Overflow](https://img.shields.io/badge/-Stackoverflow-FE7A16?style=for-the-badge&logo=stack-overflow&logoColor=white)](https://stackoverflow.com/search?q=sqlite_orm) | ||
[![PayPal](https://img.shields.io/badge/PayPal-00457C?style=for-the-badge&logo=paypal&logoColor=white)](https://paypal.me/fnc12) | ||
[![Twitter](https://img.shields.io/badge/sqlite_orm-%231DA1F2.svg?style=for-the-badge&logo=Twitter&logoColor=white)](https://twitter.com/sqlite_orm) | ||
[![Patreon](https://img.shields.io/badge/Patreon-F96854?style=for-the-badge&logo=patreon&logoColor=white)](https://patreon.com/fnc12) | ||
|
||
# SQLite ORM | ||
SQLite ORM light header only library for modern C++. Please read the license precisely. The project has AGPL license for open source project and MIT license after purchasing it for 50$ (using [PayPal](https://paypal.me/fnc12) or any different way (contact using email [email protected])). | ||
|
@@ -79,18 +84,18 @@ Now we tell `sqlite_orm` library about our schema and provide database filename. | |
using namespace sqlite_orm; | ||
auto storage = make_storage("db.sqlite", | ||
make_table("users", | ||
make_column("id", &User::id, autoincrement(), primary_key()), | ||
make_column("id", &User::id, primary_key().autoincrement()), | ||
make_column("first_name", &User::firstName), | ||
make_column("last_name", &User::lastName), | ||
make_column("birth_date", &User::birthDate), | ||
make_column("image_url", &User::imageUrl), | ||
make_column("type_id", &User::typeId)), | ||
make_table("user_types", | ||
make_column("id", &UserType::id, autoincrement(), primary_key()), | ||
make_column("id", &UserType::id, primary_key().autoincrement()), | ||
make_column("name", &UserType::name, default_value("name_placeholder")))); | ||
``` | ||
|
||
Too easy isn't it? You do not have to specify mapped type explicitly - it is deduced from your member pointers you pass during making a column (for example: `&User::id`). To create a column you have to pass two arguments at least: its name in the table and your mapped class member pointer. You can also add extra arguments to tell your storage about column's constraints like `primary_key`, `autoincrement`, `default_value` or `unique`(order isn't important; `not_null` is deduced from type automatically). | ||
Too easy isn't it? You do not have to specify mapped type explicitly - it is deduced from your member pointers you pass during making a column (for example: `&User::id`). To create a column you have to pass two arguments at least: its name in the table and your mapped class member pointer. You can also add extra arguments to tell your storage about column's constraints like `primary_key`, `autoincrement`, `default_value`, `unique` or `generated_always_as` (order isn't important; `not_null` is deduced from type automatically). | ||
|
||
More details about making storage can be found in [tutorial](https://github.com/fnc12/sqlite_orm/wiki/Making-a-storage). | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,161 @@ | ||
# build format | ||
version: "{build}" | ||
|
||
skip_branch_with_pr: true | ||
skip_commits: | ||
files: | ||
- .git* | ||
- .travis.yml | ||
- _config.yml | ||
- LICENSE | ||
- '*.md' | ||
- '*.png' | ||
- '*.sh' | ||
|
||
image: | ||
- Visual Studio 2017 | ||
|
||
# configurations to add to build matrix | ||
# TODO: MinGW Makefiles and MSYS Makefiles | ||
configuration: | ||
- Debug | ||
- Release | ||
|
||
platform: | ||
- x86 | ||
- x64 | ||
|
||
environment: | ||
matrix: | ||
# using c++14 | ||
- SQLITE_ORM_CXX_STANDARD: "-DSQLITE_ORM_ENABLE_CXX_14=ON" | ||
|
||
# using C++17 (for std::optional support) | ||
- SQLITE_ORM_CXX_STANDARD: "-DSQLITE_ORM_ENABLE_CXX_17=ON" | ||
|
||
init: | ||
- echo %APPVEYOR_BUILD_WORKER_IMAGE% - %configuration% - %PLATFORM% | ||
- if "%PLATFORM%"=="x64" (set architecture=-A x64) | ||
- if "%PLATFORM%"=="x86" (set architecture=-A Win32) | ||
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2019" (set generator="Visual Studio 16 2019" %architecture%) | ||
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" (set generator="Visual Studio 15 2017" %architecture%) | ||
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" (set generator="Visual Studio 14 2015" %architecture%) | ||
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2013" (set generator="Visual Studio 12 2013" %architecture%) | ||
|
||
install: | ||
- C:\Tools\vcpkg\vcpkg integrate install | ||
- vcpkg install sqlite3:%PLATFORM%-windows | ||
|
||
# scripts to run before build | ||
before_build: | ||
- mkdir compile | ||
- cd compile | ||
- cmake %SQLITE_ORM_CXX_STANDARD% -DSqliteOrm_BuildTests=ON .. -G %generator% -DCMAKE_TOOLCHAIN_FILE=C:/Tools/vcpkg/scripts/buildsystems/vcpkg.cmake | ||
|
||
# build examples, and run tests (ie make & make test) | ||
build_script: | ||
- cmake --build . --config %configuration% | ||
- ctest --verbose --output-on-failure --build-config %configuration% | ||
# build format | ||
version: "{build}" | ||
|
||
skip_branch_with_pr: true | ||
skip_commits: | ||
files: | ||
- .git* | ||
- .travis.yml | ||
- _config.yml | ||
- LICENSE | ||
- '*.md' | ||
- '*.png' | ||
- '*.sh' | ||
|
||
# configurations to add to build matrix | ||
configuration: | ||
#- Debug | ||
- Release | ||
|
||
environment: | ||
appveyor_yml_disable_ps_linux: true | ||
matrix: | ||
- job_name: clang, C++14 | ||
appveyor_build_worker_image: Ubuntu | ||
CC: clang | ||
CXX: clang++ | ||
SQLITE_ORM_CXX_STANDARD: "-DSQLITE_ORM_ENABLE_CXX_14=ON" | ||
|
||
- job_name: gcc, C++14 | ||
appveyor_build_worker_image: Ubuntu | ||
CC: gcc | ||
CXX: g++ | ||
SQLITE_ORM_CXX_STANDARD: "-DSQLITE_ORM_ENABLE_CXX_14=ON" | ||
|
||
# Representative for C++14 | ||
- job_name: Visual Studio 2015 Update 3, x64, C++14 | ||
appveyor_build_worker_image: Visual Studio 2015 | ||
platform: x64 | ||
SQLITE_ORM_CXX_STANDARD: "" | ||
|
||
- job_name: clang, C++17 | ||
appveyor_build_worker_image: Ubuntu | ||
CC: clang | ||
CXX: clang++ | ||
SQLITE_ORM_CXX_STANDARD: "-DSQLITE_ORM_ENABLE_CXX_17=ON" | ||
|
||
- job_name: clang, C++20 | ||
appveyor_build_worker_image: Ubuntu | ||
CC: clang | ||
CXX: clang++ | ||
SQLITE_ORM_CXX_STANDARD: "-DSQLITE_ORM_ENABLE_CXX_20=ON" | ||
|
||
- job_name: gcc, C++17 | ||
appveyor_build_worker_image: Ubuntu | ||
CC: gcc | ||
CXX: g++ | ||
SQLITE_ORM_CXX_STANDARD: "-DSQLITE_ORM_ENABLE_CXX_17=ON" | ||
|
||
- job_name: gcc, C++20 | ||
appveyor_build_worker_image: Ubuntu | ||
CC: gcc | ||
CXX: g++ | ||
SQLITE_ORM_CXX_STANDARD: "-DSQLITE_ORM_ENABLE_CXX_20=ON" | ||
|
||
- job_name: Visual Studio 2022, x64, C++17 | ||
appveyor_build_worker_image: Visual Studio 2022 | ||
platform: x64 | ||
SQLITE_ORM_CXX_STANDARD: "-DSQLITE_ORM_ENABLE_CXX_17=ON" | ||
|
||
- job_name: Visual Studio 2022, x64, C++20 | ||
appveyor_build_worker_image: Visual Studio 2022 | ||
platform: x64 | ||
SQLITE_ORM_CXX_STANDARD: "-DSQLITE_ORM_ENABLE_CXX_20=ON" | ||
|
||
- job_name: Visual Studio 2022, x86, C++20 | ||
appveyor_build_worker_image: Visual Studio 2022 | ||
platform: x86 | ||
SQLITE_ORM_CXX_STANDARD: "-DSQLITE_ORM_ENABLE_CXX_20=ON" | ||
|
||
matrix: | ||
fast_finish: true | ||
|
||
for: | ||
- | ||
# Windows | ||
matrix: | ||
only: | ||
- appveyor_build_worker_image: Visual Studio 2015 | ||
- appveyor_build_worker_image: Visual Studio 2022 | ||
init: | ||
- |- | ||
echo %appveyor_build_worker_image% - %platform% - %configuration% | ||
if "%platform%"=="x64" (set architecture=-A x64) | ||
if "%platform%"=="x86" (set architecture=-A Win32) | ||
if "%appveyor_build_worker_image%"=="Visual Studio 2022" (set generator="Visual Studio 17 2022" %architecture%) | ||
if "%appveyor_build_worker_image%"=="Visual Studio 2015" (set generator="Visual Studio 14 2015" %architecture%) | ||
install: | ||
- |- | ||
C:\Tools\vcpkg\vcpkg integrate install | ||
vcpkg install sqlite3:%platform%-windows | ||
before_build: | ||
- |- | ||
mkdir compile | ||
cd compile | ||
cmake %SQLITE_ORM_CXX_STANDARD% -DSqliteOrm_BuildTests=ON .. -G %generator% -DCMAKE_TOOLCHAIN_FILE=C:/Tools/vcpkg/scripts/buildsystems/vcpkg.cmake | ||
# build examples, and run tests (ie make & make test) | ||
build_script: | ||
- |- | ||
cmake --build . --config %configuration% | ||
ctest --verbose --output-on-failure --build-config %configuration% | ||
- | ||
# Linux | ||
matrix: | ||
only: | ||
- appveyor_build_worker_image: Ubuntu | ||
init: | ||
- |- | ||
echo $appveyor_build_worker_image | ||
$CXX --version | ||
# using custom vcpkg triplets for building and linking dynamic dependent libraries | ||
install: | ||
- |- | ||
$HOME/vcpkg/vcpkg integrate install --overlay-triplets=vcpkg/triplets | ||
vcpkg install sqlite3 --overlay-triplets=vcpkg/triplets | ||
before_build: | ||
- |- | ||
mkdir compile | ||
cd compile | ||
cmake $SQLITE_ORM_CXX_STANDARD -DSqliteOrm_BuildTests=ON .. -DCMAKE_TOOLCHAIN_FILE=$HOME/vcpkg/scripts/buildsystems/vcpkg.cmake | ||
# build examples, and run tests (ie make & make test) | ||
build_script: | ||
- |- | ||
cmake --build . | ||
ctest --verbose --output-on-failure | ||
- | ||
# macOS | ||
matrix: | ||
only: | ||
- appveyor_build_worker_image: macOS | ||
init: | ||
- |- | ||
echo $appveyor_build_worker_image | ||
$CXX --version | ||
# using custom vcpkg triplets for building and linking dynamic dependent libraries | ||
install: | ||
- |- | ||
git clone --depth 1 --branch 2022.05.10 https://github.com/microsoft/vcpkg.git $HOME/vcpkg | ||
$HOME/vcpkg/booststrap.sh | ||
$HOME/vcpkg/vcpkg integrate install --overlay-triplets=vcpkg/triplets | ||
vcpkg install sqlite3 --overlay-triplets=vcpkg/triplets | ||
before_build: | ||
- |- | ||
mkdir compile | ||
cd compile | ||
cmake $SQLITE_ORM_CXX_STANDARD -DSqliteOrm_BuildTests=ON .. -DCMAKE_TOOLCHAIN_FILE=$HOME/vcpkg/scripts/buildsystems/vcpkg.cmake | ||
# build examples, and run tests (ie make & make test) | ||
build_script: | ||
- |- | ||
cmake --build . | ||
ctest --verbose --output-on-failure |
Oops, something went wrong.