Replies: 4 comments 1 reply
-
|
Actually, the trick is not worked 😂 |
Beta Was this translation helpful? Give feedback.
-
|
I just realized that I debugged in wrong place. I will update the status of this discussion later. Currently the function |
Beta Was this translation helpful? Give feedback.
-
|
after debugging, I found out that it was my mistake when using the export function grpcTimestampToDate(data: GrpcTimestamp): Date {
const timestamp = new Timestamp();
const { nanos, seconds } = data;
timestamp.setNanos(nanos);
timestamp.setSeconds(seconds.low);
return timestamp.toDate();
}
createMap(
mapper,
GrpcVM,
VM,
grpcTimestampToDateConverter,
);it must be createMap(
mapper,
GrpcVM,
VM,
grpcTimestampToDateConverter(),
);I have two functions like that, one function I used correctly, but this one not 😂 |
Beta Was this translation helpful? Give feedback.
-
|
Hey @zgid123, thanks for the discussion and sorry for the late reply. I halted my OSS work while I was on vacation. I agree that Did you solve your problem? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I checked the
typeConverterexample, we haveTimestampStringis extended fromDateclass, so when the mapper runs, those code lines will be skipped because theTimestampStringisisDateConstructor. It won't run the functiongetMappingto get the correctmappingfrommapper.I am working with
Timestampof google protobuf (google-protobuf/google/protobuf/timestamp_pb), to pass it to thegRPC, we need to doTimestamp.fromDate(new Date()).toObject(), the object's structure is{ seconds: number; nanos: number; }.I don't wanna config mapping for this structure and wanna pass to
typeConverterlike thisBut the
hasSameIdentifierabove will be true, and the library will throw error. Don't you think we should have a function or an option to make thehasSameIdentifierto be false with the classGrpcTimestamp? Or do we have a workaround to make it? Because I wanna reuse the logic to convert allGrpcTimestamptoDate.I researched the code and couldn't find a way. Because maybe I will have some classes to work like that in the future and wanna do the
typeConverterlike that. Currently, I extend theGrpcTimestampfromDateto do the trick.If we already have a solution, please help.
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions