generated from LarsBodewig/Template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
991a311
commit 4b51c5a
Showing
13 changed files
with
1,818 additions
and
38 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Builds the project with Maven Wrapper using the 'release' profile and publishes to Maven Central | ||
# --- | ||
# Add the following Github secrets from your Secret Manager | ||
# - MAVEN_USERNAME: your Sonatype username | ||
# - MAVEN_CENTRAL_TOKEN: an Access Token generated in your Sonatype profile | ||
# - MAVEN_GPG_PASSPHRASE: your GPG passphrase | ||
# - MAVEN_GPG_PRIVATE_KEY: your GPG private key | ||
|
||
name: Maven Publish | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Set up JDK | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '17' | ||
server-id: ossrh | ||
server-username: MAVEN_USERNAME | ||
server-password: MAVEN_PASSWORD | ||
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} | ||
gpg-passphrase: MAVEN_GPG_PASSPHRASE | ||
- name: Publish to Apache Maven Central | ||
run: mvnw clean deploy -B -P release | ||
env: | ||
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} | ||
MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_TOKEN }} | ||
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.classpath | ||
.mvn/wrapper/maven-wrapper.jar | ||
.project | ||
.settings/ | ||
target/ |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip | ||
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar |
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,7 +1,7 @@ | ||
Template | ||
db2ascii | ||
Copyright 2023 Lars Bodewig | ||
|
||
This product includes software developed by: | ||
The Apache Software Foundation (https://www.apache.org/) | ||
|
||
|
||
The respective license information resides in the bundled libraries. | ||
The respective license information resides in the bundled libraries or files. |
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,5 +1,55 @@ | ||
# Template | ||
# db2ascii | ||
|
||
Template to include license information and useful files in all projects | ||
A small utility to quickly dump your database query results as a formatted ascii table. | ||
|
||
* Supports both classic `ResultSet` objects and JPA `TypedQuery` objects. | ||
* Offers functions to print to `System.out`, a designated `PrintStream` or return a formatted `String` | ||
|
||
|
||
## Example output | ||
|
||
``` | ||
+----+-------+--------+--------+ | ||
| ID | PRICE | COLOR | NAME | | ||
+----+-------+--------+--------+ | ||
| 1 | 1.5 | yellow | Banana | | ||
+----+-------+--------+--------+ | ||
``` | ||
|
||
|
||
## Usage | ||
|
||
```xml | ||
<dependency> | ||
<groupId>dev.bodewig.db2ascii</groupId> | ||
<artifactId>db2ascii</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
<scope>test</scope> | ||
</dependency> | ||
``` | ||
|
||
```java | ||
import dev.bodewig.db2ascii.Db2Ascii; | ||
|
||
/* usage with classic java.sql.ResultSet (and java.io.PrintStream) */ | ||
Db2Ascii.printResultSet(resultSet) // prints to System.out | ||
Db2Ascii.printResultSet(resultSet, printStream) | ||
String formattedResult = Db2Ascii.resultSetToString(resultSet) | ||
|
||
/* usage with JPA jakarta.persistence.TypedQuery<X> (and java.io.PrintStream) */ | ||
Db2Ascii.queryResultToString(typedQuery) // prints to System.out | ||
Db2Ascii.queryResultToString(typedQuery, printStream) | ||
String formattedResult = Db2Ascii.queryResultToString(typedQuery) | ||
``` | ||
|
||
You can check out the [unit tests](https://github.com/LarsBodewig/db2ascii/blob/main/src/test/java/dev/bodewig/db2ascii/Db2AsciiTest.java) for more complete examples. | ||
|
||
|
||
### This dependency should only be used for testing purposes! | ||
|
||
It is licensed under GPL-3.0 but can be used without any limitation as long as it is not modified or distributed - so it should be safe to use as a Maven dependency with the scope `test` (**but this is no legal advise**). | ||
|
||
|
||
--- | ||
|
||
Run `git config --add include.path ../.gitconfig` to include the template config in your project config. |
Oops, something went wrong.