Skip to content

fewForce/belvedere

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Belvedere

A Rust workspace scaffolded by Entity Forge with compile-time SeaORM entity generation.


Setup (first time only)

1. Create the database container

docker run --name mariadb-Belvedere \
  -e MYSQL_ROOT_PASSWORD=secret \
  -e MYSQL_DATABASE=Belvedere \
  -p 3306:3306 \
  -d mariadb

2. Create the environment file

cp .env.example .env

.env.example ships with safe defaults that match the container above. Edit .env only if you change the password or port.

.env contents:

DATABASE_URL=mysql://root:secret@localhost:3306/Belvedere

Adding entities

Right-click bo/src in RustRover → New → Entity.

The dialog will ask for your struct definition and primary key. It then generates all the wiring automatically:

File What is written
bo/src/<entity>.rs Struct with #[derive(SeaOrmEntity)]
bo/src/lib.rs pub mod <entity>; appended
schema.json Primary key entry added
dal/src/<entity>.rs Re-exports the generated SeaORM entity
dal/src/lib.rs pub mod <entity>; appended
pilot/src/main.rs use import + create_table_from_entity call added

Running the project

Create tables in the database

cargo run -p pilot

Build only

cargo build

Clean

cargo clean

Database container lifecycle

Start

docker container start mariadb-Belvedere

Stop

docker container stop mariadb-Belvedere

Inspect a table schema

docker exec mariadb-Belvedere \
  mariadb -uroot -psecret Belvedere \
  -e "DESCRIBE <table_name>;"

Inspect rows

docker exec mariadb-Belvedere \
  mariadb -uroot -psecret Belvedere \
  -e "SELECT * FROM <table_name>;"

Macro reference

Derive Applied to What it generates
SeaOrmEntity BO struct SeaORM Model, Relation, ActiveModelBehavior, audit fields, table name
SeaOrmEnum Any enum Display, FromStr, Into<Value>, TryGetable, ValueType, Nullable

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors