You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be convenient to reuse existing structs (like those defined for SeaORM models) to be used by Prost (and subsequently Tonic) for Grpc web apps.
For example, given the following protocol buffer code, it would be convenient to have the subsequent Rust code have a 1-1 mapping.
Without this functionality or similar, one currently has to define/generate intermediate structs to marshal between gRPC/ProtoBuf and ORM structs even though they represent exactly the same information.
Example Protocol Buffer
messageTimestamp {
int64seconds=1;
int32nanos=2;
}
messageDate {
int32year=1;
uint32month=2;
uint32day=3;
}
messageAccount {
bytesid=1; // UUID encoded as 4 bytesstringfirst_name=2; // like "Joe"stringlast_name=3; // like "Biden"Timestampcreated_at=4; // account registration timestamp encode as messageDatebirthday=5; // like Nov 20, 1942 encoded as a messagestringfavorite_movie_id=6; // some other uuid encoded as a string like "7033d448-c14e-4967-af0c-9b3826d6edb8"stringsome_other_datetime=7; // datetime encoded as a iso8601 string like "2022-09-27 18:00:00.000."
}
Example Rust code
use uuid::Uuid;use chrono::{NaiveDate,DateTime};
#derive(Message, ...)structAccount{#[prost(UUIDBytesCodec, tag=1)]id:Uuid,first_name:String,last_name:String,#[prost(DateTimeMessageCodec, tag=4)]created_at:DateTime,#[prost(DateMessageCodec, tag=5)]birthday:NaiveDate,#[prost(UUIDStringCodec, tag=6)]favorite_movie_id:Uuid,#[prost(ISO8601DateTime, tag=7)]some_other_datetime:DateTime}
The text was updated successfully, but these errors were encountered:
It would be convenient to reuse existing structs (like those defined for SeaORM models) to be used by Prost (and subsequently Tonic) for Grpc web apps.
For example, given the following protocol buffer code, it would be convenient to have the subsequent Rust code have a 1-1 mapping.
Without this functionality or similar, one currently has to define/generate intermediate structs to marshal between gRPC/ProtoBuf and ORM structs even though they represent exactly the same information.
Example Protocol Buffer
Example Rust code
The text was updated successfully, but these errors were encountered: