pub use super::{ObjectType, Resource, ResourceObject};
use crate::grpc::server::IdList;
use crate::grpc::GrpcDataObjectType;
use crate::postgres::linked_resource::*;
pub trait LinkOtherResource {
fn get_other_ids(&self) -> IdList;
}
pub trait LinkedResource<T>: Resource + PsqlType + ObjectType<T>
where
T: GrpcDataObjectType,
{
}
impl<T: GrpcDataObjectType + prost::Message> LinkedResource<T> for ResourceObject<T> where
Self: PsqlType
{
}
impl<T: GrpcDataObjectType> PsqlObjectType<T> for ResourceObject<T> where
Self: ObjectType<T> + Resource
{
}
impl<T: GrpcDataObjectType> PsqlType for ResourceObject<T> where Self: ObjectType<T> + Resource {}
#[macro_export]
macro_rules! build_grpc_linked_resource_impl {
($resource:tt) => {
impl PsqlSearch for ResourceObject<Data> {}
impl PsqlInitLinkedResource for ResourceObject<Data> {}
impl PsqlInitResource for ResourceObject<Data> {
fn _get_create_table_query() -> String {
<ResourceObject<Data> as PsqlInitLinkedResource>::_get_create_table_query()
}
}
};
}