Compare commits
No commits in common. "develop" and "master" have entirely different histories.
109
.drone.yml
109
.drone.yml
@ -1,109 +0,0 @@
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: snapshot-publish
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- develop
|
||||
|
||||
volumes:
|
||||
- name: m2
|
||||
host:
|
||||
path: /drone/volume/m2
|
||||
|
||||
steps:
|
||||
- name: publish
|
||||
image: hub.docker.struchkov.dev/maven:3.9.5-eclipse-temurin-17-alpine
|
||||
privileged: true
|
||||
volumes:
|
||||
- name: m2
|
||||
path: /root/.m2/repository
|
||||
environment:
|
||||
MAVEN_SETTINGS:
|
||||
from_secret: MAVEN_SETTINGS
|
||||
commands:
|
||||
- echo "$MAVEN_SETTINGS" >> maven-settings.xml
|
||||
- mvn --settings maven-settings.xml -U -P snapshot clean deploy
|
||||
|
||||
image_pull_secrets:
|
||||
- DOCKER_AUTH
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: release-maven-central
|
||||
|
||||
trigger:
|
||||
ref:
|
||||
- refs/tags/v.*.*.*
|
||||
|
||||
volumes:
|
||||
- name: m2
|
||||
host:
|
||||
path: /drone/volume/m2
|
||||
|
||||
steps:
|
||||
- name: publish maven central
|
||||
image: hub.docker.struchkov.dev/maven:3.9.5-eclipse-temurin-17-alpine
|
||||
privileged: true
|
||||
volumes:
|
||||
- name: m2
|
||||
path: /root/.m2/repository
|
||||
environment:
|
||||
GPG_PRIVATE_KEY:
|
||||
from_secret: GPG_PRIVATE_KEY
|
||||
MAVEN_SETTINGS:
|
||||
from_secret: MAVEN_SETTINGS
|
||||
GPG_PASSPHRASE:
|
||||
from_secret: GPG_PASSPHRASE
|
||||
commands:
|
||||
- apk add --no-cache gnupg
|
||||
- echo "$GPG_PRIVATE_KEY" >> gpg.key
|
||||
- echo "$MAVEN_SETTINGS" >> maven-settings.xml
|
||||
- gpg --pinentry-mode loopback --passphrase $GPG_PASSPHRASE --import gpg.key
|
||||
- mvn --settings maven-settings.xml -U -P ossrh,release clean deploy
|
||||
|
||||
image_pull_secrets:
|
||||
- DOCKER_AUTH
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: release-struchkov-nexus
|
||||
|
||||
trigger:
|
||||
ref:
|
||||
- refs/tags/v.*.*.*
|
||||
|
||||
volumes:
|
||||
- name: m2
|
||||
host:
|
||||
path: /drone/volume/m2
|
||||
|
||||
steps:
|
||||
- name: publish struchkov nexus
|
||||
image: hub.docker.struchkov.dev/maven:3.9.5-eclipse-temurin-17-alpine
|
||||
privileged: true
|
||||
volumes:
|
||||
- name: m2
|
||||
path: /root/.m2/repository
|
||||
environment:
|
||||
GPG_PRIVATE_KEY:
|
||||
from_secret: GPG_PRIVATE_KEY
|
||||
MAVEN_SETTINGS:
|
||||
from_secret: MAVEN_SETTINGS
|
||||
GPG_PASSPHRASE:
|
||||
from_secret: GPG_PASSPHRASE
|
||||
commands:
|
||||
- apk add --no-cache gnupg
|
||||
- echo "$GPG_PRIVATE_KEY" >> gpg.key
|
||||
- echo "$MAVEN_SETTINGS" >> maven-settings.xml
|
||||
- gpg --pinentry-mode loopback --passphrase $GPG_PASSPHRASE --import gpg.key
|
||||
- mvn --settings maven-settings.xml -U -P ossrh,release-struchkov-nexus clean deploy
|
||||
|
||||
image_pull_secrets:
|
||||
- DOCKER_AUTH
|
||||
---
|
||||
kind: signature
|
||||
hmac: 2288dcbae543b712c60d1e1a5b7cc513a06515939d45bf77237e79642b406048
|
||||
|
||||
...
|
18
.gitignore
vendored
18
.gitignore
vendored
@ -20,7 +20,21 @@ dependency-reduced-pom.xml
|
||||
buildNumber.properties
|
||||
.mvn/timing.properties
|
||||
.mvn/wrapper/maven-wrapper.jar
|
||||
.idea/
|
||||
.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
|
||||
@ -32,6 +46,8 @@ com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
.idea/httpRequests
|
||||
.idea/caches/build_file_checksums.ser
|
||||
*~
|
||||
.fuse_hidden*
|
||||
.directory
|
||||
|
17
.gitlab-ci.yml
Normal file
17
.gitlab-ci.yml
Normal file
@ -0,0 +1,17 @@
|
||||
image: maven:3.8.4-openjdk-11
|
||||
variables:
|
||||
MAVEN_OPTS: "-Dmaven.repo.local=./.m2/repository"
|
||||
|
||||
stages:
|
||||
- deploy
|
||||
|
||||
deploy:
|
||||
stage: deploy
|
||||
only:
|
||||
- /^v.*$/
|
||||
except:
|
||||
- branches
|
||||
before_script:
|
||||
- gpg --pinentry-mode loopback --passphrase $GPG_PASSPHRASE --import $GPG_PRIVATE_KEY
|
||||
script:
|
||||
- 'mvn --settings $MAVEN_SETTINGS -U -P ossrh,release clean deploy'
|
158
pom.xml
158
pom.xml
@ -1,10 +1,12 @@
|
||||
<?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">
|
||||
<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</groupId>
|
||||
<artifactId>haiti-filter-jooq</artifactId>
|
||||
<version>1.4.1-SNAPSHOT</version>
|
||||
<version>0.5.0</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Haiti Filter JOOQ</name>
|
||||
@ -22,37 +24,26 @@
|
||||
</issueManagement>
|
||||
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
<java.version>11</java.version>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.jooq/jooq -->
|
||||
<jooq.version>3.18.4</jooq.version>
|
||||
<jooq.version>3.15.6</jooq.version>
|
||||
|
||||
<haiti.version>3.0.3</haiti.version>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-compiler-plugin -->
|
||||
<plugin.maven.compiler.ver>3.13.0</plugin.maven.compiler.ver>
|
||||
<!-- https://mvnrepository.com/artifact/org.sonatype.plugins/nexus-staging-maven-plugin -->
|
||||
<plugin.nexus.staging.ver>1.7.0</plugin.nexus.staging.ver>
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-source-plugin -->
|
||||
<plugin.maven.source.ver>3.3.1</plugin.maven.source.ver>
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-javadoc-plugin -->
|
||||
<plugin.maven.javadoc.ver>3.7.0</plugin.maven.javadoc.ver>
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-gpg-plugin -->
|
||||
<plugin.maven.gpg.ver>3.2.4</plugin.maven.gpg.ver>
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-release-plugin -->
|
||||
<plugin.maven.release.ver>3.1.0</plugin.maven.release.ver>
|
||||
<plugin.nexus.staging.ver>1.6.8</plugin.nexus.staging.ver>
|
||||
<plugin.maven.source.ver>3.2.1</plugin.maven.source.ver>
|
||||
<plugin.maven.javadoc.ver>3.3.1</plugin.maven.javadoc.ver>
|
||||
<plugin.maven.gpg.ver>3.0.1</plugin.maven.gpg.ver>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>dev.struchkov.haiti</groupId>
|
||||
<artifactId>haiti-dependencies</artifactId>
|
||||
<version>${haiti.version}</version>
|
||||
<artifactId>haiti-bom</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
@ -78,28 +69,6 @@
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>${plugin.maven.compiler.ver}</version>
|
||||
<configuration>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-release-plugin</artifactId>
|
||||
<version>${plugin.maven.release.ver}</version>
|
||||
<configuration>
|
||||
<preparationGoals>clean install</preparationGoals>
|
||||
<tagNameFormat>v.@{project.version}</tagNameFormat>
|
||||
<autoVersionSubmodules>true</autoVersionSubmodules>
|
||||
<pushChanges>false</pushChanges>
|
||||
<localCheckout>true</localCheckout>
|
||||
<signTag>true</signTag>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.sonatype.plugins</groupId>
|
||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
||||
@ -164,6 +133,10 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>11</source>
|
||||
<target>11</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
@ -189,117 +162,32 @@
|
||||
<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>
|
||||
<profile>
|
||||
<id>release-struchkov-nexus</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.sonatype.plugins</groupId>
|
||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<serverId>struchkov-nexus</serverId>
|
||||
<nexusUrl>https://nexus.struchkov.dev/nexus/</nexusUrl>
|
||||
<autoReleaseAfterClose>true</autoReleaseAfterClose>
|
||||
<skipStaging>true</skipStaging>
|
||||
</configuration>
|
||||
</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>
|
||||
<profile>
|
||||
<id>snapshot</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.sonatype.plugins</groupId>
|
||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<serverId>struchkov-nexus</serverId>
|
||||
<nexusUrl>https://nexus.struchkov.dev/nexus/</nexusUrl>
|
||||
<autoReleaseAfterClose>true</autoReleaseAfterClose>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>struchkov-nexus-release</id>
|
||||
<url>https://nexus.struchkov.dev/repository/maven-releases/</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
<updatePolicy>always</updatePolicy>
|
||||
<checksumPolicy>fail</checksumPolicy>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>struchkov-nexus-snapshot</id>
|
||||
<url>https://nexus.struchkov.dev/repository/maven-snapshots/</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
<updatePolicy>always</updatePolicy>
|
||||
<checksumPolicy>warn</checksumPolicy>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>struchkov-nexus-release</id>
|
||||
<url>https://nexus.struchkov.dev/repository/maven-releases/</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>struchkov-nexus-snapshot</id>
|
||||
<url>https://nexus.struchkov.dev/repository/maven-snapshots/</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
|
||||
<scm>
|
||||
<connection>scm:git:https://github.com/haiti-projects/haiti-filter-jooq.git</connection>
|
||||
<url>https://github.com/haiti-projects/haiti-filter-jooq</url>
|
||||
<developerConnection>scm:git:https://github.com/haiti-projects/haiti-filter-jooq.git</developerConnection>
|
||||
<tag>HEAD</tag>
|
||||
</scm>
|
||||
|
||||
<distributionManagement>
|
||||
<snapshotRepository>
|
||||
<id>ossrh</id>
|
||||
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<id>uPagge</id>
|
||||
|
@ -5,10 +5,9 @@ import dev.struchkov.haiti.filter.jooq.join.JoinTable;
|
||||
import dev.struchkov.haiti.filter.jooq.join.JoinTypeOperation;
|
||||
import dev.struchkov.haiti.filter.jooq.page.PageableOffset;
|
||||
import dev.struchkov.haiti.filter.jooq.page.PageableSeek;
|
||||
import dev.struchkov.haiti.filter.jooq.sort.NullOrderType;
|
||||
import dev.struchkov.haiti.filter.jooq.sort.SortContainer;
|
||||
import dev.struchkov.haiti.filter.jooq.sort.SortType;
|
||||
import dev.struchkov.haiti.utils.Inspector;
|
||||
import dev.struchkov.haiti.utils.Assert;
|
||||
import org.jooq.Condition;
|
||||
import org.jooq.DSLContext;
|
||||
import org.jooq.Field;
|
||||
@ -31,12 +30,10 @@ import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static dev.struchkov.haiti.filter.jooq.exception.FilterJooqHaitiException.filterJooqException;
|
||||
import static java.util.stream.Collectors.toList;
|
||||
import static org.jooq.impl.DSL.condition;
|
||||
import static org.jooq.impl.DSL.field;
|
||||
|
||||
@ -44,6 +41,7 @@ public class CriteriaJooqFilter {
|
||||
|
||||
private final List<Condition> andConditions = new ArrayList<>();
|
||||
private final List<Condition> orConditions = new ArrayList<>();
|
||||
private final List<Condition> notConditions = new ArrayList<>();
|
||||
private final List<JoinTable> joinTables = new ArrayList<>();
|
||||
|
||||
private final Table<Record> generalTable;
|
||||
@ -87,16 +85,27 @@ public class CriteriaJooqFilter {
|
||||
return this;
|
||||
}
|
||||
|
||||
// FIXME: Добавить поддержку
|
||||
// public CriteriaJooqFilter not(FilterQuery filterQuery) {
|
||||
// throw new IllegalStateException("Операция отрицания пока не поддерживается");
|
||||
// }
|
||||
|
||||
|
||||
// FIXME: Добавить поддержку
|
||||
// public CriteriaJooqFilter not(Consumer<FilterQuery> query) {
|
||||
// throw new IllegalStateException("Операция отрицания пока не поддерживается");
|
||||
// }
|
||||
|
||||
public CriteriaJooqFilter page(PageableOffset offset) {
|
||||
Inspector.isNotNull(offset);
|
||||
Inspector.isNull(seek, filterJooqException("Нельзя установить два типа пагинации одновременно"));
|
||||
Assert.isNotNull(offset);
|
||||
Assert.isNull(seek, filterJooqException("Нельзя установить два типа пагинации одновременно"));
|
||||
this.offset = offset;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CriteriaJooqFilter page(PageableSeek seek) {
|
||||
Inspector.isNotNull(seek);
|
||||
Inspector.isNull(offset, filterJooqException("Нельзя установить два типа пагинации одновременно"));
|
||||
Assert.isNotNull(seek);
|
||||
Assert.isNull(offset, filterJooqException("Нельзя установить два типа пагинации одновременно"));
|
||||
this.seek = seek;
|
||||
return this;
|
||||
}
|
||||
@ -115,13 +124,6 @@ public class CriteriaJooqFilter {
|
||||
return this;
|
||||
}
|
||||
|
||||
public CriteriaJooqFilter sort(String field, SortType sortType, NullOrderType nullsOrder) {
|
||||
if (field != null) {
|
||||
this.sorts.add(SortContainer.of(field, sortType, nullsOrder));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public CriteriaJooqFilter sort(String field) {
|
||||
if (field != null) {
|
||||
this.sorts.add(SortContainer.of(field));
|
||||
@ -151,8 +153,8 @@ public class CriteriaJooqFilter {
|
||||
}
|
||||
|
||||
public CriteriaJooqFilter join(JoinTable... joinTables) {
|
||||
Inspector.isNotNull(joinTables);
|
||||
this.joinTables.addAll(Arrays.stream(joinTables).collect(toList()));
|
||||
Assert.isNotNull(joinTables);
|
||||
this.joinTables.addAll(Arrays.stream(joinTables).collect(Collectors.toList()));
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -165,7 +167,7 @@ public class CriteriaJooqFilter {
|
||||
}
|
||||
|
||||
public Query generateQuery(String... fields) {
|
||||
final List<Field<Object>> selectFields = Arrays.stream(fields).map(DSL::field).collect(toList());
|
||||
final List<Field<Object>> selectFields = Arrays.stream(fields).map(DSL::field).collect(Collectors.toList());
|
||||
final SelectSelectStep<Record> mainSelect = !selectFields.isEmpty() ? dsl.select(selectFields) : dsl.select();
|
||||
final SelectLimitStep<? extends Record> selectSeekStepN = generate(mainSelect);
|
||||
return setPaginationOffset(selectSeekStepN);
|
||||
@ -187,9 +189,7 @@ public class CriteriaJooqFilter {
|
||||
|
||||
private SelectLimitStep<? extends Record> getOrderBy(SelectHavingStep<? extends Record> groupBy) {
|
||||
if (!sorts.isEmpty()) {
|
||||
final SelectSeekStepN<? extends Record> sort = groupBy.orderBy(getOrderBy());
|
||||
setPaginationSeek(sort);
|
||||
return sort;
|
||||
return groupBy.orderBy(getOrderBy());
|
||||
}
|
||||
return groupBy;
|
||||
}
|
||||
@ -199,7 +199,7 @@ public class CriteriaJooqFilter {
|
||||
return where.groupBy(
|
||||
groupByFields.stream()
|
||||
.map(DSL::field)
|
||||
.collect(toList())
|
||||
.collect(Collectors.toList())
|
||||
);
|
||||
}
|
||||
return where;
|
||||
@ -209,34 +209,24 @@ public class CriteriaJooqFilter {
|
||||
if (!joinTables.isEmpty()) {
|
||||
for (JoinTable joinTable : joinTables) {
|
||||
final String tableName = joinTable.getTableName();
|
||||
String fieldBase = joinTable.getFieldBase();
|
||||
String fieldReference = joinTable.getFieldReference();
|
||||
|
||||
Table<Record> dlsJoinTableName = DSL.table(tableName);
|
||||
|
||||
if (joinTable.getAlias() != null) {
|
||||
dlsJoinTableName = dlsJoinTableName.as(joinTable.getAlias());
|
||||
fieldReference = joinTable.getAlias() + "." + fieldReference;
|
||||
} else {
|
||||
fieldReference = tableName + "." + fieldReference;
|
||||
}
|
||||
|
||||
final Set<Condition> joinConditions = joinTable.getFieldReferences().stream()
|
||||
.map(reference -> {
|
||||
String fieldBase = reference.getBaseField();
|
||||
String fieldReference = reference.getReferenceField();
|
||||
|
||||
if (joinTable.getAlias() != null) {
|
||||
fieldReference = joinTable.getAlias() + "." + fieldReference;
|
||||
} else {
|
||||
fieldReference = tableName + "." + fieldReference;
|
||||
}
|
||||
|
||||
final Field dslFieldBase = field(fieldBase);
|
||||
final Field dslFieldReference = field(fieldReference);
|
||||
|
||||
return dslFieldBase.eq(dslFieldReference);
|
||||
|
||||
})
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
final JoinTypeOperation joinType = joinTable.getJoinTypeOperation();
|
||||
|
||||
final Condition on = DSL.and(joinConditions);
|
||||
final Field dslFieldBase = field(fieldBase);
|
||||
final Field dslFieldReference = field(fieldReference);
|
||||
|
||||
final Condition on = dslFieldBase.eq(dslFieldReference);
|
||||
switch (joinType) {
|
||||
case LEFT:
|
||||
from = from.leftJoin(dlsJoinTableName).on(on);
|
||||
@ -268,14 +258,12 @@ public class CriteriaJooqFilter {
|
||||
if (!sorts.isEmpty()) {
|
||||
final List<SortField<Object>> newSorts = new ArrayList<>();
|
||||
for (SortContainer sort : sorts) {
|
||||
final NullOrderType nullOrderType = sort.getNullOrderType();
|
||||
final SortType sortType = sort.getType();
|
||||
final String fieldName = sort.getFieldName();
|
||||
final SortField<Object> sortField = SortType.ASC.equals(sortType) ? field(fieldName).asc() : field(fieldName).desc();
|
||||
if (NullOrderType.LAST.equals(nullOrderType)) {
|
||||
newSorts.add(sortField.nullsLast());
|
||||
if (SortType.ASC.equals(sortType)) {
|
||||
newSorts.add(field(fieldName).asc());
|
||||
} else {
|
||||
newSorts.add(sortField.nullsFirst());
|
||||
newSorts.add(field(fieldName).desc());
|
||||
}
|
||||
}
|
||||
return newSorts;
|
||||
@ -285,16 +273,18 @@ public class CriteriaJooqFilter {
|
||||
|
||||
private void setPaginationSeek(SelectSeekStepN<? extends Record> sort) {
|
||||
if (seek != null) {
|
||||
Inspector.isNotNull(() -> new FilterJooqHaitiException("При использовании пагинации типа seek необходимо указать сортировку"), sort);
|
||||
Assert.isNotNull(sort, () -> new FilterJooqHaitiException("При использовании пагинации типа seek необходимо указать сортировку"));
|
||||
final Integer pageSize = seek.getPageSize();
|
||||
final Object[] values = seek.getValues();
|
||||
if (values != null) {
|
||||
sort
|
||||
.seek(values)
|
||||
.limit(pageSize);
|
||||
} else {
|
||||
sort
|
||||
.limit(pageSize);
|
||||
final Object lastId = seek.getLastId();
|
||||
if (pageSize != null) {
|
||||
if (lastId != null) {
|
||||
sort
|
||||
.seek(lastId)
|
||||
.limit(pageSize);
|
||||
} else {
|
||||
sort
|
||||
.limit(pageSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package dev.struchkov.haiti.filter.jooq;
|
||||
|
||||
import dev.struchkov.haiti.utils.Inspector;
|
||||
import dev.struchkov.haiti.utils.Assert;
|
||||
import org.jooq.Condition;
|
||||
import org.jooq.Field;
|
||||
import org.jooq.impl.DSL;
|
||||
@ -10,7 +10,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static dev.struchkov.haiti.utils.Checker.checkNotEmpty;
|
||||
import static org.jooq.impl.DSL.condition;
|
||||
import static org.jooq.impl.DSL.field;
|
||||
|
||||
@ -27,7 +26,7 @@ public class CriteriaJooqQuery {
|
||||
}
|
||||
|
||||
public <Y extends Comparable<? super Y>> CriteriaJooqQuery between(String field, Y from, Y to) {
|
||||
Inspector.isNotNull(field);
|
||||
Assert.isNotNull(field);
|
||||
if (from != null && to != null) {
|
||||
Condition condition = DSL.field(field).between(from, to);
|
||||
conditions.add(condition);
|
||||
@ -35,17 +34,8 @@ public class CriteriaJooqQuery {
|
||||
return this;
|
||||
}
|
||||
|
||||
public <Y extends Comparable<? super Y>> CriteriaJooqQuery notBetween(String field, Y from, Y to) {
|
||||
Inspector.isNotNull(field);
|
||||
if (from != null && to != null) {
|
||||
Condition condition = DSL.field(field).notBetween(from, to);
|
||||
conditions.add(condition);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public CriteriaJooqQuery matchPhrase(String field, Object value) {
|
||||
Inspector.isNotNull(field);
|
||||
Assert.isNotNull(field);
|
||||
if (value != null) {
|
||||
final Condition condition = condition(Map.of(field(field), value));
|
||||
conditions.add(condition);
|
||||
@ -53,16 +43,8 @@ public class CriteriaJooqQuery {
|
||||
return this;
|
||||
}
|
||||
|
||||
public CriteriaJooqQuery matchPhrase(String field, Object... values) {
|
||||
Inspector.isNotNull(field);
|
||||
if (checkNotEmpty(values)) {
|
||||
conditions.add(DSL.field(field).in(values));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public <U> CriteriaJooqQuery matchPhrase(String field, Set<U> values) {
|
||||
Inspector.isNotNull(field);
|
||||
Assert.isNotNull(field);
|
||||
if (values != null) {
|
||||
if (values.isEmpty()) {
|
||||
conditions.add(DSL.field(field).isNull());
|
||||
@ -73,35 +55,6 @@ public class CriteriaJooqQuery {
|
||||
return this;
|
||||
}
|
||||
|
||||
public CriteriaJooqQuery notMatchPhrase(String field, Object value) {
|
||||
Inspector.isNotNull(field);
|
||||
if (value != null) {
|
||||
final Condition condition = condition(Map.of(field(field), value)).not();
|
||||
conditions.add(condition);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public <U> CriteriaJooqQuery notMatchPhrase(String field, Set<U> values) {
|
||||
Inspector.isNotNull(field);
|
||||
if (values != null) {
|
||||
if (values.isEmpty()) {
|
||||
conditions.add(DSL.field(field).isNull().not());
|
||||
} else {
|
||||
conditions.add(DSL.field(field).in(values).not());
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public CriteriaJooqQuery notMatchPhrase(String field, Object... values) {
|
||||
Inspector.isNotNull(field);
|
||||
if (checkNotEmpty(values)) {
|
||||
conditions.add(DSL.field(field).in(values).not());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public CriteriaJooqQuery exists(String field) {
|
||||
if (field != null) {
|
||||
conditions.add(DSL.field(field).isNotNull());
|
||||
@ -109,13 +62,6 @@ public class CriteriaJooqQuery {
|
||||
return this;
|
||||
}
|
||||
|
||||
public CriteriaJooqQuery notExists(String field) {
|
||||
if (field != null) {
|
||||
conditions.add(DSL.field(field).isNull());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public CriteriaJooqQuery like(String field, String value) {
|
||||
like(field, value, false);
|
||||
return this;
|
||||
@ -126,18 +72,8 @@ public class CriteriaJooqQuery {
|
||||
return this;
|
||||
}
|
||||
|
||||
public CriteriaJooqQuery notLike(String field, String value) {
|
||||
notLike(field, value, false);
|
||||
return this;
|
||||
}
|
||||
|
||||
public CriteriaJooqQuery notLikeIgnoreCase(String field, String value) {
|
||||
notLike(field, value, true);
|
||||
return this;
|
||||
}
|
||||
|
||||
public CriteriaJooqQuery like(String field, String value, boolean ignoreCase) {
|
||||
Inspector.isNotNull(field);
|
||||
Assert.isNotNull(field);
|
||||
final Field<Object> query = field(field);
|
||||
if (value != null) {
|
||||
if (ignoreCase) {
|
||||
@ -149,17 +85,4 @@ public class CriteriaJooqQuery {
|
||||
return this;
|
||||
}
|
||||
|
||||
public CriteriaJooqQuery notLike(String field, String value, boolean ignoreCase) {
|
||||
Inspector.isNotNull(field);
|
||||
final Field<Object> query = field(field);
|
||||
if (value != null) {
|
||||
if (ignoreCase) {
|
||||
conditions.add(query.likeIgnoreCase(value).not());
|
||||
} else {
|
||||
conditions.add(query.like(value).not());
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,31 +0,0 @@
|
||||
package dev.struchkov.haiti.filter.jooq.join;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public class JoinFieldReference {
|
||||
|
||||
private final String baseField;
|
||||
private final String referenceField;
|
||||
|
||||
public JoinFieldReference(String baseField, String referenceField) {
|
||||
this.baseField = baseField;
|
||||
this.referenceField = referenceField;
|
||||
}
|
||||
|
||||
public String getBaseField() {
|
||||
return baseField;
|
||||
}
|
||||
|
||||
public String getReferenceField() {
|
||||
return referenceField;
|
||||
}
|
||||
|
||||
public static JoinFieldReference of(String baseField, String referenceField) {
|
||||
return new JoinFieldReference(baseField, referenceField);
|
||||
}
|
||||
|
||||
public static Set<JoinFieldReference> ofSingletonSet(String baseField, String referenceField) {
|
||||
return Set.of(new JoinFieldReference(baseField, referenceField));
|
||||
}
|
||||
|
||||
}
|
@ -1,10 +1,6 @@
|
||||
package dev.struchkov.haiti.filter.jooq.join;
|
||||
|
||||
import dev.struchkov.haiti.utils.Inspector;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import static dev.struchkov.haiti.filter.jooq.exception.FilterJooqHaitiException.filterJooqException;
|
||||
import dev.struchkov.haiti.utils.Assert;
|
||||
|
||||
/**
|
||||
* Контейнер для соединения с таблицами.
|
||||
@ -14,87 +10,59 @@ import static dev.struchkov.haiti.filter.jooq.exception.FilterJooqHaitiException
|
||||
public class JoinTable {
|
||||
|
||||
private final String tableName;
|
||||
private final Set<JoinFieldReference> fieldReferences;
|
||||
private final String fieldBase;
|
||||
private final String fieldReference;
|
||||
private final JoinTypeOperation joinTypeOperation;
|
||||
private String alias;
|
||||
|
||||
private JoinTable(String tableName, JoinTypeOperation joinTypeOperation, Set<JoinFieldReference> fieldReferences, String alias) {
|
||||
private JoinTable(String tableName, String fieldBase, String fieldReference, JoinTypeOperation joinTypeOperation, String alias) {
|
||||
this.tableName = tableName;
|
||||
this.fieldBase = fieldBase;
|
||||
this.fieldReference = fieldReference;
|
||||
this.joinTypeOperation = joinTypeOperation;
|
||||
this.fieldReferences = fieldReferences;
|
||||
this.alias = alias;
|
||||
}
|
||||
|
||||
public static JoinTable ofLeft(String tableName, String fieldBase, String fieldReference) {
|
||||
Inspector.isNotNull(tableName, fieldBase, fieldReference);
|
||||
return new JoinTable(tableName, JoinTypeOperation.LEFT, JoinFieldReference.ofSingletonSet(fieldBase, fieldReference), null);
|
||||
}
|
||||
|
||||
public static JoinTable ofLeft(String tableName, Set<JoinFieldReference> fieldReferences) {
|
||||
Inspector.isNotNull(tableName, fieldReferences);
|
||||
Inspector.isNotEmpty(fieldReferences, filterJooqException("fieldReferences is empty: {0}", fieldReferences));
|
||||
return new JoinTable(tableName, JoinTypeOperation.LEFT, fieldReferences, null);
|
||||
Assert.isNotNull(tableName, fieldBase, fieldReference);
|
||||
return new JoinTable(tableName, fieldBase, fieldReference, JoinTypeOperation.LEFT, null);
|
||||
}
|
||||
|
||||
public static JoinTable ofLeft(String tableName, String fieldBase, String fieldReference, String alias) {
|
||||
Inspector.isNotNull(tableName, fieldBase, fieldReference, alias);
|
||||
return new JoinTable(tableName, JoinTypeOperation.LEFT, JoinFieldReference.ofSingletonSet(fieldBase, fieldReference), alias);
|
||||
}
|
||||
|
||||
public static JoinTable ofLeft(String tableName, Set<JoinFieldReference> fieldReferences, String alias) {
|
||||
Inspector.isNotNull(tableName, fieldReferences, alias);
|
||||
Inspector.isNotEmpty(fieldReferences, filterJooqException("fieldReferences is empty: {0}", fieldReferences));
|
||||
return new JoinTable(tableName, JoinTypeOperation.LEFT, fieldReferences, alias);
|
||||
Assert.isNotNull(tableName, fieldBase, fieldReference, alias);
|
||||
return new JoinTable(tableName, fieldBase, fieldReference, JoinTypeOperation.LEFT, alias);
|
||||
}
|
||||
|
||||
public static JoinTable onRight(String tableName, String fieldBase, String fieldReference) {
|
||||
Inspector.isNotNull(tableName, fieldBase, fieldReference);
|
||||
return new JoinTable(tableName, JoinTypeOperation.RIGHT, JoinFieldReference.ofSingletonSet(fieldBase, fieldReference), null);
|
||||
}
|
||||
|
||||
public static JoinTable onRight(String tableName, Set<JoinFieldReference> fieldReferences) {
|
||||
Inspector.isNotNull(tableName, fieldReferences);
|
||||
Inspector.isNotEmpty(fieldReferences, filterJooqException("fieldReferences is empty: {0}", fieldReferences));
|
||||
return new JoinTable(tableName, JoinTypeOperation.RIGHT, fieldReferences, null);
|
||||
Assert.isNotNull(tableName, fieldBase, fieldReference);
|
||||
return new JoinTable(tableName, fieldBase, fieldReference, JoinTypeOperation.RIGHT, null);
|
||||
}
|
||||
|
||||
public static JoinTable onRight(String tableName, String fieldBase, String fieldReference, String alias) {
|
||||
Inspector.isNotNull(tableName, fieldBase, fieldReference, alias);
|
||||
return new JoinTable(tableName, JoinTypeOperation.RIGHT, JoinFieldReference.ofSingletonSet(fieldBase, fieldReference), alias);
|
||||
}
|
||||
|
||||
public static JoinTable onRight(String tableName, Set<JoinFieldReference> fieldReferences, String alias) {
|
||||
Inspector.isNotNull(tableName, fieldReferences, alias);
|
||||
Inspector.isFalse(fieldReferences.isEmpty(), filterJooqException("fieldReferences is empty: {0}", fieldReferences));
|
||||
return new JoinTable(tableName, JoinTypeOperation.RIGHT, fieldReferences, alias);
|
||||
Assert.isNotNull(tableName, fieldBase, fieldReference, alias);
|
||||
return new JoinTable(tableName, fieldBase, fieldReference, JoinTypeOperation.RIGHT, alias);
|
||||
}
|
||||
|
||||
public static JoinTable of(String tableName, String fieldBase, String fieldReference, JoinTypeOperation joinType) {
|
||||
Inspector.isNotNull(tableName, fieldBase, fieldReference);
|
||||
return new JoinTable(tableName, joinType, JoinFieldReference.ofSingletonSet(fieldBase, fieldReference), null);
|
||||
}
|
||||
|
||||
public static JoinTable of(String tableName, Set<JoinFieldReference> fieldReferences, JoinTypeOperation joinType) {
|
||||
Inspector.isNotNull(tableName, fieldReferences);
|
||||
return new JoinTable(tableName, joinType, fieldReferences, null);
|
||||
Assert.isNotNull(tableName, fieldBase, fieldReference);
|
||||
return new JoinTable(tableName, fieldBase, fieldReference, joinType, null);
|
||||
}
|
||||
|
||||
public static JoinTable of(String tableName, String fieldBase, String fieldReference, JoinTypeOperation joinType, String alias) {
|
||||
Inspector.isNotNull(tableName, fieldBase, fieldReference, alias);
|
||||
return new JoinTable(tableName, joinType, JoinFieldReference.ofSingletonSet(fieldBase, fieldReference), alias);
|
||||
}
|
||||
|
||||
public static JoinTable of(String tableName, Set<JoinFieldReference> fieldReferences, JoinTypeOperation joinType, String alias) {
|
||||
Inspector.isNotNull(tableName, fieldReferences, alias);
|
||||
return new JoinTable(tableName, joinType, fieldReferences, alias);
|
||||
Assert.isNotNull(tableName, fieldBase, fieldReference, alias);
|
||||
return new JoinTable(tableName, fieldBase, fieldReference, joinType, alias);
|
||||
}
|
||||
|
||||
public String getTableName() {
|
||||
return tableName;
|
||||
}
|
||||
|
||||
public Set<JoinFieldReference> getFieldReferences() {
|
||||
return fieldReferences;
|
||||
public String getFieldBase() {
|
||||
return fieldBase;
|
||||
}
|
||||
|
||||
public String getFieldReference() {
|
||||
return fieldReference;
|
||||
}
|
||||
|
||||
public JoinTypeOperation getJoinTypeOperation() {
|
||||
|
@ -1,20 +1,18 @@
|
||||
package dev.struchkov.haiti.filter.jooq.page;
|
||||
|
||||
import dev.struchkov.haiti.utils.Inspector;
|
||||
|
||||
import static dev.struchkov.haiti.filter.jooq.exception.FilterJooqHaitiException.filterJooqException;
|
||||
import dev.struchkov.haiti.utils.Assert;
|
||||
|
||||
public class PageableSeek {
|
||||
|
||||
private final Object[] values;
|
||||
private final Object lastId;
|
||||
private int pageSize = 30;
|
||||
|
||||
private PageableSeek(Object[] values) {
|
||||
this.values = values;
|
||||
private PageableSeek(Object lastId) {
|
||||
this.lastId = lastId;
|
||||
}
|
||||
|
||||
private PageableSeek(Object[] values, int pageSize) {
|
||||
this.values = values;
|
||||
private PageableSeek(Object lastId, int pageSize) {
|
||||
this.lastId = lastId;
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
@ -22,22 +20,22 @@ public class PageableSeek {
|
||||
return new PageableSeek(null);
|
||||
}
|
||||
|
||||
public static PageableSeek ofPageSize(int pageSize) {
|
||||
public static PageableSeek of(int pageSize) {
|
||||
return new PageableSeek(null, pageSize);
|
||||
}
|
||||
|
||||
public static PageableSeek ofValues(Object... values) {
|
||||
Inspector.isNotEmpty(filterJooqException("Переданы пустой набор данных для PageableSeek"), values);
|
||||
return new PageableSeek(values);
|
||||
public static PageableSeek of(Object lastId) {
|
||||
Assert.isNotNull(lastId);
|
||||
return new PageableSeek(lastId);
|
||||
}
|
||||
|
||||
public static PageableSeek ofPageSizeAndValues(int pageSize, Object... values) {
|
||||
Inspector.isNotEmpty(filterJooqException("Переданы пустой набор данных для PageableSeek"), values);
|
||||
return new PageableSeek(values, pageSize);
|
||||
public static PageableSeek of(Object lastId, int pageSize) {
|
||||
Assert.isNotNull(lastId);
|
||||
return new PageableSeek(lastId, pageSize);
|
||||
}
|
||||
|
||||
public Object[] getValues() {
|
||||
return values;
|
||||
public Object getLastId() {
|
||||
return lastId;
|
||||
}
|
||||
|
||||
public int getPageSize() {
|
||||
|
@ -1,8 +0,0 @@
|
||||
package dev.struchkov.haiti.filter.jooq.sort;
|
||||
|
||||
public enum NullOrderType {
|
||||
|
||||
FIRST,
|
||||
LAST
|
||||
|
||||
}
|
@ -1,13 +1,12 @@
|
||||
package dev.struchkov.haiti.filter.jooq.sort;
|
||||
|
||||
|
||||
import dev.struchkov.haiti.utils.Inspector;
|
||||
import dev.struchkov.haiti.utils.Assert;
|
||||
|
||||
public class SortContainer {
|
||||
|
||||
private final String fieldName;
|
||||
private SortType type = SortType.ASC;
|
||||
private NullOrderType nullOrderType = NullOrderType.LAST;
|
||||
|
||||
private SortContainer(String fieldName) {
|
||||
this.fieldName = fieldName;
|
||||
@ -18,31 +17,16 @@ public class SortContainer {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
private SortContainer(String fieldName, SortType type, NullOrderType nullsOrder) {
|
||||
this.fieldName = fieldName;
|
||||
this.type = type;
|
||||
this.nullOrderType = nullsOrder;
|
||||
}
|
||||
|
||||
public static SortContainer of(String fieldName) {
|
||||
Inspector.isNotNull(fieldName);
|
||||
Assert.isNotNull(fieldName);
|
||||
return new SortContainer(fieldName);
|
||||
}
|
||||
|
||||
public static SortContainer of(String fieldName, SortType sortType) {
|
||||
Inspector.isNotNull(fieldName);
|
||||
Assert.isNotNull(fieldName);
|
||||
return new SortContainer(fieldName, sortType == null ? SortType.ASC : sortType);
|
||||
}
|
||||
|
||||
public static SortContainer of(String fieldName, SortType sortType, NullOrderType nullOrderType) {
|
||||
Inspector.isNotNull(fieldName);
|
||||
return new SortContainer(
|
||||
fieldName,
|
||||
sortType == null ? SortType.ASC : sortType,
|
||||
nullOrderType == null ? NullOrderType.LAST : nullOrderType
|
||||
);
|
||||
}
|
||||
|
||||
public String getFieldName() {
|
||||
return fieldName;
|
||||
}
|
||||
@ -51,8 +35,4 @@ public class SortContainer {
|
||||
return type;
|
||||
}
|
||||
|
||||
public NullOrderType getNullOrderType() {
|
||||
return nullOrderType;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,35 +0,0 @@
|
||||
package dev.struchkov.haiti.filter.jooq.utils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static dev.struchkov.haiti.utils.Exceptions.utilityClass;
|
||||
|
||||
public final class Jsonb {
|
||||
|
||||
private Jsonb() {
|
||||
utilityClass();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param field - колонка в БД формата jsonb
|
||||
* @param jsonField - поле в jsonb по которому будет выполняться операция фильтрации
|
||||
*/
|
||||
public static String jsonbField(String field, String jsonField) {
|
||||
String sql;
|
||||
if (jsonField.contains(".")) {
|
||||
final List<String> hierarchyFields = Arrays.stream(jsonField.split("\\."))
|
||||
.map(el -> "'" + el + "'")
|
||||
.collect(Collectors.toList());
|
||||
final String lastElement = hierarchyFields.remove(hierarchyFields.size() - 1);
|
||||
final String fieldPath = String.join(" -> ", hierarchyFields) + " ->> " + lastElement;
|
||||
sql = "(%s #>> '{}')::jsonb -> %s".formatted(field, fieldPath);
|
||||
} else {
|
||||
final String fieldPath = "'" + jsonField + "'";
|
||||
sql = "(%s #>> '{}')::jsonb ->> %s".formatted(field, fieldPath);
|
||||
}
|
||||
return sql;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user