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

1.0 KiB

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

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.