mirror of
https://github.com/oatpp/oatpp-postgresql.git
synced 2024-11-21 01:05:09 +08:00
parent
f3aa02297f
commit
fe7b1d525c
@ -97,6 +97,7 @@ find_package(PostgreSQL REQUIRED)
|
||||
message("PostgreSQL_INCLUDE_DIRS=${PostgreSQL_INCLUDE_DIRS}")
|
||||
message("PostgreSQL_LIBRARIES=${PostgreSQL_LIBRARIES}")
|
||||
message("PostgreSQL_TYPE_INCLUDE_DIR=${PostgreSQL_TYPE_INCLUDE_DIR}")
|
||||
message("PostgreSQL_VERSION_STRING=${PostgreSQL_VERSION_STRING}")
|
||||
|
||||
message("\n############################################################################\n")
|
||||
|
||||
|
25
Dockerfile
Normal file
25
Dockerfile
Normal file
@ -0,0 +1,25 @@
|
||||
FROM lganzzzo/alpine-cmake:latest
|
||||
|
||||
RUN apk update
|
||||
|
||||
RUN apk add postgresql-dev
|
||||
|
||||
WORKDIR /module
|
||||
|
||||
COPY ./cmake cmake
|
||||
COPY ./src src
|
||||
COPY ./test test
|
||||
COPY ./utility utility
|
||||
COPY ./CMakeLists.txt CMakeLists.txt
|
||||
|
||||
WORKDIR /module/utility
|
||||
|
||||
RUN ./install-oatpp-modules.sh
|
||||
|
||||
WORKDIR /module/build
|
||||
|
||||
ARG PG_HOST=postgres
|
||||
RUN cmake ..
|
||||
RUN make
|
||||
|
||||
ENTRYPOINT ["./test/module-tests"]
|
@ -13,81 +13,8 @@ jobs:
|
||||
clean: all
|
||||
steps:
|
||||
- script: |
|
||||
mkdir build
|
||||
docker-compose build
|
||||
displayName: 'Compose build'
|
||||
- script: |
|
||||
git clone https://github.com/oatpp/oatpp
|
||||
mkdir -p oatpp/build
|
||||
displayName: 'Checkout - oatpp'
|
||||
workingDirectory: build
|
||||
- script: |
|
||||
cmake ..
|
||||
sudo make install
|
||||
displayName: 'Build - oatpp'
|
||||
workingDirectory: build/oatpp/build
|
||||
- script: |
|
||||
cmake ..
|
||||
make
|
||||
displayName: 'Build - module'
|
||||
workingDirectory: build
|
||||
- script: |
|
||||
make test ARGS="-V"
|
||||
displayName: 'Test'
|
||||
workingDirectory: build
|
||||
- job: macOS
|
||||
displayName: 'Build - macOS'
|
||||
continueOnError: false
|
||||
pool:
|
||||
vmImage: 'macOS-10.14'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- script: |
|
||||
mkdir build
|
||||
- script: |
|
||||
git clone https://github.com/oatpp/oatpp
|
||||
mkdir -p oatpp/build
|
||||
displayName: 'Checkout - oatpp'
|
||||
workingDirectory: build
|
||||
- script: |
|
||||
cmake ..
|
||||
sudo make install
|
||||
displayName: 'Build - oatpp'
|
||||
workingDirectory: build/oatpp/build
|
||||
- script: |
|
||||
cmake ..
|
||||
make
|
||||
displayName: 'Build - module'
|
||||
workingDirectory: build
|
||||
- script: |
|
||||
make test ARGS="-V"
|
||||
displayName: 'Test'
|
||||
workingDirectory: build
|
||||
- job: windows
|
||||
displayName: 'Build - Windows'
|
||||
continueOnError: false
|
||||
pool:
|
||||
vmImage: 'windows-latest'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- script: |
|
||||
MD build
|
||||
- script: |
|
||||
git clone https://github.com/oatpp/oatpp
|
||||
MD oatpp\build
|
||||
displayName: 'Checkout - oatpp'
|
||||
workingDirectory: build
|
||||
- script: |
|
||||
cmake ..
|
||||
cmake --build . --target INSTALL
|
||||
displayName: 'Build - oatpp'
|
||||
workingDirectory: build\oatpp\build
|
||||
- script: |
|
||||
cmake ..
|
||||
cmake --build .
|
||||
displayName: 'Build - module'
|
||||
workingDirectory: build
|
||||
- script: |
|
||||
module-tests.exe
|
||||
displayName: 'Test'
|
||||
workingDirectory: build\test\Debug\
|
||||
docker-compose run test
|
||||
displayName: 'Compose run'
|
||||
|
@ -1,7 +1,8 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
db:
|
||||
|
||||
postgres:
|
||||
image: postgres
|
||||
restart: always
|
||||
environment:
|
||||
@ -9,8 +10,8 @@ services:
|
||||
ports:
|
||||
- 5432:5432
|
||||
|
||||
adminer:
|
||||
image: adminer
|
||||
restart: always
|
||||
ports:
|
||||
- 8080:8080
|
||||
test:
|
||||
build: .
|
||||
depends_on:
|
||||
- postgres
|
||||
|
||||
|
@ -38,10 +38,11 @@ target_link_oatpp(${OATPP_THIS_MODULE_NAME})
|
||||
|
||||
target_include_directories(${OATPP_THIS_MODULE_NAME}
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
${PostgreSQL_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_link_libraries(${OATPP_THIS_MODULE_NAME}
|
||||
PUBLIC PostgreSQL::PostgreSQL
|
||||
PUBLIC ${PostgreSQL_LIBRARIES}
|
||||
)
|
||||
|
||||
#######################################################################################################
|
||||
|
@ -92,9 +92,13 @@ Executor::QueryParams::QueryParams(const StringTemplate& queryTemplate,
|
||||
|
||||
auto value = typeResolver->resolveObjectPropertyValue(it->second, queryParameter.propertyPath, cache);
|
||||
if(value.valueType->classId.id == oatpp::Void::Class::CLASS_ID.id) {
|
||||
std::string tname = "UnNamed";
|
||||
if(extra->templateName) {
|
||||
tname = extra->templateName->std_str();
|
||||
}
|
||||
throw std::runtime_error("[oatpp::postgresql::Executor::QueryParams::QueryParams()]: "
|
||||
"Error."
|
||||
" Query '" + extra->templateName->std_str() +
|
||||
" Query '" + tname +
|
||||
"', parameter '" + var.name->std_str() +
|
||||
"' - property not found or its type is unknown.");
|
||||
}
|
||||
|
@ -1,5 +1,13 @@
|
||||
if(DEFINED ENV{PG_HOST})
|
||||
set(POSTGRES_HOST $ENV{PG_HOST})
|
||||
else()
|
||||
set(POSTGRES_HOST localhost)
|
||||
endif()
|
||||
|
||||
message("POSTGRES_HOST=${POSTGRES_HOST}")
|
||||
|
||||
add_definitions (
|
||||
-DTEST_DB_URL="postgresql://postgres:db-pass@localhost:5432/postgres"
|
||||
-DTEST_DB_URL="postgresql://postgres:db-pass@${POSTGRES_HOST}:5432/postgres"
|
||||
-DTEST_DB_MIGRATION="${CMAKE_CURRENT_SOURCE_DIR}/oatpp-postgresql/migration/"
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user