pub trait ExperimentChangeRepository: Send + Sync {
Show 15 methods
// Required methods
fn find_by_id(
&self,
id: i64,
) -> impl Future<Output = AutumnResult<Option<ExperimentChange>>> + Send;
fn find_all(
&self,
) -> impl Future<Output = AutumnResult<Vec<ExperimentChange>>> + Send;
fn save(
&self,
new: &NewExperimentChange,
) -> impl Future<Output = AutumnResult<ExperimentChange>> + Send;
fn update(
&self,
id: i64,
changes: &UpdateExperimentChange,
) -> impl Future<Output = AutumnResult<ExperimentChange>> + Send;
fn delete_by_id(
&self,
id: i64,
) -> impl Future<Output = AutumnResult<()>> + Send;
fn count(&self) -> impl Future<Output = AutumnResult<i64>> + Send;
fn exists_by_id(
&self,
id: i64,
) -> impl Future<Output = AutumnResult<bool>> + Send;
fn page(
&self,
req: &PageRequest,
) -> impl Future<Output = AutumnResult<Page<ExperimentChange>>> + Send;
fn list(
&self,
query: &ListQuery,
req: &PageRequest,
) -> impl Future<Output = AutumnResult<Page<ExperimentChange>>> + Send;
fn list_rows(
&self,
query: &ListQuery,
limit: usize,
) -> impl Future<Output = AutumnResult<Vec<ExperimentChange>>> + Send;
fn save_many(
&self,
new: &[NewExperimentChange],
) -> impl Future<Output = AutumnResult<Vec<ExperimentChange>>> + Send;
fn save_many_skip_invalid(
&self,
new: &[NewExperimentChange],
) -> impl Future<Output = AutumnResult<(Vec<ExperimentChange>, Vec<(usize, AutumnError)>)>> + Send;
fn update_many(
&self,
ids: &[i64],
changes: &UpdateExperimentChange,
) -> impl Future<Output = AutumnResult<Vec<ExperimentChange>>> + Send;
fn delete_many(
&self,
ids: &[i64],
) -> impl Future<Output = AutumnResult<()>> + Send;
fn upsert_many(
&self,
records: &[ExperimentChange],
) -> impl Future<Output = AutumnResult<Vec<ExperimentChange>>> + Send
where ExperimentChange: Insertable<table>;
}Expand description
Generated repository trait with CRUD + derived queries.
Required Methods§
fn find_by_id( &self, id: i64, ) -> impl Future<Output = AutumnResult<Option<ExperimentChange>>> + Send
fn find_all( &self, ) -> impl Future<Output = AutumnResult<Vec<ExperimentChange>>> + Send
fn save( &self, new: &NewExperimentChange, ) -> impl Future<Output = AutumnResult<ExperimentChange>> + Send
fn update( &self, id: i64, changes: &UpdateExperimentChange, ) -> impl Future<Output = AutumnResult<ExperimentChange>> + Send
fn delete_by_id(&self, id: i64) -> impl Future<Output = AutumnResult<()>> + Send
fn count(&self) -> impl Future<Output = AutumnResult<i64>> + Send
fn exists_by_id( &self, id: i64, ) -> impl Future<Output = AutumnResult<bool>> + Send
Sourcefn page(
&self,
req: &PageRequest,
) -> impl Future<Output = AutumnResult<Page<ExperimentChange>>> + Send
fn page( &self, req: &PageRequest, ) -> impl Future<Output = AutumnResult<Page<ExperimentChange>>> + Send
Fetch one page of records using offset pagination.
Accepts a ::autumn_web::pagination::PageRequest extractor value
and returns a ::autumn_web::pagination::Page containing the items
together with total-elements / total-pages metadata.
Sourcefn list(
&self,
query: &ListQuery,
req: &PageRequest,
) -> impl Future<Output = AutumnResult<Page<ExperimentChange>>> + Send
fn list( &self, query: &ListQuery, req: &PageRequest, ) -> impl Future<Output = AutumnResult<Page<ExperimentChange>>> + Send
Fetch one page of records applying allowlisted sort + equality
filters from a ::autumn_web::pagination::ListQuery, with offset
pagination from a ::autumn_web::pagination::PageRequest.
Only the model’s own columns are sortable, and only its non-null
String/integer/bool columns are filterable; any other requested
key is silently ignored (never interpolated into SQL). An empty or
unknown sort falls back to primary-key-descending order.
Sourcefn list_rows(
&self,
query: &ListQuery,
limit: usize,
) -> impl Future<Output = AutumnResult<Vec<ExperimentChange>>> + Send
fn list_rows( &self, query: &ListQuery, limit: usize, ) -> impl Future<Output = AutumnResult<Vec<ExperimentChange>>> + Send
Load up to limit records in list order, with the
same allowlisted sort, filters and scope.
One statement reads all rows, so they come from one snapshot: a
concurrent insert or delete cannot duplicate or skip a row. There
is no COUNT(*) and no offset.
Use it for a bulk read, such as an export. To detect more than
limit rows, ask for one more row than you keep.
fn save_many( &self, new: &[NewExperimentChange], ) -> impl Future<Output = AutumnResult<Vec<ExperimentChange>>> + Send
fn save_many_skip_invalid( &self, new: &[NewExperimentChange], ) -> impl Future<Output = AutumnResult<(Vec<ExperimentChange>, Vec<(usize, AutumnError)>)>> + Send
fn update_many( &self, ids: &[i64], changes: &UpdateExperimentChange, ) -> impl Future<Output = AutumnResult<Vec<ExperimentChange>>> + Send
Sourcefn delete_many(
&self,
ids: &[i64],
) -> impl Future<Output = AutumnResult<()>> + Send
fn delete_many( &self, ids: &[i64], ) -> impl Future<Output = AutumnResult<()>> + Send
Bulk-delete the given ids in one statement.
#1740: dependent(...) cascade actions DO apply on this bulk path. On
a repository that declares dependent(...), delete_many runs the same
destroy/delete_all/nullify/restrict cascade the single-record
delete_by_id/destroy runs — restrict probes first (a typed 409 rolls
the whole transaction back), then children, then the bulk parent delete,
all in one transaction — so no child is orphaned. Children are cascaded
per affected parent row (so destroy recurses into grandchildren,
#1739); set-based bulk child mutations are a possible future refinement.
Repositories with no dependents keep the plain bulk delete unchanged.
fn upsert_many( &self, records: &[ExperimentChange], ) -> impl Future<Output = AutumnResult<Vec<ExperimentChange>>> + Send
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".