io.vulpine.lib:sql

SQL First query helpers.

License

License

GroupId

GroupId

io.vulpine.lib
ArtifactId

ArtifactId

simple-sql
Last Version

Last Version

0.1.5
Release Date

Release Date

Type

Type

jar
Description

Description

io.vulpine.lib:sql
SQL First query helpers.
Project URL

Project URL

https://github.com/Vulpine-IO/lib-sql
Project Organization

Project Organization

Vulpine IO
Source Code Management

Source Code Management

https://github.com/Vulpine-IO/lib-sql

Download simple-sql

How to add to project

<!-- https://jarcasting.com/artifacts/io.vulpine.lib/simple-sql/ -->
<dependency>
    <groupId>io.vulpine.lib</groupId>
    <artifactId>simple-sql</artifactId>
    <version>0.1.5</version>
</dependency>
// https://jarcasting.com/artifacts/io.vulpine.lib/simple-sql/
implementation 'io.vulpine.lib:simple-sql:0.1.5'
// https://jarcasting.com/artifacts/io.vulpine.lib/simple-sql/
implementation ("io.vulpine.lib:simple-sql:0.1.5")
'io.vulpine.lib:simple-sql:jar:0.1.5'
<dependency org="io.vulpine.lib" name="simple-sql" rev="0.1.5">
  <artifact name="simple-sql" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.vulpine.lib', module='simple-sql', version='0.1.5')
)
libraryDependencies += "io.vulpine.lib" % "simple-sql" % "0.1.5"
[io.vulpine.lib/simple-sql "0.1.5"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

sql-import

sql import Codacy code quality License Java Version

SQL resource loading & caching.

Reads from a configurable standardized directory layout organized by query type.

Queries are cached per SqlLoader instance so repeated loads of the same query will only incur the filesystem I/O cost once.

Import functions utilize the java.util.Optional type. In the event that a query does not exist or cannot be loaded, an empty Optional will be returned, otherwise the Optional will contain the SQL text loaded from the specified file.

Examples

Resource directory using default settings
/resource-dir (src/main/resources for Gradle projects)
  └─ /sql
      ├─ /delete
      │   ├─ /comments
      │   │   ├─ by-id.sql
      │   │   └─ by-user.sql
      │   └─ /users
      │       └─ by-id.sql
      ├─ /insert
      │   ├─ /comment.sql
      │   └─ /user.sql
      ├─ /select
      (etc...)

Using the example above loading queries could be accomplished by the following:

Example.java
public void example() {
  var loader      = new SqlLoader(); // (1)
  var delComments = loader.delete("comments.by-user"); // (2)
  var delUsers    = loader.delete("users/by-id"); // (3)
  var insUser     = loader.insert("user");
}
  1. Defaulted SqlLoader instance

  2. Import using dot notation

  3. Import using path notation

io.vulpine.lib

Vulpine IO

Small libs, big dreams

Versions

Version
0.1.5