diff --git a/.github/workflows/scheduled.yml b/.github/workflows/scheduled.yml index 0247317..44f2875 100644 --- a/.github/workflows/scheduled.yml +++ b/.github/workflows/scheduled.yml @@ -7,6 +7,7 @@ on: schedule: - cron: "7 7 * * *" name: Rolling + jobs: nightly: runs-on: ubuntu-latest @@ -22,6 +23,7 @@ jobs: run: cargo generate-lockfile - name: cargo test --locked run: cargo test --locked --all-features --all-targets + update: runs-on: ubuntu-latest name: ubuntu / beta / updated diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8b1c31f..45624d5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -41,6 +41,7 @@ jobs: target /home/runner/.cargo key: ${{ steps.target-cache-restore.outputs.cache-primary-key }} + proptest: runs-on: ubuntu-latest name: ubuntu / stable @@ -60,6 +61,7 @@ jobs: key: stable-target - name: cargo test --test proptest --locked -- --ignored run: cargo test --locked --test proptest -- --ignored + # minimal: # runs-on: ubuntu-latest # name: ubuntu / stable / minimal-versions @@ -77,6 +79,7 @@ jobs: # run: cargo +nightly update -Zminimal-versions # - name: cargo test # run: cargo test --locked --all-features --all-targets + # os-check: runs-on: ${{ matrix.os }} name: ${{ matrix.os }} / stable @@ -99,6 +102,7 @@ jobs: run: cargo generate-lockfile - name: cargo test run: cargo test --locked --all-features --all-targets + coverage: runs-on: ubuntu-latest name: ubuntu / stable / coverage diff --git a/README.md b/README.md index 63fc343..30af9d7 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,11 @@ ## surreal-id -The `surreal-id` crate offers a standardized way to create and validate IDs in your application for usage with SurrealDB. By defining the `NewId` trait, the crate streamlines the ID creation process, handling errors like malformed or empty IDs, and ensures consistency with associated table names. This also enables developers to serialize and deserialize custom ID types from SurrealDB whilst still retrieving the ID field for usage in your application, making it using custom ID types and logic with SurrealDB seamless. +The `surreal-id` crate offers a standardized way to create and validate IDs in your application for usage with SurrealDB. Using the `NewId` trait, the crate streamlines the ID type defining process with a blanket implementation of `new` that handles errors like malformed or empty IDs, and ensures consistency with associated table names and functionality with SurrealDB. This also enables developers to create custom IDs in their application layer and serialize and deserialize those types safely from SurrealDB, ensuring type safety and consistency throughout the app. ## Example -```rs +```rust use serde::{Deserialize, Serialize}; use surreal_id::NewId; use surrealdb::{opt::RecordId, sql::Id}; @@ -31,11 +31,11 @@ impl NewId for UserId { } ``` -> NOTE: For most use cases, most of the above code is boilerplate that could be eliminated with a procerdural macro, where the only thing specified is the table name. +> NOTE: For most use cases, most of the above code is boilerplate that could be eliminated with a procerdural macro, where the only thing specified is the table name. PRs welcome! Now you can instantiate the `UserId` type using `new`, and use it in your struct with SurrealDB like so: -```rs +```rust #[derive(Serialize, Deserialize)] pub struct User { id: UserId,