From d1e83c2982bf7f537e642e9bd47337a76e3d9cc4 Mon Sep 17 00:00:00 2001 From: Liam Woodleigh Date: Fri, 22 Sep 2023 14:30:56 +0200 Subject: [PATCH 1/2] Updated readme --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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, From aeba2476c5f4794cb6f349ffef7cb4d4aaa18232 Mon Sep 17 00:00:00 2001 From: Liam Woodleigh Date: Fri, 22 Sep 2023 14:46:46 +0200 Subject: [PATCH 2/2] Whitespacing --- .github/workflows/scheduled.yml | 2 ++ .github/workflows/test.yml | 4 ++++ 2 files changed, 6 insertions(+) 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