# huskehhh/mysql architecture

> Architecture diagram of the GitHub repository huskehhh/mysql, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/huskehhh/mysql
- Repository: https://github.com/huskehhh/mysql

## Overview

This is a small JDBC wrapper: callers create a MySQL adapter, then run synchronous or asynchronous queries and updates through its shared database API. The adapter obtains connections from HikariCP; the base class manages query execution and result handling. SQLConsumer supports checked-SQL-exception callbacks, while LambdaExceptionUtil adapts checked-exception suppliers for CompletableFuture. The README documents these query and update capabilities. Source excerpts show the principal calls; the JDBC driver and database are external dependencies.

Main entry points: [`src/main/java/pro/husk/Database.java`](https://github.com/huskehhh/mysql/blob/main/src/main/java/pro/husk/Database.java) (Database Operations), [`src/main/java/pro/husk/mysql/MySQL.java`](https://github.com/huskehhh/mysql/blob/main/src/main/java/pro/husk/mysql/MySQL.java) (MySQL Adapter), [`src/main/java/pro/husk/SQLConsumer.java`](https://github.com/huskehhh/mysql/blob/main/src/main/java/pro/husk/SQLConsumer.java) (SQL Callback), [`src/main/java/pro/husk/util/LambdaExceptionUtil.java`](https://github.com/huskehhh/mysql/blob/main/src/main/java/pro/husk/util/LambdaExceptionUtil.java) (Exception Adapter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["JDBC API"]
  node_database["Database Operations<br/>[Database.java]"]
  node_sqlconsumer["SQL Callback<br/>[SQLConsumer.java]"]
end

subgraph group_mysql["MySQL Connections"]
  node_mysql["MySQL Adapter<br/>[MySQL.java]"]
  node_pool["Hikari Pool"]
end

subgraph group_async["Async Support"]
  node_lambda["Exception Adapter"]
end

node_caller(("Library Caller"))
node_db[("MySQL Database")]

node_caller -->|"creates"| node_mysql
node_caller -->|"runs queries"| node_database
node_caller -->|"runs updates"| node_database
node_database -->|"gets connection"| node_mysql
node_mysql -->|"creates and reads"| node_pool
node_pool -->|"opens JDBC connection"| node_db
node_database -->|"invokes callback"| node_sqlconsumer
node_database -->|"wraps async work"| node_lambda
node_database -->|"executes SQL"| node_db

click node_database "https://github.com/huskehhh/mysql/blob/main/src/main/java/pro/husk/Database.java"
click node_sqlconsumer "https://github.com/huskehhh/mysql/blob/main/src/main/java/pro/husk/SQLConsumer.java"
click node_mysql "https://github.com/huskehhh/mysql/blob/main/src/main/java/pro/husk/mysql/MySQL.java"
click node_lambda "https://github.com/huskehhh/mysql/blob/main/src/main/java/pro/husk/util/LambdaExceptionUtil.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_database,node_sqlconsumer toneBlue
class node_mysql,node_pool,node_db toneAmber
class node_lambda toneMint
class node_caller toneIndigo
```

## Components

### JDBC API

- [Database Operations](https://github.com/huskehhh/mysql/blob/main/src/main/java/pro/husk/Database.java): `src/main/java/pro/husk/Database.java`
- [SQL Callback](https://github.com/huskehhh/mysql/blob/main/src/main/java/pro/husk/SQLConsumer.java): `src/main/java/pro/husk/SQLConsumer.java`

### MySQL Connections

- [MySQL Adapter](https://github.com/huskehhh/mysql/blob/main/src/main/java/pro/husk/mysql/MySQL.java): `src/main/java/pro/husk/mysql/MySQL.java`
- **Hikari Pool**

### Async Support

- [Exception Adapter](https://github.com/huskehhh/mysql/blob/main/src/main/java/pro/husk/util/LambdaExceptionUtil.java): `src/main/java/pro/husk/util/LambdaExceptionUtil.java`

### Other components

- **Library Caller**
- **MySQL Database**

## Connections

- Library Caller → MySQL Adapter: creates (evidence: `README.md`)
- Library Caller → Database Operations: runs queries (evidence: `README.md`)
- Library Caller → Database Operations: runs updates (evidence: `README.md`)
- Database Operations → MySQL Adapter: gets connection (evidence: `src/main/java/pro/husk/Database.java`)
- MySQL Adapter → Hikari Pool: creates and reads (evidence: `src/main/java/pro/husk/mysql/MySQL.java`)
- Hikari Pool → MySQL Database: opens JDBC connection
- Database Operations → SQL Callback: invokes callback (evidence: `src/main/java/pro/husk/Database.java`)
- Database Operations → Exception Adapter: wraps async work (evidence: `src/main/java/pro/husk/Database.java`)
- Database Operations → MySQL Database: executes SQL (evidence: `src/main/java/pro/husk/Database.java`)
