1
Fork 0

core: Allow querying meta objects grouped by parent

This commit is contained in:
Steffo 2024-11-16 02:54:55 +01:00
parent a5b9918c43
commit a5b6485d11
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0

View file

@ -89,21 +89,25 @@ impl MetaLink {
.load(conn) .load(conn)
.await .await
} }
}
pub async fn query_properties(&self, conn: &mut AsyncPgConnection) -> QueryResult<Vec<MetaLinkProperty>> {
impl MetaLinkProperty {
pub async fn query_by_link(conn: &mut AsyncPgConnection, links: &[MetaLink]) -> QueryResult<Vec<MetaLinkProperty>> {
use diesel::prelude::*; use diesel::prelude::*;
use diesel_async::RunQueryDsl; use diesel_async::RunQueryDsl;
MetaLinkProperty::belonging_to(self) Self::belonging_to(links)
.load(conn) .load(conn)
.await .await
} }
}
pub async fn query_titles(&self, conn: &mut AsyncPgConnection) -> QueryResult<Vec<MetaLinkTitle>> {
impl MetaLinkTitle {
pub async fn query_by_link(conn: &mut AsyncPgConnection, links: &[MetaLink]) -> QueryResult<Vec<MetaLinkTitle>> {
use diesel::prelude::*; use diesel::prelude::*;
use diesel_async::RunQueryDsl; use diesel_async::RunQueryDsl;
MetaLinkTitle::belonging_to(self) Self::belonging_to(links)
.load(conn) .load(conn)
.await .await
} }