sleet-orm-cli
v0.1.2
Published
FiveM Sleet CLI 命令行工具
Downloads
214
Readme
[English] | 简体中文
Sleet CLI
Code generation and database tooling for the Sleet FiveM ORM.
Features
generate— Generate LuaLS type annotations from schema filessql— Generate MySQLCREATE TABLESQL from schema filespull— Reverse-engineer a MySQL/MariaDB database into a schema.lua
Installation
From source (Go 1.21+)
git clone https://github.com/SleetCo/sleet-orm-cli.git
cd sleet-orm-cli
go build -o sleet .Add the binary to your PATH, or run ./sleet directly.
Windows
npm (recommended) — global install:
npm install -g sleet-orm-cliUsage
Generate LLS type annotations
Executes your schema.lua in an embedded Lua VM, intercepts all sl.table() calls, and generates a ---@meta file with full LuaLS type inference:
sleet generate schema.lua
sleet generate schema.lua -o .sleet/types.lua
sleet generate schema.lua --stdoutDefault output: .sleet/types.lua in the current directory.
Generate SQL
Generates MySQL CREATE TABLE IF NOT EXISTS statements from your schema:
sleet sql server/schema.lua
sleet sql server/schema.lua -o database/init.sql
sleet sql server/schema.lua --stdoutPull schema from database
Connects to MySQL/MariaDB and generates a schema.lua from the existing database:
sleet pull --db myserver
sleet pull --host 127.0.0.1 -u root -p s3cr3t --db myserver -o server/schema.lua
sleet pull --db myserver --stdout| Flag | Short | Default | Description |
| ---------- | ----- | ------------ | ------------------------------- |
| --host | | 127.0.0.1 | Database host |
| --port | | 3306 | Database port |
| --user | -u | root | Database user |
| --pass | -p | | Database password |
| --db | -d | | Database name (required) |
| --out | -o | schema.lua | Output file path |
| --stdout | | | Print to stdout instead of file |
Project structure
cli/
├── cmd/ # Cobra commands (root, generate, sql, pull)
├── internal/ # Loader, generators, puller, i18n, ui
├── main.go
├── go.mod
└── go.sumLicense
See LICENSE in the parent repository.
