selmeci / dgraph-tonic

Async/Sync gRPC client for Dgraph DB
MIT License
83 stars 8 forks source link

Adding external impl for a certain Txn Type #27

Closed lhr0909 closed 3 years ago

lhr0909 commented 4 years ago

Hi, here I am once again with a small question :D

I currently would like to do the following so I can expose and serialize the TxnContext in the Txn, hoping to persist it somewhere after any update.

use dgraph_tonic::{TxnContext, TxnMutatedType};
use dgraph_tonic::client::lazy::ILazyClient;

pub trait TxnContextExport {
    fn get_txn_context(&self) -> TxnContext;
}

impl<C: ILazyClient> TxnContextExport for TxnMutatedType<C> {
    fn get_txn_context(&self) -> TxnContext {
        self.context.clone()
    }
}

However, I think right now ILazyClient is private. So I am hoping to see if I can expose it somehow to make this work.

selmeci commented 3 years ago

Hi, sorry for latter response.

New release support to get transaction context on all variants