Skip to content

Commit

Permalink
Merge pull request #45 from vnobo/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
vnobo authored Dec 23, 2024
2 parents 1739b01 + e6252e2 commit 9638eaf
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 26 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/cleanup-caches.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: cleanup caches by a branch
on:
pull_request:
types:
- closed

jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- name: Cleanup
run: |
echo "Fetching list of cache key"
cacheKeysForPR=$(gh cache list --ref $BRANCH --limit 100 --json id --jq '.[].id')
## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
gh cache delete $cacheKey
done
echo "Done"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge
7 changes: 3 additions & 4 deletions .github/workflows/gradle-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4

- uses: gradle/actions/wrapper-validation@v4
- name: Set up java 21 for x64
uses: actions/setup-java@v4
with:
Expand All @@ -57,11 +57,10 @@ jobs:
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Execute Gradle Plate bootBuildImage
#linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
run: |
chmod +x ./gradlew
./gradlew bootBuildImage --imagePlatform=linux/amd64 --network=host --publishImage
./gradlew bootBuildImage --imagePlatform=linux/arm64 --network=host --publishImage
./gradlew bootBuildImage --imagePlatform=linux/amd64 --network=host --publishImage --scan
./gradlew bootBuildImage --imagePlatform=linux/arm64 --network=host --publishImage --scan
- name: Inspect
run: |
docker buildx imagetools inspect localhost:5000/plate-oauth2:latest
Expand Down
26 changes: 9 additions & 17 deletions .github/workflows/gradle-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ jobs:
boot-build-test:
runs-on: ubuntu-latest
permissions:
contents: read
contents: write
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: '5'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: gradle/actions/wrapper-validation@v4
- name: Set up JDK 21 for x64
uses: actions/setup-java@v4
with:
Expand All @@ -29,24 +30,15 @@ jobs:
distribution: 'liberica'
check-latest: true
cache: 'gradle'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Build with Gradle Wrapper
run: |
chmod +x ./gradlew
./gradlew test
dependency-submission:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 21 for x64
uses: actions/setup-java@v4
with:
version: 'latest'
java-version: '21'
distribution: 'liberica'
check-latest: true
cache: 'gradle'
- name: Generate and submit dependency graph
uses: gradle/actions/dependency-submission@v4
uses: gradle/actions/dependency-submission@v4
with:
build-scan-publish: true
build-scan-terms-of-use-url: "https://gradle.com/help/legal-terms-of-use"
build-scan-terms-of-use-agree: "yes"
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ public abstract class AbstractEntity<T> implements BaseEntity<T> {
@InsertOnlyProperty
protected LocalDateTime createdTime;

/**
* Data full text search entity sort
*/
protected Double rank;

/**
* Support query for json column
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.plate.boot.commons.utils.query;

import com.google.common.base.CaseFormat;
import com.plate.boot.commons.exception.QueryException;
import lombok.Getter;

Expand Down Expand Up @@ -182,6 +183,16 @@ public QueryFragment limit(int size, long offset) {
return this;
}

public QueryFragment ts(String column, Object value) {
String lowerCamelCol = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, column);
String queryTable = "ts_" + lowerCamelCol;
columns("TS_RANK_CD(" + lowerCamelCol + ", " + queryTable + ") AS rank");
query(",TO_TSQUERY('chinese',:" + column + ") AS " + queryTable);
where(queryTable + " @@ " + lowerCamelCol);
put(column, value);
return this;
}

public String whereSql() {
if (this.where.length() > 0) {
return " WHERE " + this.where;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,8 @@ private static void processSecurityCodeKey(QueryFragment queryFragment, Map<Stri
*/
private static void processSearchKey(QueryFragment queryFragment, Map<String, Object> objectMap, String prefix) {
if (objectMap.containsKey("search") && !ObjectUtils.isEmpty(objectMap.get("search"))) {
var textSearch = (String) objectMap.get("search");
var column = StringUtils.hasLength(prefix) ? prefix + ".text_search" : "text_search";
queryFragment.columns("TS_RANK_CD(" + column + ", queryTextSearch) AS rank");
queryFragment.query(",TO_TSQUERY('chinese',:textSearch) queryTextSearch");
queryFragment.where(column + "@@TO_TSQUERY('chinese',:textSearch)");
queryFragment.put("textSearch", textSearch);
queryFragment.ts(column, objectMap.get("search"));
}
}

Expand Down

0 comments on commit 9638eaf

Please sign in to comment.