An open API service indexing awesome lists of open source software.

https://github.com/future-architect/uroborosql

Developer-oriented and SQL centric database access library
https://github.com/future-architect/uroborosql

java java-library orm sql

Last synced: 9 months ago
JSON representation

Developer-oriented and SQL centric database access library

Awesome Lists containing this project

README

          

[![Maven Central](https://maven-badges.herokuapp.com/maven-central/jp.co.future/uroborosql/badge.svg?style=plastic)](https://maven-badges.herokuapp.com/maven-central/jp.co.future/uroborosql) [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg?style=plastic)](https://raw.githubusercontent.com/future-architect/uroborosql/master/LICENSE) [![Javadocs](https://www.javadoc.io/badge/jp.co.future/uroborosql.svg)](https://www.javadoc.io/doc/jp.co.future/uroborosql) [![Build Status](https://github.com/future-architect/uroborosql/actions/workflows/ci.yml/badge.svg)](https://github.com/future-architect/uroborosql/actions/workflows/ci.yml) [![Coverage Status](https://coveralls.io/repos/github/future-architect/uroborosql/badge.svg?branch=master)](https://coveralls.io/github/future-architect/uroborosql?branch=master)

uroboroSQL
==========

uroboroSQL

uroboroSQLは、Java8対応の2Way-SQLが利用可能なシンプルなSQL実行ライブラリです。

uroboroSQLは主にSQL中心の設計コンセプトを採用しています。Javaを中心に考えてSQLを組み立てるという思想ではなく、SQLに足りないところをJavaで補うという思想です。

エンタープライズで培われたノウハウとして、区分値サポート、リトライ、フィルターによるカスタマイズなどの機能を充実させています。また、2Way-SQLに対して、カバレッジを取れるようにするという、品質視点での機能があるのも特徴です。

さらにSQLの開発生産性を格段に上げるREPL機能も搭載しています。

[![asciicast](https://asciinema.org/a/122312.png)](https://asciinema.org/a/122312)

## Installation

### for Maven

```xml

jp.co.future
uroborosql
1.0.5

org.springframework
spring-expression
5.3.20

```

または

```xml

jp.co.future
uroborosql
1.0.5

ognl
ognl
3.1.23

```

### for Gradle

```gradle
compile group: 'jp.co.future', name: 'uroborosql', version: '1.0.5'
compile group: 'org.springframework', name: 'spring-expression', version: '5.3.20'
```

または

```gradle
compile group: 'jp.co.future', name: 'uroborosql', version: '1.0.5'
compile group: 'ognl', name: 'ognl', version: '3.1.23'
```

## Documentation

[https://future-architect.github.io/uroborosql-doc/](https://future-architect.github.io/uroborosql-doc/)

## Requirement

- Java 11 or later.

## Quick start

### 2Way-SQL

```sql
/* department/select_department.sql */

SELECT /* _SQL_ID_ */
DEPT.DEPT_NO AS DEPT_NO
, DEPT.DEPT_NAME AS DEPT_NAME
FROM
DEPARTMENT DEPT
WHERE
1 = 1
/*IF SF.isNotEmpty(dept_no)*/
AND DEPT.DEPT_NO = /*dept_no*/1
/*END*/
/*IF SF.isNotEmpty(dept_name)*/
AND DEPT.DEPT_NAME = /*dept_name*/'sample'
/*END*/

```

```sql
/* department/insert_department.sql */

INSERT
/* _SQL_ID_ */
INTO
DEPARTMENT
(
DEPT_NO
, DEPT_NAME
) VALUES (
/*dept_no*/1
, /*dept_name*/'sample'
)
```

```java
SqlConfig config = UroboroSQL.builder("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1", "sa", "")
.build();

try (SqlAgent agent = config.agent()) {
// SELECT
List> departments = agent.query("department/select_department")
.param("dept_no", 1001)
.collect();

// INSERT
int count = agent.update("department/insert_department")
.param("dept_no", 1001)
.param("dept_name", "sales")
.count();
}
```

### DAO Interface

```java
SqlConfig config = UroboroSQL.builder("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1", "sa", "")
.build();

try (SqlAgent agent = config.agent()) {
// select
Department dept = agent.find(Department.class, 1001)
.orElse(null);

// insert
Department hrDept = new Department();
hrDept.setDeptNo(1002);
hrDept.setDeptName("HR");
agent.insert(hrDept);

// update
hrDept.setDeptName("Human Resources");
agent.update(hrDept);

// delete
agent.delete(hrDept);
}
```

## Sample application

- CLI
-
- Web application(with Spring Boot)
-

## Automated code generation

- uroboroSQL source generator
-

## SQL Formatter

uroboroSQL

開発で便利なSQL formatterも用意しています。

- CLI
-
- VSCode Plugin
-
- Eclipse Plugin
-
- Sublime Text 3 Plugin
-
- IntelliJ IDEA Platform Plugin
-

## License

Released under the [MIT License](https://github.com/future-architect/uroborosql/blob/master/LICENSE).