pub enum Generate {
Model {
name: String,
fields: Vec<Field>,
db: Option<Db>,
timestamps: bool,
soft_delete: bool,
},
Route {
resource: String,
fields: Vec<Field>,
actions: Vec<RouteAction>,
prefix: String,
},
Migration {
name: String,
},
Test {
resource: String,
app_expr: Option<String>,
},
}Expand description
What to generate.
Variants§
Model
rws gen model <Name> field:type…: a #[derive(Model)] type and
the migration creating its table. db: None takes the database
from the model-* feature in Cargo.toml, else SQLite.
timestamps (--timestamps, 18.30.0) adds #[timestamps] with
created_at / updated_at columns, soft_delete
(--soft-delete) #[soft_delete] with a nullable deleted_at.
Route
rws gen route <resource> [field:type…]: typed handlers for
actions under prefix + /<resource>, and register(app).
Without fields: the fields of src/models/<singular>.rs when
there is one, else name: String.
Migration
rws gen migration <name>: an up/down pair to fill in.
Test
rws gen test <resource>: TestClient tests for the routes in
src/routes/<resource>.rs. app_expr is how a test builds the
app (default app(), or what the existing tests pass to
TestClient::new when app takes arguments).
Implementations§
Trait Implementations§
impl Eq for Generate
impl StructuralPartialEq for Generate
Auto Trait Implementations§
impl Freeze for Generate
impl RefUnwindSafe for Generate
impl Send for Generate
impl Sync for Generate
impl Unpin for Generate
impl UnsafeUnpin for Generate
impl UnwindSafe for Generate
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ServiceExt for T
impl<T> ServiceExt for T
Source§fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
map-response-body only.Source§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
trace only.Source§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
trace only.