Files
Database/docs/ru/overview.md
2026-01-15 22:38:46 +03:00

35 lines
1.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Overview (RU)
Database - SQL plugin for Lumi with MySQL/PostgreSQL, HikariCP pooling,
schema helpers, raw SQL, and a lightweight ORM with fluent query builder.
## Установка
1. Соберите jar через Gradle.
2. Поместите jar в папку plugins сервера.
3. Запустите сервер один раз для генерации `config.yml`.
## Доступ к API
```java
import com.andrewkydev.database.DatabaseProvider;
import com.andrewkydev.database.DatabaseApi;
DatabaseApi api = DatabaseProvider.get();
```
## Основные возможности
### Auto ID после insert
Если у поля есть `@DbId(autoIncrement = true)` и id пустой (0 или null),
`insert()` получает generated keys и прописывает id в объект.
### Snake case по умолчанию
Если не задано `@DbEntity`/`@DbColumn`, имена берутся в snake_case.
### Удобные ORM методы
Доступны `findOneWhere`, `deleteWhere` и `findWhere` с сортировкой/лимитом/offset.