This commit is contained in:
Chris Tsang 2021-05-07 22:48:49 +08:00
parent 69a52b6c7e
commit 5c953512be
3 changed files with 23 additions and 10 deletions

View File

@ -3,14 +3,14 @@
<h1>SeaORM</h1> <h1>SeaORM</h1>
<p> <p>
<strong>An [adjective] ORM for Rust</strong> <strong>An intuitive ORM for Rust</strong>
</p> </p>
<sub>Built with ❤️ by 🌊🦀🐠</sub> <sub>Built with ❤️ by 🌊🦀🐠</sub>
</div> </div>
# SeaORM - An [adjective] ORM for Rust # SeaORM - An intuitive ORM for Rust
## Features ## Features
@ -22,11 +22,26 @@ SeaORM is new to the party and rely on SQLx, so async support is not an aftertho
Built upon SeaQuery (a dynamic query builder), SeaORM allows you to build complex queries without 'fighting the ORM'. Built upon SeaQuery (a dynamic query builder), SeaORM allows you to build complex queries without 'fighting the ORM'.
3. Testable 3. Testable
Use mock connection to write unit tests for your logic. Use mock connections to write unit tests for your logic.
4. API oriented 4. API oriented
Quickly build search models that help you filter, sort and paginate data in APIs. Quickly build search models that help you filter, sort and paginate data in APIs.
## Goals
1. Intuitive and familiar
Inspired by ActiveRecord, Eloquent and TypeORM, SeaORM aims to provide you an ergonomic and intuitive
API to make working with databases in Rust a first-class experience.
2. Forwarding looking
We are ready to embrace Rocket 0.5 to make building web services in Rust productive and enjoyable.
3. Strong typed and dynamic
SeaORM construct queries at runtime, allowing you to develop flexible and powerful queries. While
the expressive Rust type system would help you in maintaining a complex codebase.

View File

@ -2,14 +2,14 @@ use super::{Column, Identity, Model, Relation};
use crate::Select; use crate::Select;
use sea_query::Iden; use sea_query::Iden;
use std::fmt::Debug; use std::fmt::Debug;
use strum::IntoEnumIterator; pub use strum::IntoEnumIterator as Iterable;
pub trait Entity: Iden + Default + Debug { pub trait Entity: Iden + Default + Debug {
type Model: Model; type Model: Model;
type Column: Column + IntoEnumIterator; type Column: Column + Iterable;
type Relation: Relation + IntoEnumIterator; type Relation: Relation + Iterable;
fn primary_key() -> Identity; fn primary_key() -> Identity;

View File

@ -1,11 +1,9 @@
use crate::Statement; use crate::{entity::*, Iterable, RelationDef, Statement};
use crate::{entity::*, RelationDef};
use core::fmt::Debug; use core::fmt::Debug;
use core::marker::PhantomData; use core::marker::PhantomData;
pub use sea_query::JoinType; pub use sea_query::JoinType;
use sea_query::{Expr, Iden, IntoIden, QueryBuilder, SelectStatement}; use sea_query::{Expr, Iden, IntoIden, QueryBuilder, SelectStatement};
use std::rc::Rc; use std::rc::Rc;
use strum::IntoEnumIterator;
#[derive(Debug)] #[derive(Debug)]
pub struct Select<'s, E: 'static> pub struct Select<'s, E: 'static>