Compare commits
3 Commits
6b8215bfb9
...
4cdb5047ca
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4cdb5047ca | ||
|
|
14e1ec8635 | ||
|
|
c0d3dce334 |
51
.gitea/workflows/basic-pipeline.yml
Normal file
51
.gitea/workflows/basic-pipeline.yml
Normal file
@@ -0,0 +1,51 @@
|
||||
name: Build project
|
||||
|
||||
# run automatically when a push or pull request is triggered
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: quality-and-build
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
# Limit to 1 job for my little VPS
|
||||
CARGO_BUILD_JOBS: 1
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Rust toolchain
|
||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
components: rustfmt, clippy
|
||||
|
||||
- name: Lint with Clippy
|
||||
run: cargo clippy -- -D warnings
|
||||
|
||||
- name: Run build (Debug mode)
|
||||
run: cargo build
|
||||
|
||||
|
||||
sonarqube:
|
||||
needs: build
|
||||
name: SonarQube Trigger
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Download SonarQube Scanner
|
||||
run: |
|
||||
curl -sSLo sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-5.0.1.3006-linux.zip
|
||||
unzip sonar-scanner.zip
|
||||
|
||||
- name: Run SonarQube Scan
|
||||
run: |
|
||||
./sonar-scanner-*/bin/sonar-scanner \
|
||||
-Dsonar.projectKey=UdpSocketServer \
|
||||
-Dsonar.sources=. \
|
||||
-Dsonar.host.url=${{ secrets.SONARQUBE_HOST }} \
|
||||
-Dsonar.login=${{ secrets.SONARQUBE_TOKEN }}
|
||||
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -44,7 +44,7 @@ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
||||
|
||||
[[package]]
|
||||
name = "db_builder"
|
||||
version = "0.1.0"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"rusqlite",
|
||||
"serde",
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
[package]
|
||||
name = "db_builder"
|
||||
version = "0.1.0"
|
||||
version = "0.0.0"
|
||||
edition = "2024"
|
||||
description = "This crate enables you to have a lib that create a sqlite database from a json file schema"
|
||||
license = "MIT"
|
||||
|
||||
[dependencies]
|
||||
serde_json = "1.0.149"
|
||||
|
||||
25
README.md
Normal file
25
README.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# Db Builder
|
||||
|
||||
This package enables you to create your SQLite database from a json file
|
||||
that represent your tables.
|
||||
|
||||
## Warnings
|
||||
|
||||
DO NOT USE IN PRODUCTION ENVIRONNEMENT, this lib is quickly developed for my personal use !
|
||||
|
||||
## Usage
|
||||
|
||||
To use this lib, you need to call the facade struct `DbBuilderFacade` and give it
|
||||
the database path (the db file is created if needed) and the path to the json file that represent your db.
|
||||
|
||||
Exemple:
|
||||
```rust
|
||||
fn main() {
|
||||
let facade = DbBuilderFacade{};
|
||||
|
||||
match facade.build("schema.json".to_string(), "exemple.db".to_string()) {
|
||||
Ok(_) => println!("DB created"),
|
||||
Err(message) => eprintln!("Error creating the db: {}", message)
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -42,7 +42,7 @@ mod tests {
|
||||
fn test_db_builder() {
|
||||
let facade = DbBuilderFacade{};
|
||||
|
||||
match facade.build("./example.json".to_string(), "test_db".to_string()) {
|
||||
match facade.build("./example.json".to_string(), "test.db".to_string()) {
|
||||
Ok(_) => {assert!(true)},
|
||||
Err(message) => {assert!(false, "{}", message)}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user