release-0.1.0
This commit is contained in:
commit
2eaf1bb157
85
.gitignore
vendored
Normal file
85
.gitignore
vendored
Normal file
@ -0,0 +1,85 @@
|
||||
*.class
|
||||
*.log
|
||||
*.ctxt
|
||||
.mtj.tmp/
|
||||
*.jar
|
||||
*.war
|
||||
*.nar
|
||||
*.ear
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
hs_err_pid*
|
||||
target/
|
||||
pom.xml.tag
|
||||
pom.xml.releaseBackup
|
||||
pom.xml.versionsBackup
|
||||
pom.xml.next
|
||||
release.properties
|
||||
dependency-reduced-pom.xml
|
||||
buildNumber.properties
|
||||
.mvn/timing.properties
|
||||
.mvn/wrapper/maven-wrapper.jar
|
||||
.idea/**/workspace.xml
|
||||
.idea/**/tasks.xml
|
||||
.idea/**/usage.statistics.xml
|
||||
.idea/**/dictionaries
|
||||
.idea/**/shelf
|
||||
.idea/**/contentModel.xml
|
||||
.idea/**/dataSources/
|
||||
.idea/**/dataSources.ids
|
||||
.idea/**/dataSources.local.xml
|
||||
.idea/**/sqlDataSources.xml
|
||||
.idea/**/dynamic.xml
|
||||
.idea/**/uiDesigner.xml
|
||||
.idea/**/dbnavigator.xml
|
||||
.idea/**/gradle.xml
|
||||
.idea/**/libraries
|
||||
cmake-build-*/
|
||||
.idea/**/mongoSettings.xml
|
||||
*.iws
|
||||
out/
|
||||
.idea_modules/
|
||||
atlassian-ide-plugin.xml
|
||||
.idea/replstate.xml
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
.idea/httpRequests
|
||||
.idea/caches/build_file_checksums.ser
|
||||
*~
|
||||
.fuse_hidden*
|
||||
.directory
|
||||
.Trash-*
|
||||
.nfs*
|
||||
Thumbs.db
|
||||
Thumbs.db:encryptable
|
||||
ehthumbs.db
|
||||
ehthumbs_vista.db
|
||||
*.stackdump
|
||||
[Dd]esktop.ini
|
||||
$RECYCLE.BIN/
|
||||
*.cab
|
||||
*.msi
|
||||
*.msix
|
||||
*.msm
|
||||
*.msp
|
||||
*.lnk
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
Icon
|
||||
._*
|
||||
.DocumentRevisions-V100
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
.com.apple.timemachine.donotpresent
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
175
pom.xml
Normal file
175
pom.xml
Normal file
@ -0,0 +1,175 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>dev.struchkov.haiti.filter.quarkus</groupId>
|
||||
<artifactId>haiti-filter-quarkus-reactive</artifactId>
|
||||
<version>0.1.0</version>
|
||||
|
||||
<name>Haiti Filter Reactive Quarkus</name>
|
||||
<description>JOOQ based filtering module</description>
|
||||
<url>https://github.com/haiti-projects/haiti-filter-reactive-quarkus</url>
|
||||
<licenses>
|
||||
<license>
|
||||
<name>BSD 3-Clause License</name>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
|
||||
<quarkus.platform.version>2.5.1.Final</quarkus.platform.version>
|
||||
<haiti.filter.jooq.version>0.1.0</haiti.filter.jooq.version>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.quarkus.platform</groupId>
|
||||
<artifactId>quarkus-bom</artifactId>
|
||||
<version>${quarkus.platform.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>dev.struchkov.haiti.filter</groupId>
|
||||
<artifactId>haiti-filter-jooq</artifactId>
|
||||
<version>${haiti.filter.jooq.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.smallrye.reactive</groupId>
|
||||
<artifactId>smallrye-mutiny-vertx-pg-client</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<scm>
|
||||
<connection>scm:git:https://github.com/haiti-projects/haiti-filter-reactive-quarkus.git</connection>
|
||||
<url>https://github.com/haiti-projects/haiti-filter-reactive-quarkus</url>
|
||||
<developerConnection>scm:git:https://github.com/haiti-projects/haiti-filter-reactive-quarkus.git</developerConnection>
|
||||
</scm>
|
||||
|
||||
<distributionManagement>
|
||||
<snapshotRepository>
|
||||
<id>ossrh</id>
|
||||
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.sonatype.plugins</groupId>
|
||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
||||
<version>${plugin.nexus.staging.ver}</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<serverId>ossrh</serverId>
|
||||
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
|
||||
<autoReleaseAfterClose>true</autoReleaseAfterClose>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>${plugin.maven.source.ver}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar-no-fork</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>${plugin.maven.javadoc.ver}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>${plugin.maven.gpg.ver}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<gpgArguments>
|
||||
<gpgArgument>--pinentry-mode</gpgArgument>
|
||||
<gpgArgument>loopback</gpgArgument>
|
||||
</gpgArguments>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>11</source>
|
||||
<target>11</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>release</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.sonatype.plugins</groupId>
|
||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<id>uPagge</id>
|
||||
<name>Struchkov Mark</name>
|
||||
<url>https://mark.struchkov.dev</url>
|
||||
<email>mark@struchkov.dev</email>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
</project>
|
@ -0,0 +1,93 @@
|
||||
package dev.struchkov.haiti.filter.quarkus;
|
||||
|
||||
import dev.struchkov.haiti.filter.Filter;
|
||||
import dev.struchkov.haiti.filter.FilterQuery;
|
||||
import dev.struchkov.haiti.filter.jooq.CriteriaJooqFilter;
|
||||
import dev.struchkov.haiti.filter.jooq.JoinTable;
|
||||
import io.smallrye.mutiny.Multi;
|
||||
import io.vertx.mutiny.pgclient.PgPool;
|
||||
import io.vertx.mutiny.sqlclient.Row;
|
||||
import lombok.NonNull;
|
||||
import org.jooq.DSLContext;
|
||||
import org.jooq.Query;
|
||||
import org.jooq.conf.ParamType;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
public class CriteriaFilter<T> implements Filter {
|
||||
|
||||
private final PgPool pgPool;
|
||||
private final CriteriaJooqFilter jooqFilter;
|
||||
private final Function<Row, T> mapper;
|
||||
|
||||
private CriteriaFilter(PgPool pgPool, String table, DSLContext dslContext, Function<Row, T> mapper) {
|
||||
dslContext.settings().withParamType(ParamType.NAMED_OR_INLINED);
|
||||
this.pgPool = pgPool;
|
||||
this.mapper = mapper;
|
||||
this.jooqFilter = CriteriaJooqFilter.create(table, dslContext);
|
||||
}
|
||||
|
||||
public static <T> CriteriaFilter<T> create(PgPool pgPool, String table, DSLContext dslContext, Function<Row, T> mapper) {
|
||||
return new CriteriaFilter<>(pgPool, table, dslContext, mapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Filter and(FilterQuery filterQuery) {
|
||||
jooqFilter.and(filterQuery);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Filter and(Consumer<FilterQuery> query) {
|
||||
jooqFilter.and(query);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Filter or(FilterQuery filterQuery) {
|
||||
jooqFilter.or(filterQuery);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Filter or(Consumer<FilterQuery> query) {
|
||||
jooqFilter.or(query);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Filter not(FilterQuery filterQuery) {
|
||||
jooqFilter.not(filterQuery);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Filter not(Consumer<FilterQuery> query) {
|
||||
jooqFilter.not(query);
|
||||
return this;
|
||||
}
|
||||
|
||||
public CriteriaFilter<T> page(@NonNull String fieldOrder, Object id, int pageSize) {
|
||||
jooqFilter.page(fieldOrder, id, pageSize);
|
||||
return this;
|
||||
}
|
||||
|
||||
public CriteriaFilter<T> join(@NonNull JoinTable... joinTables) {
|
||||
jooqFilter.join(joinTables);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Multi<T> build() {
|
||||
final Query query = jooqFilter.build();
|
||||
return pgPool.preparedQuery(query.getSQL())
|
||||
.execute()
|
||||
.onItem()
|
||||
.transformToMulti(rows -> Multi.createFrom().items(
|
||||
StreamSupport.stream(rows.spliterator(), false)
|
||||
))
|
||||
.map(mapper);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user