Skip to content

Commit

Permalink
Add README and LICENSE
Browse files Browse the repository at this point in the history
  • Loading branch information
reneklacan committed Nov 10, 2024
1 parent 9fdb012 commit 03ff58d
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Rene Klacan

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
60 changes: 60 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# sea-orm-typed-id

[![Crates.io](https://img.shields.io/crates/v/sea-orm-typed-id.svg)](https://crates.io/crates/sea-orm-typed-id)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

A Rust library that provides a macro for generating type-safe database ID types for SeaORM.

## Caveat

You might actually not need this library, it's just a macro and you might be better off with just copying the code from [src/lib.rs](src/lib.rs) into your project.

### Features

- `all`: Enables all features
- `serde`: Enables serde support for serialization/deserialization
- `rustls`: Enables rustls TLS backend for SeaORM
- `postgres`: Enables PostgreSQL array support
- `utoipa`: Enables OpenAPI schema generation support

## Installation

Add this to your `Cargo.toml`:

```toml
[dependencies]
sea-orm-typed-id = { version = "0.1.0", features = ["all"] }
```

## Usage

```rust
use sea_orm_typed_id::define_id;

define_id!(UserId);

#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
#[sea_orm(table_name = "cakes")]
pub struct Cake {
pub id: CakeId,
}

define_id!(FillingId);

#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
#[sea_orm(table_name = "fillings")]
pub struct Filling {
pub id: FillingId,
}

#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
#[sea_orm(table_name = "cake_fillings")]
pub struct CakeFilling {
pub cake_id: CakeId,
pub filling_id: FillingId,
}
```

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

0 comments on commit 03ff58d

Please sign in to comment.