pub struct CrudArgs {
pub entity_file: PathBuf,
pub db_kind: String,
pub entities_module: Option<String>,
pub output_dir: PathBuf,
pub methods: Vec<String>,
pub query_macro: bool,
pub pool_visibility: PoolVisibility,
pub dry_run: bool,
}Fields§
§entity_file: PathBufPath to the generated entity .rs file
db_kind: StringDatabase kind (postgres, mysql, sqlite)
entities_module: Option<String>Module path of generated entities (e.g. “crate::models::users”).
If omitted, derived from –entity-file by finding src/ and converting the path.
output_dir: PathBufOutput directory for generated repository files
methods: Vec<String>Methods to generate (comma-separated): *, get_all, paginate, get, insert, update, delete
query_macro: boolUse sqlx::query_as!() compile-time checked macros instead of query_as::<_, T>() functions
pool_visibility: PoolVisibilityVisibility of the pool field in generated repository structs: private, pub, pub(crate)
dry_run: boolPrint to stdout without writing files
Implementations§
Source§impl CrudArgs
impl CrudArgs
pub fn database_kind(&self) -> Result<DatabaseKind>
Sourcepub fn resolve_entities_module(&self) -> Result<String>
pub fn resolve_entities_module(&self) -> Result<String>
Resolve the entities module path: use the explicit value if provided, otherwise derive it from the entity file path.
Trait Implementations§
Source§impl Args for CrudArgs
impl Args for CrudArgs
Source§fn augment_args<'b>(__clap_app: Command) -> Command
fn augment_args<'b>(__clap_app: Command) -> Command
Source§fn augment_args_for_update<'b>(__clap_app: Command) -> Command
fn augment_args_for_update<'b>(__clap_app: Command) -> Command
Append to
Command so it can instantiate self via
FromArgMatches::update_from_arg_matches_mut Read moreSource§impl CommandFactory for CrudArgs
impl CommandFactory for CrudArgs
Source§impl FromArgMatches for CrudArgs
impl FromArgMatches for CrudArgs
Source§fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
Source§fn from_arg_matches_mut(
__clap_arg_matches: &mut ArgMatches,
) -> Result<Self, Error>
fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>
Source§fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>
Assign values from
ArgMatches to self.Source§fn update_from_arg_matches_mut(
&mut self,
__clap_arg_matches: &mut ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>
Assign values from
ArgMatches to self.Source§impl Parser for CrudArgs
impl Parser for CrudArgs
Source§fn parse_from<I, T>(itr: I) -> Self
fn parse_from<I, T>(itr: I) -> Self
Parse from iterator, exit on error.
Source§fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>
fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>
Parse from iterator, return Err on error.
Source§fn update_from<I, T>(&mut self, itr: I)
fn update_from<I, T>(&mut self, itr: I)
Auto Trait Implementations§
impl Freeze for CrudArgs
impl RefUnwindSafe for CrudArgs
impl Send for CrudArgs
impl Sync for CrudArgs
impl Unpin for CrudArgs
impl UnsafeUnpin for CrudArgs
impl UnwindSafe for CrudArgs
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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 more