first commit

This commit is contained in:
2026-01-15 22:38:46 +03:00
commit a70e9b7a79
58 changed files with 3980 additions and 0 deletions

40
docs/overview.md Normal file
View File

@@ -0,0 +1,40 @@
# Overview
Database is a Lumi plugin that provides:
- HikariCP-backed MySQL/PostgreSQL connections.
- Schema helpers for creating/updating tables and indexes.
- Raw SQL queries with parameter binding.
- Lightweight ORM with annotations, fluent query builder, and async support.
## Install
1. Build the jar with Gradle.
2. Put the jar into your server plugins folder.
3. Start the server once to generate `config.yml`.
## Accessing the API
```java
import com.andrewkydev.database.DatabaseProvider;
import com.andrewkydev.database.DatabaseApi;
DatabaseApi api = DatabaseProvider.get();
```
## Feature Highlights
### Auto ID on insert
If an entity uses `@DbId(autoIncrement = true)` and the id value is empty (0 or null),
`insert()` will fetch generated keys and assign the id back to the object.
### Snake case by default
If `@DbEntity` and `@DbColumn` names are not set, class and field names are converted to
snake_case.
### Query helpers
`findOneWhere`, `deleteWhere`, and `findWhere` with sorting/limit/offset are available
in the ORM.