diff --git a/_examples/02_simple/federation/federation.pb.go b/_examples/02_simple/federation/federation.pb.go index ac2f0707..21eeb436 100644 --- a/_examples/02_simple/federation/federation.pb.go +++ b/_examples/02_simple/federation/federation.pb.go @@ -206,7 +206,8 @@ type GetPostResponse struct { NullTimestamp3 *timestamppb.Timestamp `protobuf:"bytes,30,opt,name=null_timestamp3,json=nullTimestamp3,proto3" json:"null_timestamp3,omitempty"` JpLoc string `protobuf:"bytes,31,opt,name=jp_loc,json=jpLoc,proto3" json:"jp_loc,omitempty"` StringsJoin string `protobuf:"bytes,32,opt,name=strings_join,json=stringsJoin,proto3" json:"strings_join,omitempty"` - UrlUserName string `protobuf:"bytes,33,opt,name=url_user_name,json=urlUserName,proto3" json:"url_user_name,omitempty"` + ParseFloat float64 `protobuf:"fixed64,33,opt,name=parse_float,json=parseFloat,proto3" json:"parse_float,omitempty"` + UrlUserName string `protobuf:"bytes,34,opt,name=url_user_name,json=urlUserName,proto3" json:"url_user_name,omitempty"` } func (x *GetPostResponse) Reset() { @@ -465,6 +466,13 @@ func (x *GetPostResponse) GetStringsJoin() string { return "" } +func (x *GetPostResponse) GetParseFloat() float64 { + if x != nil { + return x.ParseFloat + } + return 0 +} + func (x *GetPostResponse) GetUrlUserName() string { if x != nil { return x.UrlUserName @@ -1176,7 +1184,7 @@ var file_federation_federation_proto_rawDesc = []byte{ 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x20, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x50, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0xec, 0x1e, 0x0a, 0x0f, 0x47, 0x65, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0xdf, 0x1f, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x50, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2f, 0x0a, 0x04, 0x70, 0x6f, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x42, 0x09, 0x9a, @@ -1354,216 +1362,223 @@ var file_federation_federation_proto_rawDesc = []byte{ 0x12, 0x34, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x5f, 0x6a, 0x6f, 0x69, 0x6e, 0x18, 0x20, 0x20, 0x01, 0x28, 0x09, 0x42, 0x11, 0x9a, 0x4a, 0x0e, 0x12, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x5f, 0x6a, 0x6f, 0x69, 0x6e, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, - 0x67, 0x73, 0x4a, 0x6f, 0x69, 0x6e, 0x12, 0x42, 0x0a, 0x0d, 0x75, 0x72, 0x6c, 0x5f, 0x75, 0x73, - 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x21, 0x20, 0x01, 0x28, 0x09, 0x42, 0x1e, 0x9a, - 0x4a, 0x1b, 0x12, 0x19, 0x75, 0x72, 0x6c, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x69, 0x6e, 0x66, 0x6f, - 0x28, 0x29, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x28, 0x29, 0x52, 0x0b, 0x75, - 0x72, 0x6c, 0x55, 0x73, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x61, - 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, - 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x3a, 0xce, 0x07, 0x9a, 0x4a, 0xca, 0x07, 0x0a, 0x1a, - 0x0a, 0x04, 0x70, 0x6f, 0x73, 0x74, 0x6a, 0x12, 0x0a, 0x04, 0x50, 0x6f, 0x73, 0x74, 0x12, 0x0a, - 0x0a, 0x02, 0x69, 0x64, 0x12, 0x04, 0x24, 0x2e, 0x69, 0x64, 0x0a, 0x42, 0x0a, 0x0c, 0x73, 0x74, - 0x72, 0x69, 0x6e, 0x67, 0x73, 0x5f, 0x6a, 0x6f, 0x69, 0x6e, 0x5a, 0x32, 0x67, 0x72, 0x70, 0x63, - 0x2e, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x73, 0x74, 0x72, 0x69, - 0x6e, 0x67, 0x73, 0x2e, 0x6a, 0x6f, 0x69, 0x6e, 0x28, 0x5b, 0x27, 0x61, 0x27, 0x2c, 0x20, 0x27, - 0x62, 0x27, 0x2c, 0x20, 0x27, 0x63, 0x27, 0x5d, 0x2c, 0x20, 0x27, 0x2c, 0x27, 0x29, 0x0a, 0x4f, - 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x5a, 0x48, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x66, 0x65, 0x64, 0x65, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x75, 0x72, 0x6c, 0x2e, 0x70, 0x61, 0x72, 0x73, 0x65, - 0x28, 0x27, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x75, - 0x73, 0x65, 0x72, 0x3a, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x40, 0x65, 0x78, 0x61, - 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x61, 0x74, 0x68, 0x27, 0x29, 0x0a, - 0x59, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x65, 0x5a, 0x51, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x66, 0x65, - 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x64, 0x61, - 0x74, 0x65, 0x28, 0x32, 0x30, 0x32, 0x33, 0x2c, 0x20, 0x31, 0x32, 0x2c, 0x20, 0x32, 0x35, 0x2c, - 0x20, 0x31, 0x32, 0x2c, 0x20, 0x31, 0x30, 0x2c, 0x20, 0x35, 0x2c, 0x20, 0x30, 0x2c, 0x20, 0x67, - 0x72, 0x70, 0x63, 0x2e, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x74, - 0x69, 0x6d, 0x65, 0x2e, 0x55, 0x54, 0x43, 0x28, 0x29, 0x29, 0x0a, 0x3a, 0x0a, 0x0b, 0x72, 0x61, - 0x6e, 0x64, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5a, 0x2b, 0x67, 0x72, 0x70, 0x63, 0x2e, - 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x72, 0x61, 0x6e, 0x64, 0x2e, - 0x6e, 0x65, 0x77, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x28, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x75, - 0x6e, 0x69, 0x78, 0x28, 0x29, 0x29, 0x0a, 0x33, 0x0a, 0x0a, 0x66, 0x69, 0x78, 0x65, 0x64, 0x5f, - 0x72, 0x61, 0x6e, 0x64, 0x5a, 0x25, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x66, 0x65, 0x64, 0x65, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x72, 0x61, 0x6e, 0x64, 0x2e, 0x6e, 0x65, 0x77, 0x28, 0x72, - 0x61, 0x6e, 0x64, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x29, 0x0a, 0x3b, 0x0a, 0x04, 0x75, - 0x75, 0x69, 0x64, 0x5a, 0x33, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x66, 0x65, 0x64, 0x65, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x75, 0x75, 0x69, 0x64, 0x2e, 0x6e, 0x65, 0x77, 0x52, 0x61, - 0x6e, 0x64, 0x6f, 0x6d, 0x46, 0x72, 0x6f, 0x6d, 0x52, 0x61, 0x6e, 0x64, 0x28, 0x66, 0x69, 0x78, - 0x65, 0x64, 0x5f, 0x72, 0x61, 0x6e, 0x64, 0x29, 0x0a, 0x36, 0x0a, 0x03, 0x6c, 0x6f, 0x63, 0x5a, - 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x2e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x6c, 0x6f, 0x61, 0x64, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x28, 0x27, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x54, 0x6f, 0x6b, 0x79, 0x6f, 0x27, 0x29, - 0x0a, 0x45, 0x0a, 0x07, 0x6a, 0x70, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x5a, 0x3a, 0x67, 0x72, 0x70, - 0x63, 0x2e, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x74, 0x69, 0x6d, - 0x65, 0x2e, 0x64, 0x61, 0x74, 0x65, 0x28, 0x32, 0x30, 0x32, 0x33, 0x2c, 0x20, 0x31, 0x32, 0x2c, - 0x20, 0x32, 0x35, 0x2c, 0x20, 0x31, 0x32, 0x2c, 0x20, 0x31, 0x30, 0x2c, 0x20, 0x35, 0x2c, 0x20, - 0x30, 0x2c, 0x20, 0x6c, 0x6f, 0x63, 0x29, 0x0a, 0x38, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x31, 0x5a, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x69, 0x6e, 0x63, 0x6f, - 0x6d, 0x69, 0x6e, 0x67, 0x28, 0x29, 0x5b, 0x27, 0x6b, 0x65, 0x79, 0x31, 0x27, 0x5d, 0x5b, 0x30, - 0x5d, 0x0a, 0x08, 0x0a, 0x01, 0x61, 0x6a, 0x03, 0x0a, 0x01, 0x41, 0x0a, 0x2b, 0x0a, 0x0d, 0x73, - 0x6f, 0x72, 0x74, 0x65, 0x64, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x5a, 0x1a, 0x5b, 0x34, - 0x2c, 0x20, 0x31, 0x2c, 0x20, 0x33, 0x2c, 0x20, 0x32, 0x5d, 0x2e, 0x73, 0x6f, 0x72, 0x74, 0x41, - 0x73, 0x63, 0x28, 0x76, 0x2c, 0x20, 0x76, 0x29, 0x0a, 0x95, 0x01, 0x0a, 0x0c, 0x73, 0x6f, 0x72, - 0x74, 0x65, 0x64, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x5a, 0x84, 0x01, 0x5b, 0x75, 0x73, 0x65, - 0x72, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x7b, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3a, - 0x75, 0x73, 0x65, 0x72, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x7b, 0x61, 0x64, 0x64, 0x72, 0x31, 0x3a, 0x27, 0x61, 0x27, 0x7d, 0x7d, 0x2c, 0x20, + 0x67, 0x73, 0x4a, 0x6f, 0x69, 0x6e, 0x12, 0x31, 0x0a, 0x0b, 0x70, 0x61, 0x72, 0x73, 0x65, 0x5f, + 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x18, 0x21, 0x20, 0x01, 0x28, 0x01, 0x42, 0x10, 0x9a, 0x4a, 0x0d, + 0x12, 0x0b, 0x70, 0x61, 0x72, 0x73, 0x65, 0x5f, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x52, 0x0a, 0x70, + 0x61, 0x72, 0x73, 0x65, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x12, 0x42, 0x0a, 0x0d, 0x75, 0x72, 0x6c, + 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x22, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x1e, 0x9a, 0x4a, 0x1b, 0x12, 0x19, 0x75, 0x72, 0x6c, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x69, + 0x6e, 0x66, 0x6f, 0x28, 0x29, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x28, 0x29, + 0x52, 0x0b, 0x75, 0x72, 0x6c, 0x55, 0x73, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x1a, 0x3b, 0x0a, + 0x0d, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, + 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, + 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x3a, 0x8e, 0x08, 0x9a, 0x4a, 0x8a, + 0x08, 0x0a, 0x1a, 0x0a, 0x04, 0x70, 0x6f, 0x73, 0x74, 0x6a, 0x12, 0x0a, 0x04, 0x50, 0x6f, 0x73, + 0x74, 0x12, 0x0a, 0x0a, 0x02, 0x69, 0x64, 0x12, 0x04, 0x24, 0x2e, 0x69, 0x64, 0x0a, 0x3d, 0x0a, + 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x5f, 0x6a, 0x6f, 0x69, 0x6e, 0x5a, 0x2d, 0x67, + 0x72, 0x70, 0x63, 0x2e, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x73, + 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x6a, 0x6f, 0x69, 0x6e, 0x28, 0x5b, 0x27, 0x31, 0x27, + 0x2c, 0x20, 0x27, 0x32, 0x27, 0x5d, 0x2c, 0x20, 0x27, 0x2e, 0x27, 0x29, 0x0a, 0x43, 0x0a, 0x0b, + 0x70, 0x61, 0x72, 0x73, 0x65, 0x5f, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x5a, 0x34, 0x67, 0x72, 0x70, + 0x63, 0x2e, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x73, 0x74, 0x72, + 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x70, 0x61, 0x72, 0x73, 0x65, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x28, + 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x5f, 0x6a, 0x6f, 0x69, 0x6e, 0x2c, 0x20, 0x36, 0x34, + 0x29, 0x0a, 0x4f, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x5a, 0x48, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x66, + 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x75, 0x72, 0x6c, 0x2e, 0x70, 0x61, + 0x72, 0x73, 0x65, 0x28, 0x27, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x74, 0x65, 0x73, + 0x74, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x3a, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x40, + 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x61, 0x74, 0x68, + 0x27, 0x29, 0x0a, 0x59, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x65, 0x5a, 0x51, 0x67, 0x72, 0x70, 0x63, + 0x2e, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x74, 0x69, 0x6d, 0x65, + 0x2e, 0x64, 0x61, 0x74, 0x65, 0x28, 0x32, 0x30, 0x32, 0x33, 0x2c, 0x20, 0x31, 0x32, 0x2c, 0x20, + 0x32, 0x35, 0x2c, 0x20, 0x31, 0x32, 0x2c, 0x20, 0x31, 0x30, 0x2c, 0x20, 0x35, 0x2c, 0x20, 0x30, + 0x2c, 0x20, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x2e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x55, 0x54, 0x43, 0x28, 0x29, 0x29, 0x0a, 0x3a, 0x0a, + 0x0b, 0x72, 0x61, 0x6e, 0x64, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5a, 0x2b, 0x67, 0x72, + 0x70, 0x63, 0x2e, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x72, 0x61, + 0x6e, 0x64, 0x2e, 0x6e, 0x65, 0x77, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x28, 0x64, 0x61, 0x74, + 0x65, 0x2e, 0x75, 0x6e, 0x69, 0x78, 0x28, 0x29, 0x29, 0x0a, 0x33, 0x0a, 0x0a, 0x66, 0x69, 0x78, + 0x65, 0x64, 0x5f, 0x72, 0x61, 0x6e, 0x64, 0x5a, 0x25, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x66, 0x65, + 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x72, 0x61, 0x6e, 0x64, 0x2e, 0x6e, 0x65, + 0x77, 0x28, 0x72, 0x61, 0x6e, 0x64, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x29, 0x0a, 0x3b, + 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x5a, 0x33, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x66, 0x65, + 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x75, 0x75, 0x69, 0x64, 0x2e, 0x6e, 0x65, + 0x77, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x46, 0x72, 0x6f, 0x6d, 0x52, 0x61, 0x6e, 0x64, 0x28, + 0x66, 0x69, 0x78, 0x65, 0x64, 0x5f, 0x72, 0x61, 0x6e, 0x64, 0x29, 0x0a, 0x36, 0x0a, 0x03, 0x6c, + 0x6f, 0x63, 0x5a, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x2e, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x6c, 0x6f, 0x61, 0x64, 0x4c, 0x6f, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x27, 0x41, 0x73, 0x69, 0x61, 0x2f, 0x54, 0x6f, 0x6b, 0x79, + 0x6f, 0x27, 0x29, 0x0a, 0x45, 0x0a, 0x07, 0x6a, 0x70, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x5a, 0x3a, + 0x67, 0x72, 0x70, 0x63, 0x2e, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, + 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x64, 0x61, 0x74, 0x65, 0x28, 0x32, 0x30, 0x32, 0x33, 0x2c, 0x20, + 0x31, 0x32, 0x2c, 0x20, 0x32, 0x35, 0x2c, 0x20, 0x31, 0x32, 0x2c, 0x20, 0x31, 0x30, 0x2c, 0x20, + 0x35, 0x2c, 0x20, 0x30, 0x2c, 0x20, 0x6c, 0x6f, 0x63, 0x29, 0x0a, 0x38, 0x0a, 0x06, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x31, 0x5a, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x66, 0x65, 0x64, 0x65, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x69, + 0x6e, 0x63, 0x6f, 0x6d, 0x69, 0x6e, 0x67, 0x28, 0x29, 0x5b, 0x27, 0x6b, 0x65, 0x79, 0x31, 0x27, + 0x5d, 0x5b, 0x30, 0x5d, 0x0a, 0x08, 0x0a, 0x01, 0x61, 0x6a, 0x03, 0x0a, 0x01, 0x41, 0x0a, 0x2b, + 0x0a, 0x0d, 0x73, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x5a, + 0x1a, 0x5b, 0x34, 0x2c, 0x20, 0x31, 0x2c, 0x20, 0x33, 0x2c, 0x20, 0x32, 0x5d, 0x2e, 0x73, 0x6f, + 0x72, 0x74, 0x41, 0x73, 0x63, 0x28, 0x76, 0x2c, 0x20, 0x76, 0x29, 0x0a, 0x95, 0x01, 0x0a, 0x0c, + 0x73, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x5a, 0x84, 0x01, 0x5b, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x7b, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x2e, 0x4c, 0x6f, 0x63, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7b, 0x61, 0x64, 0x64, 0x72, 0x31, 0x3a, 0x27, 0x62, 0x27, 0x7d, - 0x7d, 0x5d, 0x2e, 0x73, 0x6f, 0x72, 0x74, 0x44, 0x65, 0x73, 0x63, 0x28, 0x76, 0x2c, 0x20, 0x76, - 0x2e, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x61, 0x64, 0x64, 0x72, 0x31, 0x29, - 0x0a, 0x25, 0x0a, 0x09, 0x6d, 0x61, 0x70, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5a, 0x18, 0x7b, - 0x31, 0x3a, 0x20, 0x27, 0x61, 0x27, 0x2c, 0x20, 0x32, 0x3a, 0x20, 0x27, 0x62, 0x27, 0x2c, 0x20, - 0x33, 0x3a, 0x20, 0x27, 0x63, 0x27, 0x7d, 0x0a, 0x12, 0x0a, 0x0a, 0x6e, 0x75, 0x6c, 0x6c, 0x5f, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5a, 0x04, 0x6e, 0x75, 0x6c, 0x6c, 0x0a, 0x4b, 0x5a, 0x49, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7b, 0x61, 0x64, 0x64, 0x72, 0x31, 0x3a, 0x27, 0x61, 0x27, 0x7d, + 0x7d, 0x2c, 0x20, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x7b, 0x6c, 0x6f, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x2e, + 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7b, 0x61, 0x64, 0x64, 0x72, 0x31, 0x3a, 0x27, + 0x62, 0x27, 0x7d, 0x7d, 0x5d, 0x2e, 0x73, 0x6f, 0x72, 0x74, 0x44, 0x65, 0x73, 0x63, 0x28, 0x76, + 0x2c, 0x20, 0x76, 0x2e, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x61, 0x64, 0x64, + 0x72, 0x31, 0x29, 0x0a, 0x25, 0x0a, 0x09, 0x6d, 0x61, 0x70, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x5a, 0x18, 0x7b, 0x31, 0x3a, 0x20, 0x27, 0x61, 0x27, 0x2c, 0x20, 0x32, 0x3a, 0x20, 0x27, 0x62, + 0x27, 0x2c, 0x20, 0x33, 0x3a, 0x20, 0x27, 0x63, 0x27, 0x7d, 0x0a, 0x12, 0x0a, 0x0a, 0x6e, 0x75, + 0x6c, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5a, 0x04, 0x6e, 0x75, 0x6c, 0x6c, 0x0a, 0x4b, + 0x5a, 0x49, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x2e, 0x6c, 0x6f, 0x67, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x28, 0x27, 0x6f, 0x75, 0x74, 0x70, + 0x75, 0x74, 0x20, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6c, 0x6f, + 0x67, 0x27, 0x2c, 0x20, 0x7b, 0x27, 0x70, 0x6f, 0x73, 0x74, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x27, 0x3a, 0x20, 0x70, 0x6f, 0x73, 0x74, 0x7d, 0x29, 0x22, 0xdf, 0x03, 0x0a, 0x01, + 0x41, 0x12, 0x25, 0x0a, 0x01, 0x62, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x66, + 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x2e, 0x42, 0x42, 0x06, 0x9a, + 0x4a, 0x03, 0x12, 0x01, 0x62, 0x52, 0x01, 0x62, 0x1a, 0xa1, 0x03, 0x0a, 0x01, 0x42, 0x12, 0x2d, + 0x0a, 0x03, 0x66, 0x6f, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x66, 0x65, + 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x2e, 0x42, 0x2e, 0x43, 0x42, 0x08, + 0x9a, 0x4a, 0x05, 0x12, 0x03, 0x66, 0x6f, 0x6f, 0x52, 0x03, 0x66, 0x6f, 0x6f, 0x12, 0x2d, 0x0a, + 0x03, 0x62, 0x61, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x66, 0x65, 0x64, + 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x2e, 0x42, 0x2e, 0x43, 0x42, 0x08, 0x9a, + 0x4a, 0x05, 0x12, 0x03, 0x62, 0x61, 0x72, 0x52, 0x03, 0x62, 0x61, 0x72, 0x1a, 0x24, 0x0a, 0x01, + 0x43, 0x12, 0x1f, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x0b, 0x9a, 0x4a, 0x08, 0x12, 0x06, 0x24, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, + 0x70, 0x65, 0x3a, 0x97, 0x02, 0x9a, 0x4a, 0x93, 0x02, 0x0a, 0x1d, 0x0a, 0x03, 0x66, 0x6f, 0x6f, + 0x6a, 0x16, 0x0a, 0x05, 0x41, 0x2e, 0x42, 0x2e, 0x43, 0x12, 0x0d, 0x0a, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x12, 0x05, 0x27, 0x66, 0x6f, 0x6f, 0x27, 0x0a, 0x1d, 0x0a, 0x03, 0x62, 0x61, 0x72, 0x6a, + 0x16, 0x0a, 0x05, 0x41, 0x2e, 0x42, 0x2e, 0x43, 0x12, 0x0d, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, + 0x12, 0x05, 0x27, 0x62, 0x61, 0x72, 0x27, 0x0a, 0x89, 0x01, 0x12, 0x11, 0x66, 0x6f, 0x6f, 0x2e, + 0x74, 0x79, 0x70, 0x65, 0x20, 0x3d, 0x3d, 0x20, 0x27, 0x66, 0x6f, 0x6f, 0x27, 0x5a, 0x74, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x6c, 0x6f, 0x67, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x28, 0x27, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6c, 0x6f, 0x67, 0x27, 0x2c, - 0x20, 0x7b, 0x27, 0x70, 0x6f, 0x73, 0x74, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x27, - 0x3a, 0x20, 0x70, 0x6f, 0x73, 0x74, 0x7d, 0x29, 0x22, 0xdf, 0x03, 0x0a, 0x01, 0x41, 0x12, 0x25, - 0x0a, 0x01, 0x62, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x66, 0x65, 0x64, 0x65, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x2e, 0x42, 0x42, 0x06, 0x9a, 0x4a, 0x03, 0x12, - 0x01, 0x62, 0x52, 0x01, 0x62, 0x1a, 0xa1, 0x03, 0x0a, 0x01, 0x42, 0x12, 0x2d, 0x0a, 0x03, 0x66, - 0x6f, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x66, 0x65, 0x64, 0x65, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x2e, 0x42, 0x2e, 0x43, 0x42, 0x08, 0x9a, 0x4a, 0x05, - 0x12, 0x03, 0x66, 0x6f, 0x6f, 0x52, 0x03, 0x66, 0x6f, 0x6f, 0x12, 0x2d, 0x0a, 0x03, 0x62, 0x61, - 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x2e, 0x42, 0x2e, 0x43, 0x42, 0x08, 0x9a, 0x4a, 0x05, 0x12, - 0x03, 0x62, 0x61, 0x72, 0x52, 0x03, 0x62, 0x61, 0x72, 0x1a, 0x24, 0x0a, 0x01, 0x43, 0x12, 0x1f, - 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0b, 0x9a, 0x4a, - 0x08, 0x12, 0x06, 0x24, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x3a, - 0x97, 0x02, 0x9a, 0x4a, 0x93, 0x02, 0x0a, 0x1d, 0x0a, 0x03, 0x66, 0x6f, 0x6f, 0x6a, 0x16, 0x0a, - 0x05, 0x41, 0x2e, 0x42, 0x2e, 0x43, 0x12, 0x0d, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x05, - 0x27, 0x66, 0x6f, 0x6f, 0x27, 0x0a, 0x1d, 0x0a, 0x03, 0x62, 0x61, 0x72, 0x6a, 0x16, 0x0a, 0x05, - 0x41, 0x2e, 0x42, 0x2e, 0x43, 0x12, 0x0d, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x05, 0x27, - 0x62, 0x61, 0x72, 0x27, 0x0a, 0x89, 0x01, 0x12, 0x11, 0x66, 0x6f, 0x6f, 0x2e, 0x74, 0x79, 0x70, - 0x65, 0x20, 0x3d, 0x3d, 0x20, 0x27, 0x66, 0x6f, 0x6f, 0x27, 0x5a, 0x74, 0x67, 0x72, 0x70, 0x63, - 0x2e, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x6c, 0x6f, 0x67, 0x2e, - 0x69, 0x6e, 0x66, 0x6f, 0x28, 0x27, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x66, 0x65, 0x64, - 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6c, 0x6f, 0x67, 0x27, 0x2c, 0x20, 0x7b, 0x27, - 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x27, 0x3a, 0x20, 0x5b, 0x66, 0x6f, 0x6f, 0x2c, - 0x20, 0x62, 0x61, 0x72, 0x5d, 0x2c, 0x20, 0x27, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, - 0x6d, 0x61, 0x70, 0x27, 0x3a, 0x20, 0x7b, 0x27, 0x66, 0x6f, 0x6f, 0x27, 0x3a, 0x20, 0x66, 0x6f, - 0x6f, 0x2c, 0x20, 0x27, 0x62, 0x61, 0x72, 0x27, 0x3a, 0x20, 0x62, 0x61, 0x72, 0x7d, 0x7d, 0x29, - 0x0a, 0x47, 0x5a, 0x45, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x2e, 0x6c, 0x6f, 0x67, 0x2e, 0x61, 0x64, 0x64, 0x28, 0x7b, 0x27, 0x66, 0x6f, - 0x6f, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x27, 0x3a, 0x20, 0x66, 0x6f, 0x6f, 0x2e, 0x74, 0x79, 0x70, - 0x65, 0x2c, 0x20, 0x27, 0x62, 0x61, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x27, 0x3a, 0x20, 0x62, - 0x61, 0x72, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x7d, 0x29, 0x3a, 0x0f, 0x9a, 0x4a, 0x0c, 0x0a, 0x0a, - 0x0a, 0x01, 0x62, 0x6a, 0x05, 0x0a, 0x03, 0x41, 0x2e, 0x42, 0x22, 0xe6, 0x01, 0x0a, 0x04, 0x50, - 0x6f, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, - 0x74, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, - 0x65, 0x6e, 0x74, 0x12, 0x2f, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x10, 0x2e, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x55, - 0x73, 0x65, 0x72, 0x42, 0x09, 0x9a, 0x4a, 0x06, 0x12, 0x04, 0x75, 0x73, 0x65, 0x72, 0x52, 0x04, - 0x75, 0x73, 0x65, 0x72, 0x3a, 0x6d, 0x9a, 0x4a, 0x6a, 0x0a, 0x3c, 0x0a, 0x03, 0x72, 0x65, 0x73, - 0x72, 0x35, 0x0a, 0x18, 0x70, 0x6f, 0x73, 0x74, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x2f, 0x47, 0x65, 0x74, 0x50, 0x6f, 0x73, 0x74, 0x12, 0x0a, 0x0a, 0x02, - 0x69, 0x64, 0x12, 0x04, 0x24, 0x2e, 0x69, 0x64, 0x1a, 0x03, 0x31, 0x30, 0x73, 0x22, 0x08, 0x0a, - 0x06, 0x0a, 0x02, 0x32, 0x73, 0x10, 0x03, 0x0a, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x73, 0x74, 0x18, - 0x01, 0x5a, 0x08, 0x72, 0x65, 0x73, 0x2e, 0x70, 0x6f, 0x73, 0x74, 0x0a, 0x16, 0x0a, 0x04, 0x75, - 0x73, 0x65, 0x72, 0x6a, 0x0e, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x06, 0x1a, 0x04, 0x70, - 0x6f, 0x73, 0x74, 0x22, 0xc8, 0x04, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x12, 0x26, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x10, 0x2e, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x49, 0x74, 0x65, - 0x6d, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x37, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x66, - 0x69, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x66, 0x65, 0x64, 0x65, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x66, - 0x69, 0x6c, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, - 0x65, 0x12, 0x2f, 0x0a, 0x06, 0x61, 0x74, 0x74, 0x72, 0x5f, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x16, 0x2e, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x55, - 0x73, 0x65, 0x72, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x41, 0x48, 0x00, 0x52, 0x05, 0x61, 0x74, 0x74, - 0x72, 0x41, 0x12, 0x26, 0x0a, 0x01, 0x62, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, - 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x2e, - 0x41, 0x74, 0x74, 0x72, 0x42, 0x48, 0x00, 0x52, 0x01, 0x62, 0x1a, 0x50, 0x0a, 0x0c, 0x50, 0x72, - 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2a, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, - 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x2f, 0x0a, 0x05, - 0x41, 0x74, 0x74, 0x72, 0x41, 0x12, 0x10, 0x0a, 0x03, 0x66, 0x6f, 0x6f, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x03, 0x66, 0x6f, 0x6f, 0x3a, 0x14, 0x9a, 0x4a, 0x11, 0x1a, 0x0f, 0x75, 0x73, - 0x65, 0x72, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x41, 0x1a, 0x2f, 0x0a, - 0x05, 0x41, 0x74, 0x74, 0x72, 0x42, 0x12, 0x10, 0x0a, 0x03, 0x62, 0x61, 0x72, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x03, 0x62, 0x61, 0x72, 0x3a, 0x14, 0x9a, 0x4a, 0x11, 0x1a, 0x0f, 0x75, - 0x73, 0x65, 0x72, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x42, 0x3a, 0xa5, - 0x01, 0x9a, 0x4a, 0xa1, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x03, 0x72, 0x65, 0x73, 0x72, 0x82, 0x01, - 0x0a, 0x18, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x2f, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0f, 0x0a, 0x02, 0x69, 0x64, - 0x12, 0x09, 0x24, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x12, 0x2f, 0x0a, 0x04, 0x74, - 0x79, 0x70, 0x65, 0x12, 0x27, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x2e, 0x49, - 0x74, 0x65, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x2e, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x28, 0x27, 0x49, - 0x54, 0x45, 0x4d, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x31, 0x27, 0x29, 0x1a, 0x03, 0x32, 0x30, - 0x73, 0x22, 0x1f, 0x12, 0x1d, 0x0a, 0x02, 0x31, 0x73, 0x11, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, - 0xe6, 0x3f, 0x19, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0xfb, 0x3f, 0x22, 0x03, 0x33, 0x30, 0x73, - 0x28, 0x03, 0x0a, 0x12, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x5a, 0x08, 0x72, 0x65, - 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x42, 0x06, 0x0a, 0x04, 0x61, 0x74, 0x74, 0x72, 0x22, 0x8d, - 0x05, 0x0a, 0x04, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2d, 0x0a, 0x04, 0x74, - 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x66, 0x65, 0x64, 0x65, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x2e, 0x49, 0x74, 0x65, 0x6d, - 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x12, 0x35, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, - 0x49, 0x74, 0x65, 0x6d, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x6c, - 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0xf1, 0x02, 0x0a, 0x08, 0x4c, 0x6f, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x64, 0x64, 0x72, 0x31, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x64, 0x64, 0x72, 0x31, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x64, - 0x64, 0x72, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x64, 0x64, 0x72, 0x32, - 0x12, 0x38, 0x0a, 0x06, 0x61, 0x64, 0x64, 0x72, 0x5f, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1f, 0x2e, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x49, 0x74, - 0x65, 0x6d, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x64, 0x64, 0x72, - 0x41, 0x48, 0x00, 0x52, 0x05, 0x61, 0x64, 0x64, 0x72, 0x41, 0x12, 0x2f, 0x0a, 0x01, 0x62, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, + 0x20, 0x7b, 0x27, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x27, 0x3a, 0x20, 0x5b, 0x66, + 0x6f, 0x6f, 0x2c, 0x20, 0x62, 0x61, 0x72, 0x5d, 0x2c, 0x20, 0x27, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x5f, 0x6d, 0x61, 0x70, 0x27, 0x3a, 0x20, 0x7b, 0x27, 0x66, 0x6f, 0x6f, 0x27, 0x3a, + 0x20, 0x66, 0x6f, 0x6f, 0x2c, 0x20, 0x27, 0x62, 0x61, 0x72, 0x27, 0x3a, 0x20, 0x62, 0x61, 0x72, + 0x7d, 0x7d, 0x29, 0x0a, 0x47, 0x5a, 0x45, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x66, 0x65, 0x64, 0x65, + 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x6c, 0x6f, 0x67, 0x2e, 0x61, 0x64, 0x64, 0x28, 0x7b, + 0x27, 0x66, 0x6f, 0x6f, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x27, 0x3a, 0x20, 0x66, 0x6f, 0x6f, 0x2e, + 0x74, 0x79, 0x70, 0x65, 0x2c, 0x20, 0x27, 0x62, 0x61, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x27, + 0x3a, 0x20, 0x62, 0x61, 0x72, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x7d, 0x29, 0x3a, 0x0f, 0x9a, 0x4a, + 0x0c, 0x0a, 0x0a, 0x0a, 0x01, 0x62, 0x6a, 0x05, 0x0a, 0x03, 0x41, 0x2e, 0x42, 0x22, 0xe6, 0x01, + 0x0a, 0x04, 0x50, 0x6f, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, + 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, + 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x2f, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x42, 0x09, 0x9a, 0x4a, 0x06, 0x12, 0x04, 0x75, 0x73, 0x65, + 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x3a, 0x6d, 0x9a, 0x4a, 0x6a, 0x0a, 0x3c, 0x0a, 0x03, + 0x72, 0x65, 0x73, 0x72, 0x35, 0x0a, 0x18, 0x70, 0x6f, 0x73, 0x74, 0x2e, 0x50, 0x6f, 0x73, 0x74, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x47, 0x65, 0x74, 0x50, 0x6f, 0x73, 0x74, 0x12, + 0x0a, 0x0a, 0x02, 0x69, 0x64, 0x12, 0x04, 0x24, 0x2e, 0x69, 0x64, 0x1a, 0x03, 0x31, 0x30, 0x73, + 0x22, 0x08, 0x0a, 0x06, 0x0a, 0x02, 0x32, 0x73, 0x10, 0x03, 0x0a, 0x12, 0x0a, 0x04, 0x70, 0x6f, + 0x73, 0x74, 0x18, 0x01, 0x5a, 0x08, 0x72, 0x65, 0x73, 0x2e, 0x70, 0x6f, 0x73, 0x74, 0x0a, 0x16, + 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x6a, 0x0e, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x06, + 0x1a, 0x04, 0x70, 0x6f, 0x73, 0x74, 0x22, 0xc8, 0x04, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x03, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, + 0x49, 0x74, 0x65, 0x6d, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x37, 0x0a, 0x07, 0x70, + 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x66, + 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x2e, 0x50, + 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x70, 0x72, 0x6f, + 0x66, 0x69, 0x6c, 0x65, 0x12, 0x2f, 0x0a, 0x06, 0x61, 0x74, 0x74, 0x72, 0x5f, 0x61, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x41, 0x48, 0x00, 0x52, 0x05, + 0x61, 0x74, 0x74, 0x72, 0x41, 0x12, 0x26, 0x0a, 0x01, 0x62, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x16, 0x2e, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x55, 0x73, + 0x65, 0x72, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x42, 0x48, 0x00, 0x52, 0x01, 0x62, 0x1a, 0x50, 0x0a, + 0x0c, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, + 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, + 0x2f, 0x0a, 0x05, 0x41, 0x74, 0x74, 0x72, 0x41, 0x12, 0x10, 0x0a, 0x03, 0x66, 0x6f, 0x6f, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x66, 0x6f, 0x6f, 0x3a, 0x14, 0x9a, 0x4a, 0x11, 0x1a, + 0x0f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x41, + 0x1a, 0x2f, 0x0a, 0x05, 0x41, 0x74, 0x74, 0x72, 0x42, 0x12, 0x10, 0x0a, 0x03, 0x62, 0x61, 0x72, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x62, 0x61, 0x72, 0x3a, 0x14, 0x9a, 0x4a, 0x11, + 0x1a, 0x0f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x2e, 0x41, 0x74, 0x74, 0x72, + 0x42, 0x3a, 0xa5, 0x01, 0x9a, 0x4a, 0xa1, 0x01, 0x0a, 0x8a, 0x01, 0x0a, 0x03, 0x72, 0x65, 0x73, + 0x72, 0x82, 0x01, 0x0a, 0x18, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0f, 0x0a, + 0x02, 0x69, 0x64, 0x12, 0x09, 0x24, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x12, 0x2f, + 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x27, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x49, 0x74, 0x65, + 0x6d, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x2e, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x28, 0x27, 0x49, 0x54, 0x45, 0x4d, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x31, 0x27, 0x29, 0x1a, + 0x03, 0x32, 0x30, 0x73, 0x22, 0x1f, 0x12, 0x1d, 0x0a, 0x02, 0x31, 0x73, 0x11, 0x66, 0x66, 0x66, + 0x66, 0x66, 0x66, 0xe6, 0x3f, 0x19, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0xfb, 0x3f, 0x22, 0x03, + 0x33, 0x30, 0x73, 0x28, 0x03, 0x0a, 0x12, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x5a, + 0x08, 0x72, 0x65, 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x42, 0x06, 0x0a, 0x04, 0x61, 0x74, 0x74, + 0x72, 0x22, 0x8d, 0x05, 0x0a, 0x04, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2d, + 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x66, + 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x2e, 0x49, + 0x74, 0x65, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x12, 0x35, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x2e, 0x41, 0x64, 0x64, 0x72, 0x42, 0x48, 0x00, 0x52, 0x01, 0x62, 0x1a, 0x38, 0x0a, 0x05, 0x41, - 0x64, 0x64, 0x72, 0x41, 0x12, 0x10, 0x0a, 0x03, 0x66, 0x6f, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x03, 0x66, 0x6f, 0x6f, 0x3a, 0x1d, 0x9a, 0x4a, 0x1a, 0x1a, 0x18, 0x75, 0x73, 0x65, - 0x72, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, - 0x41, 0x64, 0x64, 0x72, 0x41, 0x1a, 0x38, 0x0a, 0x05, 0x41, 0x64, 0x64, 0x72, 0x42, 0x12, 0x10, - 0x0a, 0x03, 0x62, 0x61, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x62, 0x61, 0x72, - 0x3a, 0x1d, 0x9a, 0x4a, 0x1a, 0x1a, 0x18, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x49, 0x74, 0x65, 0x6d, - 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x42, 0x22, - 0x38, 0x0a, 0x0c, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, - 0x13, 0x0a, 0x0f, 0x4c, 0x4f, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, - 0x5f, 0x30, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x4c, 0x4f, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, - 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x31, 0x10, 0x01, 0x3a, 0x17, 0x9a, 0x4a, 0x14, 0x1a, 0x12, + 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0xf1, 0x02, 0x0a, 0x08, 0x4c, + 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x64, 0x64, 0x72, 0x31, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x64, 0x64, 0x72, 0x31, 0x12, 0x14, 0x0a, + 0x05, 0x61, 0x64, 0x64, 0x72, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x64, + 0x64, 0x72, 0x32, 0x12, 0x38, 0x0a, 0x06, 0x61, 0x64, 0x64, 0x72, 0x5f, 0x61, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, + 0x64, 0x64, 0x72, 0x41, 0x48, 0x00, 0x52, 0x05, 0x61, 0x64, 0x64, 0x72, 0x41, 0x12, 0x2f, 0x0a, + 0x01, 0x62, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x66, 0x65, 0x64, 0x65, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x42, 0x48, 0x00, 0x52, 0x01, 0x62, 0x1a, 0x38, + 0x0a, 0x05, 0x41, 0x64, 0x64, 0x72, 0x41, 0x12, 0x10, 0x0a, 0x03, 0x66, 0x6f, 0x6f, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x66, 0x6f, 0x6f, 0x3a, 0x1d, 0x9a, 0x4a, 0x1a, 0x1a, 0x18, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x42, 0x07, 0x0a, 0x05, 0x61, 0x64, 0x64, 0x72, 0x33, 0x22, 0x71, 0x0a, 0x08, 0x49, - 0x74, 0x65, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x15, 0x49, 0x54, 0x45, 0x4d, 0x5f, - 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, - 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x49, 0x54, 0x45, 0x4d, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, - 0x31, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x49, 0x54, 0x45, 0x4d, 0x5f, 0x54, 0x59, 0x50, 0x45, - 0x5f, 0x32, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x49, 0x54, 0x45, 0x4d, 0x5f, 0x54, 0x59, 0x50, - 0x45, 0x5f, 0x33, 0x10, 0x03, 0x1a, 0x17, 0x9a, 0x4a, 0x14, 0x0a, 0x12, 0x75, 0x73, 0x65, 0x72, - 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x0e, - 0x9a, 0x4a, 0x0b, 0x1a, 0x09, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x32, 0x5e, - 0x0a, 0x11, 0x46, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x12, 0x44, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x50, 0x6f, 0x73, 0x74, 0x12, 0x1a, - 0x2e, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x47, 0x65, 0x74, 0x50, - 0x6f, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x66, 0x65, 0x64, - 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x6f, 0x73, 0x74, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x1a, 0x03, 0x9a, 0x4a, 0x00, 0x42, 0xad, - 0x01, 0x9a, 0x4a, 0x22, 0x12, 0x0f, 0x70, 0x6f, 0x73, 0x74, 0x2f, 0x70, 0x6f, 0x73, 0x74, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x75, 0x73, 0x65, 0x72, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x0a, 0x0e, 0x63, 0x6f, 0x6d, 0x2e, 0x66, 0x65, 0x64, 0x65, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0f, 0x46, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1d, 0x65, 0x78, 0x61, 0x6d, 0x70, - 0x6c, 0x65, 0x2f, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x66, 0x65, - 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xa2, 0x02, 0x03, 0x46, 0x58, 0x58, 0xaa, 0x02, - 0x0a, 0x46, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xca, 0x02, 0x0a, 0x46, 0x65, - 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xe2, 0x02, 0x16, 0x46, 0x65, 0x64, 0x65, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0xea, 0x02, 0x0a, 0x46, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x6e, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x41, 0x1a, 0x38, 0x0a, 0x05, 0x41, 0x64, 0x64, 0x72, + 0x42, 0x12, 0x10, 0x0a, 0x03, 0x62, 0x61, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, + 0x62, 0x61, 0x72, 0x3a, 0x1d, 0x9a, 0x4a, 0x1a, 0x1a, 0x18, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x49, + 0x74, 0x65, 0x6d, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x64, 0x64, + 0x72, 0x42, 0x22, 0x38, 0x0a, 0x0c, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, + 0x70, 0x65, 0x12, 0x13, 0x0a, 0x0f, 0x4c, 0x4f, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, + 0x59, 0x50, 0x45, 0x5f, 0x30, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x4c, 0x4f, 0x43, 0x41, 0x54, + 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x31, 0x10, 0x01, 0x3a, 0x17, 0x9a, 0x4a, + 0x14, 0x1a, 0x12, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x2e, 0x4c, 0x6f, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x07, 0x0a, 0x05, 0x61, 0x64, 0x64, 0x72, 0x33, 0x22, 0x71, + 0x0a, 0x08, 0x49, 0x74, 0x65, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x15, 0x49, 0x54, + 0x45, 0x4d, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, + 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x49, 0x54, 0x45, 0x4d, 0x5f, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x31, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x49, 0x54, 0x45, 0x4d, 0x5f, 0x54, + 0x59, 0x50, 0x45, 0x5f, 0x32, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x49, 0x54, 0x45, 0x4d, 0x5f, + 0x54, 0x59, 0x50, 0x45, 0x5f, 0x33, 0x10, 0x03, 0x1a, 0x17, 0x9a, 0x4a, 0x14, 0x0a, 0x12, 0x75, + 0x73, 0x65, 0x72, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x54, 0x79, 0x70, + 0x65, 0x3a, 0x0e, 0x9a, 0x4a, 0x0b, 0x1a, 0x09, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x49, 0x74, 0x65, + 0x6d, 0x32, 0x5e, 0x0a, 0x11, 0x46, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x44, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x50, 0x6f, 0x73, + 0x74, 0x12, 0x1a, 0x2e, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x47, + 0x65, 0x74, 0x50, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, + 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x6f, + 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x1a, 0x03, 0x9a, 0x4a, + 0x00, 0x42, 0xad, 0x01, 0x9a, 0x4a, 0x22, 0x12, 0x0f, 0x70, 0x6f, 0x73, 0x74, 0x2f, 0x70, 0x6f, + 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x75, + 0x73, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x0a, 0x0e, 0x63, 0x6f, 0x6d, 0x2e, 0x66, + 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0f, 0x46, 0x65, 0x64, 0x65, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1d, 0x65, 0x78, + 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2f, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x3b, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xa2, 0x02, 0x03, 0x46, 0x58, + 0x58, 0xaa, 0x02, 0x0a, 0x46, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xca, 0x02, + 0x0a, 0x46, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xe2, 0x02, 0x16, 0x46, 0x65, + 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0a, 0x46, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/_examples/02_simple/federation/federation_grpc_federation.pb.go b/_examples/02_simple/federation/federation_grpc_federation.pb.go index 0373cd6f..9d6d5430 100644 --- a/_examples/02_simple/federation/federation_grpc_federation.pb.go +++ b/_examples/02_simple/federation/federation_grpc_federation.pb.go @@ -54,6 +54,7 @@ type FederationService_Federation_GetPostResponseArgument struct { Loc *grpcfedcel.Location MapValue map[int64]string NullValue any + ParseFloat float64 Post *Post RandSource *grpcfedcel.Source SortedItems []*user.Item @@ -667,7 +668,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte type localValueType struct { *grpcfed.LocalValue vars struct { - _def15 bool + _def16 bool a *A date *grpcfedcel.Time fixed_rand *grpcfedcel.Rand @@ -675,6 +676,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte loc *grpcfedcel.Location map_value map[int64]string null_value any + parse_float float64 post *Post rand_source *grpcfedcel.Source sorted_items []*user.Item @@ -688,22 +690,23 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte value := &localValueType{LocalValue: grpcfed.NewLocalValue(ctx, s.celEnvOpts, "grpc.federation.private.GetPostResponseArgument", req)} // A tree view of message dependencies is shown below. /* - post ─┐ - _def15 ─┐ - a ─┤ - loc ─┐ │ - jp_time ─┤ - map_value ─┤ - null_value ─┤ - sorted_items ─┤ - sorted_values ─┤ - strings_join ─┤ - url ─┤ - date ─┐ │ - rand_source ─┐ │ - fixed_rand ─┐ │ - uuid ─┤ - value1 ─┤ + post ─┐ + _def16 ─┐ + a ─┤ + loc ─┐ │ + jp_time ─┤ + map_value ─┤ + null_value ─┤ + strings_join ─┐ │ + parse_float ─┤ + sorted_items ─┤ + sorted_values ─┤ + url ─┤ + date ─┐ │ + rand_source ─┐ │ + fixed_rand ─┐ │ + uuid ─┤ + value1 ─┤ */ eg, ctx1 := grpcfed.ErrorGroupWithContext(ctx) @@ -754,15 +757,15 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte // This section's codes are generated by the following proto definition. /* def { - name: "_def15" + name: "_def16" by: "grpc.federation.log.info('output federation log', {'post_message': post})" } */ if err := grpcfed.EvalDef(ctx1, value, grpcfed.Def[bool, *localValueType]{ - Name: `_def15`, + Name: `_def16`, Type: grpcfed.CELBoolType, Setter: func(value *localValueType, v bool) error { - value.vars._def15 = v + value.vars._def16 = v return nil }, By: `grpc.federation.log.info('output federation log', {'post_message': post})`, @@ -908,23 +911,44 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte // This section's codes are generated by the following proto definition. /* def { - name: "sorted_items" - by: "[user.Item{location:user.Item.Location{addr1:'a'}}, user.Item{location:user.Item.Location{addr1:'b'}}].sortDesc(v, v.location.addr1)" + name: "strings_join" + by: "grpc.federation.strings.join(['1', '2'], '.')" } */ - if err := grpcfed.EvalDef(ctx1, value, grpcfed.Def[[]*user.Item, *localValueType]{ - Name: `sorted_items`, - Type: grpcfed.CELListType(grpcfed.CELObjectType("user.Item")), - Setter: func(value *localValueType, v []*user.Item) error { - value.vars.sorted_items = v + if err := grpcfed.EvalDef(ctx1, value, grpcfed.Def[string, *localValueType]{ + Name: `strings_join`, + Type: grpcfed.CELStringType, + Setter: func(value *localValueType, v string) error { + value.vars.strings_join = v return nil }, - By: `[user.Item{location:user.Item.Location{addr1:'a'}}, user.Item{location:user.Item.Location{addr1:'b'}}].sortDesc(v, v.location.addr1)`, + By: `grpc.federation.strings.join(['1', '2'], '.')`, ByCacheIndex: 18, }); err != nil { grpcfed.RecordErrorToSpan(ctx1, err) return nil, err } + + // This section's codes are generated by the following proto definition. + /* + def { + name: "parse_float" + by: "grpc.federation.strings.parseFloat(strings_join, 64)" + } + */ + if err := grpcfed.EvalDef(ctx1, value, grpcfed.Def[float64, *localValueType]{ + Name: `parse_float`, + Type: grpcfed.CELDoubleType, + Setter: func(value *localValueType, v float64) error { + value.vars.parse_float = v + return nil + }, + By: `grpc.federation.strings.parseFloat(strings_join, 64)`, + ByCacheIndex: 19, + }); err != nil { + grpcfed.RecordErrorToSpan(ctx1, err) + return nil, err + } return nil, nil }) @@ -933,19 +957,19 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte // This section's codes are generated by the following proto definition. /* def { - name: "sorted_values" - by: "[4, 1, 3, 2].sortAsc(v, v)" + name: "sorted_items" + by: "[user.Item{location:user.Item.Location{addr1:'a'}}, user.Item{location:user.Item.Location{addr1:'b'}}].sortDesc(v, v.location.addr1)" } */ - if err := grpcfed.EvalDef(ctx1, value, grpcfed.Def[[]int64, *localValueType]{ - Name: `sorted_values`, - Type: grpcfed.CELListType(grpcfed.CELIntType), - Setter: func(value *localValueType, v []int64) error { - value.vars.sorted_values = v + if err := grpcfed.EvalDef(ctx1, value, grpcfed.Def[[]*user.Item, *localValueType]{ + Name: `sorted_items`, + Type: grpcfed.CELListType(grpcfed.CELObjectType("user.Item")), + Setter: func(value *localValueType, v []*user.Item) error { + value.vars.sorted_items = v return nil }, - By: `[4, 1, 3, 2].sortAsc(v, v)`, - ByCacheIndex: 19, + By: `[user.Item{location:user.Item.Location{addr1:'a'}}, user.Item{location:user.Item.Location{addr1:'b'}}].sortDesc(v, v.location.addr1)`, + ByCacheIndex: 20, }); err != nil { grpcfed.RecordErrorToSpan(ctx1, err) return nil, err @@ -958,19 +982,19 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte // This section's codes are generated by the following proto definition. /* def { - name: "strings_join" - by: "grpc.federation.strings.join(['a', 'b', 'c'], ',')" + name: "sorted_values" + by: "[4, 1, 3, 2].sortAsc(v, v)" } */ - if err := grpcfed.EvalDef(ctx1, value, grpcfed.Def[string, *localValueType]{ - Name: `strings_join`, - Type: grpcfed.CELStringType, - Setter: func(value *localValueType, v string) error { - value.vars.strings_join = v + if err := grpcfed.EvalDef(ctx1, value, grpcfed.Def[[]int64, *localValueType]{ + Name: `sorted_values`, + Type: grpcfed.CELListType(grpcfed.CELIntType), + Setter: func(value *localValueType, v []int64) error { + value.vars.sorted_values = v return nil }, - By: `grpc.federation.strings.join(['a', 'b', 'c'], ',')`, - ByCacheIndex: 20, + By: `[4, 1, 3, 2].sortAsc(v, v)`, + ByCacheIndex: 21, }); err != nil { grpcfed.RecordErrorToSpan(ctx1, err) return nil, err @@ -995,7 +1019,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte return nil }, By: `grpc.federation.url.parse('https://test_user:password@example.com/path')`, - ByCacheIndex: 21, + ByCacheIndex: 22, }); err != nil { grpcfed.RecordErrorToSpan(ctx1, err) return nil, err @@ -1020,7 +1044,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte return nil }, By: `grpc.federation.time.date(2023, 12, 25, 12, 10, 5, 0, grpc.federation.time.UTC())`, - ByCacheIndex: 22, + ByCacheIndex: 23, }); err != nil { grpcfed.RecordErrorToSpan(ctx1, err) return nil, err @@ -1041,7 +1065,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte return nil }, By: `grpc.federation.rand.newSource(date.unix())`, - ByCacheIndex: 23, + ByCacheIndex: 24, }); err != nil { grpcfed.RecordErrorToSpan(ctx1, err) return nil, err @@ -1062,7 +1086,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte return nil }, By: `grpc.federation.rand.new(rand_source)`, - ByCacheIndex: 24, + ByCacheIndex: 25, }); err != nil { grpcfed.RecordErrorToSpan(ctx1, err) return nil, err @@ -1083,7 +1107,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte return nil }, By: `.grpc.federation.uuid.newRandomFromRand(fixed_rand)`, - ByCacheIndex: 25, + ByCacheIndex: 26, }); err != nil { grpcfed.RecordErrorToSpan(ctx1, err) return nil, err @@ -1108,7 +1132,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte return nil }, By: `grpc.federation.metadata.incoming()['key1'][0]`, - ByCacheIndex: 26, + ByCacheIndex: 27, }); err != nil { grpcfed.RecordErrorToSpan(ctx1, err) return nil, err @@ -1128,6 +1152,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte req.Loc = value.vars.loc req.MapValue = value.vars.map_value req.NullValue = value.vars.null_value + req.ParseFloat = value.vars.parse_float req.Post = value.vars.post req.RandSource = value.vars.rand_source req.SortedItems = value.vars.sorted_items @@ -1145,7 +1170,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte if err := grpcfed.SetCELValue(ctx, &grpcfed.SetCELValueParam[*Post]{ Value: value, Expr: `post`, - CacheIndex: 27, + CacheIndex: 28, Setter: func(v *Post) error { ret.Post = v return nil @@ -1158,7 +1183,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte if err := grpcfed.SetCELValue(ctx, &grpcfed.SetCELValueParam[string]{ Value: value, Expr: `'hello'`, - CacheIndex: 28, + CacheIndex: 29, Setter: func(v string) error { ret.Str = v return nil @@ -1171,7 +1196,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte if err := grpcfed.SetCELValue(ctx, &grpcfed.SetCELValueParam[string]{ Value: value, Expr: `uuid.string()`, - CacheIndex: 29, + CacheIndex: 30, Setter: func(v string) error { ret.Uuid = v return nil @@ -1184,7 +1209,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte if err := grpcfed.SetCELValue(ctx, &grpcfed.SetCELValueParam[string]{ Value: value, Expr: `loc.string()`, - CacheIndex: 30, + CacheIndex: 31, Setter: func(v string) error { ret.Loc = v return nil @@ -1197,7 +1222,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte if err := grpcfed.SetCELValue(ctx, &grpcfed.SetCELValueParam[string]{ Value: value, Expr: `value1`, - CacheIndex: 31, + CacheIndex: 32, Setter: func(v string) error { ret.Value1 = v return nil @@ -1210,7 +1235,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte if err := grpcfed.SetCELValue(ctx, &grpcfed.SetCELValueParam[string]{ Value: value, Expr: `Item.ItemType.name(Item.ItemType.ITEM_TYPE_1)`, - CacheIndex: 32, + CacheIndex: 33, Setter: func(v string) error { ret.ItemTypeName = v return nil @@ -1223,7 +1248,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte if err := grpcfed.SetCELValue(ctx, &grpcfed.SetCELValueParam[string]{ Value: value, Expr: `Item.Location.LocationType.name(Item.Location.LocationType.LOCATION_TYPE_1)`, - CacheIndex: 33, + CacheIndex: 34, Setter: func(v string) error { ret.LocationTypeName = v return nil @@ -1236,7 +1261,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte if err := grpcfed.SetCELValue(ctx, &grpcfed.SetCELValueParam[string]{ Value: value, Expr: `user.Item.ItemType.name(user.Item.ItemType.ITEM_TYPE_2)`, - CacheIndex: 34, + CacheIndex: 35, Setter: func(v string) error { ret.UserItemTypeName = v return nil @@ -1249,7 +1274,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte if err := grpcfed.SetCELValue(ctx, &grpcfed.SetCELValueParam[user.Item_ItemType]{ Value: value, Expr: `user.Item.ItemType.value('ITEM_TYPE_1')`, - CacheIndex: 35, + CacheIndex: 36, Setter: func(v user.Item_ItemType) error { itemTypeValueEnumValue, err := s.cast_User_Item_ItemType__to__Federation_Item_ItemType(v) if err != nil { @@ -1266,7 +1291,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte if err := grpcfed.SetCELValue(ctx, &grpcfed.SetCELValueParam[user.Item_ItemType]{ Value: value, Expr: `user.Item.ItemType.value('ITEM_TYPE_1')`, - CacheIndex: 36, + CacheIndex: 37, Setter: func(v user.Item_ItemType) error { itemTypeValueIntValue, err := s.cast_User_Item_ItemType__to__int32(v) if err != nil { @@ -1283,7 +1308,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte if err := grpcfed.SetCELValue(ctx, &grpcfed.SetCELValueParam[Item_ItemType]{ Value: value, Expr: `1`, - CacheIndex: 37, + CacheIndex: 38, Setter: func(v Item_ItemType) error { ret.ItemTypeValueCast = v return nil @@ -1296,7 +1321,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte if err := grpcfed.SetCELValue(ctx, &grpcfed.SetCELValueParam[Item_Location_LocationType]{ Value: value, Expr: `Item.Location.LocationType.value('LOCATION_TYPE_1')`, - CacheIndex: 38, + CacheIndex: 39, Setter: func(v Item_Location_LocationType) error { locationTypeValueValue, err := s.cast_Federation_Item_Location_LocationType__to__int32(v) if err != nil { @@ -1313,7 +1338,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte if err := grpcfed.SetCELValue(ctx, &grpcfed.SetCELValueParam[user.Item_ItemType]{ Value: value, Expr: `user.Item.ItemType.value('ITEM_TYPE_2')`, - CacheIndex: 39, + CacheIndex: 40, Setter: func(v user.Item_ItemType) error { userItemTypeValueValue, err := s.cast_User_Item_ItemType__to__int32(v) if err != nil { @@ -1330,7 +1355,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte if err := grpcfed.SetCELValue(ctx, &grpcfed.SetCELValueParam[*A]{ Value: value, Expr: `a`, - CacheIndex: 40, + CacheIndex: 41, Setter: func(v *A) error { ret.A = v return nil @@ -1343,7 +1368,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte if err := grpcfed.SetCELValue(ctx, &grpcfed.SetCELValueParam[[]int32]{ Value: value, Expr: `sorted_values`, - CacheIndex: 41, + CacheIndex: 42, Setter: func(v []int32) error { ret.SortedValues = v return nil @@ -1356,7 +1381,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte if err := grpcfed.SetCELValue(ctx, &grpcfed.SetCELValueParam[[]*user.Item]{ Value: value, Expr: `sorted_items`, - CacheIndex: 42, + CacheIndex: 43, Setter: func(v []*user.Item) error { sortedItemsValue, err := s.cast_repeated_User_Item__to__repeated_Federation_Item(v) if err != nil { @@ -1373,7 +1398,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte if err := grpcfed.SetCELValue(ctx, &grpcfed.SetCELValueParam[map[int64]string]{ Value: value, Expr: `map_value`, - CacheIndex: 43, + CacheIndex: 44, Setter: func(v map[int64]string) error { mapValueValue, err := s.cast_map_int64_string__to__map_int32_string(v) if err != nil { @@ -1390,7 +1415,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte if err := grpcfed.SetCELValue(ctx, &grpcfed.SetCELValueParam[*wrapperspb.DoubleValue]{ Value: value, Expr: `google.protobuf.DoubleValue{value: 1.23}`, - CacheIndex: 44, + CacheIndex: 45, Setter: func(v *wrapperspb.DoubleValue) error { doubleWrapperValueValue, err := s.cast_Google_Protobuf_DoubleValue__to__Google_Protobuf_DoubleValue(v) if err != nil { @@ -1407,7 +1432,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte if err := grpcfed.SetCELValue(ctx, &grpcfed.SetCELValueParam[*wrapperspb.DoubleValue]{ Value: value, Expr: `google.protobuf.FloatValue{value: 3.45}`, - CacheIndex: 45, + CacheIndex: 46, Setter: func(v *wrapperspb.DoubleValue) error { floatWrapperValueValue, err := s.cast_Google_Protobuf_DoubleValue__to__Google_Protobuf_FloatValue(v) if err != nil { @@ -1424,7 +1449,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte if err := grpcfed.SetCELValue(ctx, &grpcfed.SetCELValueParam[*wrapperspb.Int64Value]{ Value: value, Expr: `google.protobuf.Int64Value{value: 1}`, - CacheIndex: 46, + CacheIndex: 47, Setter: func(v *wrapperspb.Int64Value) error { i64WrapperValueValue, err := s.cast_Google_Protobuf_Int64Value__to__Google_Protobuf_Int64Value(v) if err != nil { @@ -1441,7 +1466,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte if err := grpcfed.SetCELValue(ctx, &grpcfed.SetCELValueParam[*wrapperspb.UInt64Value]{ Value: value, Expr: `google.protobuf.UInt64Value{value: uint(2)}`, - CacheIndex: 47, + CacheIndex: 48, Setter: func(v *wrapperspb.UInt64Value) error { u64WrapperValueValue, err := s.cast_Google_Protobuf_UInt64Value__to__Google_Protobuf_UInt64Value(v) if err != nil { @@ -1458,7 +1483,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte if err := grpcfed.SetCELValue(ctx, &grpcfed.SetCELValueParam[*wrapperspb.Int64Value]{ Value: value, Expr: `google.protobuf.Int32Value{value: 3}`, - CacheIndex: 48, + CacheIndex: 49, Setter: func(v *wrapperspb.Int64Value) error { i32WrapperValueValue, err := s.cast_Google_Protobuf_Int64Value__to__Google_Protobuf_Int32Value(v) if err != nil { @@ -1475,7 +1500,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte if err := grpcfed.SetCELValue(ctx, &grpcfed.SetCELValueParam[*wrapperspb.UInt64Value]{ Value: value, Expr: `google.protobuf.UInt32Value{value: uint(4)}`, - CacheIndex: 49, + CacheIndex: 50, Setter: func(v *wrapperspb.UInt64Value) error { u32WrapperValueValue, err := s.cast_Google_Protobuf_UInt64Value__to__Google_Protobuf_UInt32Value(v) if err != nil { @@ -1492,7 +1517,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte if err := grpcfed.SetCELValue(ctx, &grpcfed.SetCELValueParam[*wrapperspb.BoolValue]{ Value: value, Expr: `google.protobuf.BoolValue{value: true}`, - CacheIndex: 50, + CacheIndex: 51, Setter: func(v *wrapperspb.BoolValue) error { boolWrapperValueValue, err := s.cast_Google_Protobuf_BoolValue__to__Google_Protobuf_BoolValue(v) if err != nil { @@ -1509,7 +1534,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte if err := grpcfed.SetCELValue(ctx, &grpcfed.SetCELValueParam[*wrapperspb.StringValue]{ Value: value, Expr: `google.protobuf.StringValue{value: 'hello'}`, - CacheIndex: 51, + CacheIndex: 52, Setter: func(v *wrapperspb.StringValue) error { stringWrapperValueValue, err := s.cast_Google_Protobuf_StringValue__to__Google_Protobuf_StringValue(v) if err != nil { @@ -1526,7 +1551,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte if err := grpcfed.SetCELValue(ctx, &grpcfed.SetCELValueParam[*wrapperspb.BytesValue]{ Value: value, Expr: `google.protobuf.BytesValue{value: bytes('world')}`, - CacheIndex: 52, + CacheIndex: 53, Setter: func(v *wrapperspb.BytesValue) error { bytesWrapperValueValue, err := s.cast_Google_Protobuf_BytesValue__to__Google_Protobuf_BytesValue(v) if err != nil { @@ -1543,7 +1568,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte if err := grpcfed.SetCELValue(ctx, &grpcfed.SetCELValueParam[string]{ Value: value, Expr: `'hello\nworld'`, - CacheIndex: 53, + CacheIndex: 54, Setter: func(v string) error { ret.Hello = v return nil @@ -1556,7 +1581,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte if err := grpcfed.SetCELValue(ctx, &grpcfed.SetCELValueParam[*timestamppb.Timestamp]{ Value: value, Expr: `null`, - CacheIndex: 54, + CacheIndex: 55, Setter: func(v *timestamppb.Timestamp) error { ret.NullTimestamp = v return nil @@ -1569,7 +1594,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte if err := grpcfed.SetCELValue(ctx, &grpcfed.SetCELValueParam[*timestamppb.Timestamp]{ Value: value, Expr: `null_value`, - CacheIndex: 55, + CacheIndex: 56, Setter: func(v *timestamppb.Timestamp) error { ret.NullTimestamp2 = v return nil @@ -1582,7 +1607,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte if err := grpcfed.SetCELValue(ctx, &grpcfed.SetCELValueParam[*timestamppb.Timestamp]{ Value: value, Expr: `true ? null : google.protobuf.Timestamp{}`, - CacheIndex: 56, + CacheIndex: 57, Setter: func(v *timestamppb.Timestamp) error { ret.NullTimestamp3 = v return nil @@ -1595,7 +1620,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte if err := grpcfed.SetCELValue(ctx, &grpcfed.SetCELValueParam[string]{ Value: value, Expr: `jp_time.location().string()`, - CacheIndex: 57, + CacheIndex: 58, Setter: func(v string) error { ret.JpLoc = v return nil @@ -1608,7 +1633,7 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte if err := grpcfed.SetCELValue(ctx, &grpcfed.SetCELValueParam[string]{ Value: value, Expr: `strings_join`, - CacheIndex: 58, + CacheIndex: 59, Setter: func(v string) error { ret.StringsJoin = v return nil @@ -1617,11 +1642,24 @@ func (s *FederationService) resolve_Federation_GetPostResponse(ctx context.Conte grpcfed.RecordErrorToSpan(ctx, err) return nil, err } + // (grpc.federation.field).by = "parse_float" + if err := grpcfed.SetCELValue(ctx, &grpcfed.SetCELValueParam[float64]{ + Value: value, + Expr: `parse_float`, + CacheIndex: 60, + Setter: func(v float64) error { + ret.ParseFloat = v + return nil + }, + }); err != nil { + grpcfed.RecordErrorToSpan(ctx, err) + return nil, err + } // (grpc.federation.field).by = "url.userinfo().username()" if err := grpcfed.SetCELValue(ctx, &grpcfed.SetCELValueParam[string]{ Value: value, Expr: `url.userinfo().username()`, - CacheIndex: 59, + CacheIndex: 61, Setter: func(v string) error { ret.UrlUserName = v return nil @@ -1675,7 +1713,7 @@ func (s *FederationService) resolve_Federation_Post(ctx context.Context, req *Fe if err := grpcfed.SetCELValue(ctx, &grpcfed.SetCELValueParam[string]{ Value: value, Expr: `$.id`, - CacheIndex: 60, + CacheIndex: 62, Setter: func(v string) error { args.Id = v return nil @@ -1691,7 +1729,7 @@ func (s *FederationService) resolve_Federation_Post(ctx context.Context, req *Fe return grpcfed.WithRetry(ctx, &grpcfed.RetryParam[post.GetPostResponse]{ Value: value, If: `true`, - CacheIndex: 61, + CacheIndex: 63, BackOff: b, Body: func() (*post.GetPostResponse, error) { return s.client.Post_PostServiceClient.GetPost(ctx, args) @@ -1726,7 +1764,7 @@ func (s *FederationService) resolve_Federation_Post(ctx context.Context, req *Fe return nil }, By: `res.post`, - ByCacheIndex: 62, + ByCacheIndex: 64, }); err != nil { grpcfed.RecordErrorToSpan(ctx, err) return nil, err @@ -1755,7 +1793,7 @@ func (s *FederationService) resolve_Federation_Post(ctx context.Context, req *Fe if err := grpcfed.SetCELValue(ctx, &grpcfed.SetCELValueParam[*post.Post]{ Value: value, Expr: `post`, - CacheIndex: 63, + CacheIndex: 65, Setter: func(v *post.Post) error { args.Id = v.GetId() args.Title = v.GetTitle() @@ -1793,7 +1831,7 @@ func (s *FederationService) resolve_Federation_Post(ctx context.Context, req *Fe if err := grpcfed.SetCELValue(ctx, &grpcfed.SetCELValueParam[*User]{ Value: value, Expr: `user`, - CacheIndex: 64, + CacheIndex: 66, Setter: func(v *User) error { ret.User = v return nil @@ -1849,7 +1887,7 @@ func (s *FederationService) resolve_Federation_User(ctx context.Context, req *Fe if err := grpcfed.SetCELValue(ctx, &grpcfed.SetCELValueParam[string]{ Value: value, Expr: `$.user_id`, - CacheIndex: 65, + CacheIndex: 67, Setter: func(v string) error { args.Id = v return nil @@ -1861,7 +1899,7 @@ func (s *FederationService) resolve_Federation_User(ctx context.Context, req *Fe if err := grpcfed.SetCELValue(ctx, &grpcfed.SetCELValueParam[user.Item_ItemType]{ Value: value, Expr: `user.Item.ItemType.value('ITEM_TYPE_1')`, - CacheIndex: 66, + CacheIndex: 68, Setter: func(v user.Item_ItemType) error { typeValue, err := s.cast_User_Item_ItemType__to__int32(v) if err != nil { @@ -1887,7 +1925,7 @@ func (s *FederationService) resolve_Federation_User(ctx context.Context, req *Fe return grpcfed.WithRetry(ctx, &grpcfed.RetryParam[user.GetUserResponse]{ Value: value, If: `true`, - CacheIndex: 67, + CacheIndex: 69, BackOff: b, Body: func() (*user.GetUserResponse, error) { return s.client.User_UserServiceClient.GetUser(ctx, args) @@ -1922,7 +1960,7 @@ func (s *FederationService) resolve_Federation_User(ctx context.Context, req *Fe return nil }, By: `res.user`, - ByCacheIndex: 68, + ByCacheIndex: 70, }); err != nil { grpcfed.RecordErrorToSpan(ctx, err) return nil, err @@ -2428,6 +2466,7 @@ func (s *FederationService) logvalue_Federation_GetPostResponse(v *GetPostRespon slog.Any("null_timestamp3", s.logvalue_Google_Protobuf_Timestamp(v.GetNullTimestamp3())), slog.String("jp_loc", v.GetJpLoc()), slog.String("strings_join", v.GetStringsJoin()), + slog.Float64("parse_float", v.GetParseFloat()), slog.String("url_user_name", v.GetUrlUserName()), ) } diff --git a/_examples/02_simple/main_test.go b/_examples/02_simple/main_test.go index 070bcd26..42a86ed8 100644 --- a/_examples/02_simple/main_test.go +++ b/_examples/02_simple/main_test.go @@ -317,7 +317,8 @@ func TestFederation(t *testing.T) { NullTimestamp2: nil, NullTimestamp3: nil, JpLoc: "JST", - StringsJoin: "a,b,c", + StringsJoin: "1.2", + ParseFloat: 1.2, UrlUserName: "test_user", }, cmpopts.IgnoreUnexported( federation.GetPostResponse{}, diff --git a/_examples/02_simple/proto/federation/federation.proto b/_examples/02_simple/proto/federation/federation.proto index cc6b7c20..1307666b 100644 --- a/_examples/02_simple/proto/federation/federation.proto +++ b/_examples/02_simple/proto/federation/federation.proto @@ -31,7 +31,8 @@ message GetPostResponse { args { name: "id", by: "$.id" } } } - def { name: "strings_join" by: "grpc.federation.strings.join(['a', 'b', 'c'], ',')" } + def { name: "strings_join" by: "grpc.federation.strings.join(['1', '2'], '.')" } + def { name: "parse_float" by: "grpc.federation.strings.parseFloat(strings_join, 64)" } def { name: "url" by: "grpc.federation.url.parse('https://test_user:password@example.com/path')" } def { name: "date" by: "grpc.federation.time.date(2023, 12, 25, 12, 10, 5, 0, grpc.federation.time.UTC())" } def { name: "rand_source" by: "grpc.federation.rand.newSource(date.unix())" } @@ -79,7 +80,8 @@ message GetPostResponse { google.protobuf.Timestamp null_timestamp3 = 30 [(grpc.federation.field).by = "true ? null : google.protobuf.Timestamp{}"]; string jp_loc = 31 [(grpc.federation.field).by = "jp_time.location().string()"]; string strings_join = 32 [(grpc.federation.field).by = "strings_join"]; - string url_user_name = 33 [(grpc.federation.field).by = "url.userinfo().username()"]; + double parse_float = 33 [(grpc.federation.field).by = "parse_float"]; + string url_user_name = 34 [(grpc.federation.field).by = "url.userinfo().username()"]; } message A { diff --git a/docs/cel/strings.md b/docs/cel/strings.md index 4291f532..52e8313b 100644 --- a/docs/cel/strings.md +++ b/docs/cel/strings.md @@ -1,10 +1,10 @@ # grpc.federation.strings APIs -The API for this package was created based on Go's [`strings`](https://pkg.go.dev/strings) package. +The API for this package was created based on Go's [`strings`](https://pkg.go.dev/strings) and [`strconv`](https://pkg.go.dev/strconv) packages. # Index -## Functions +## Strings Functions - [`clone`](#clone) - [`compare`](#compare) @@ -46,7 +46,42 @@ The API for this package was created based on Go's [`strings`](https://pkg.go.de - [`trimSpace`](#trimSpace) - [`trimSuffix`](#trimSuffix) -# Functions +## Strconv Functions + +- [`appendBool`](#appendBool) +- [`appendFloat`](#appendFloat) +- [`appendInt`](#appendInt) +- [`appendQuote`](#appendQuote) +- [`appendQuoteRune`](#appendQuoteRune) +- [`appendQuoteRuneToASCII`](#appendQuoteRuneToASCII) +- [`appendQuoteRuneToGraphic`](#appendQuoteRuneToGraphic) +- [`appendQuoteToASCII`](#appendQuoteToASCII) +- [`appendUint`](#appendUint) +- [`atoi`](#atoi) +- [`canBackquote`](#canBackquote) +- [`formatBool`](#formatBool) +- [`formatComplex`](#formatComplex) +- [`formatFloat`](#formatFloat) +- [`formatInt`](#formatInt) +- [`formatUint`](#formatUint) +- [`isGraphic`](#isGraphic) +- [`isPrint`](#isPrint) +- [`itoa`](#itoa) +- [`parseBool`](#parseBool) +- [`parseComplex`](#parseComplex) +- [`parseFloat`](#parseFloat) +- [`parseInt`](#parseInt) +- [`parseUint`](#parseUint) +- [`quote`](#quote) +- [`quoteRune`](#quoteRune) +- [`quoteRuneToGraphic`](#quoteRuneToGraphic) +- [`quoteToASCII`](#quoteToASCII) +- [`quoteToGraphic`](#quoteToGraphic) +- [`quotedPrefix`](#quotedPrefix) +- [`unquote`](#unquote) +- [`unquoteChar`](#unquoteChar) + +# Strings Functions ## clone @@ -739,3 +774,493 @@ grpc.federation.strings.trimSpace(" hello ") //=> "hello" grpc.federation.strings.trimSuffix("hello world", "world") //=> "hello " grpc.federation.strings.trimSuffix("hello world", "hello") //=> "hello world" ``` + +# `strconv` Functions + +Sure! Here's the requested unified format for the functions you listed: + +## appendBool +Appends the string form of a boolean value to a byte slice. + +### Parameters +`appendBool(b []byte, v bool) []byte` +`appendBool(s string, v bool) string` + +- `b`: byte slice to append the boolean string to. +- `s`: string to append the boolean string to. +- `v`: the boolean value to convert to a string and append. + +### Examples +```cel +grpc.federation.strings.appendBool(b"hello ", true) //=> "hello true" +grpc.federation.strings.appendBool("hello ", true) //=> "hello true" +``` + +## appendFloat +Appends the string form of a floating-point value to a byte slice. + +### Parameters +`appendFloat(b []byte, f float64, fmt byte, prec int, bitSize int) []byte` +`appendFloat(s string, f float64, fmt byte, prec int, bitSize int) string` + +- `b`: byte slice to append the float string to. +- `s`: string to append the float string to. +- `f`: the floating-point value to convert to a string and append. +- `fmt`: the format for the floating-point number (`'f'`, `'e'`, `'g'`, etc.). +- `prec`: the precision of the floating-point number. +- `bitSize`: the size of the float (32 for `float32`, 64 for `float64`). + +### Examples +```cel +grpc.federation.strings.appendFloat(b"price: ", 1.23, 'f', 2, 64) //=> "price: 1.23" +grpc.federation.strings.appendFloat("price: ", 1.23, 'f', 2, 64) //=> "price: 1.23" +``` + +## appendInt +Appends the string form of an integer value to a byte slice. + +### Parameters +`appendInt(b []byte, i int64, base int) []byte` +`appendInt(s string, i int64, base int) string` + +- `b`: byte slice to append the integer string to. +- `s`: string to append the integer string to. +- `i`: the integer value to convert to a string and append. +- `base`: the numeric base (e.g., 10 for decimal, 16 for hexadecimal). + +### Examples +```cel +grpc.federation.strings.appendInt(b"number: ", 42, 10) //=> "number: 42" +grpc.federation.strings.appendInt("number: ", 42, 10) //=> "number: 42" +``` + +## appendQuote +Appends the quoted string form of `s` to a byte slice. + +### Parameters +`appendQuote(b []byte, s string) []byte` +`appendQuote(s string, s string) string` + +- `b`: byte slice to append the quoted string to. +- `s`: string to append the quoted string to. +- `s`: the string to be quoted and appended. + +### Examples +```cel +grpc.federation.strings.appendQuote(b"quoted: ", "hello") //=> "quoted: \"hello\"" +grpc.federation.strings.appendQuote("quoted: ", "hello") //=> "quoted: \"hello\"" +``` + +## appendQuoteRune +Appends the quoted rune form of `r` to a byte slice. + +### Parameters +`appendQuoteRune(b []byte, r rune) []byte` +`appendQuoteRune(s string, r rune) string` + +- `b`: byte slice to append the quoted rune to. +- `s`: string to append the quoted rune to. +- `r`: the rune to be quoted and appended. + +### Examples +```cel +grpc.federation.strings.appendQuoteRune(b"quoted: ", 'a') //=> "quoted: 'a'" +grpc.federation.strings.appendQuoteRune("quoted: ", 'a') //=> "quoted: 'a'" +``` + +## appendQuoteRuneToASCII +Appends the ASCII-quoted string form of `r` to a byte slice. + +### Parameters +`appendQuoteRuneToASCII(b []byte, r rune) []byte` +`appendQuoteRuneToASCII(s string, r rune) string` + +- `b`: byte slice to append the quoted ASCII rune to. +- `s`: string to append the quoted ASCII rune to. +- `r`: the rune to be quoted in ASCII form and appended. + +### Examples +```cel +grpc.federation.strings.appendQuoteRuneToASCII(b"ascii: ", 'a') //=> "ascii: 'a'" +grpc.federation.strings.appendQuoteRuneToASCII("ascii: ", 'a') //=> "ascii: 'a'" +``` + +## appendQuoteRuneToGraphic +Appends the graphic-quoted string form of `r` to a byte slice. + +### Parameters +`appendQuoteRuneToGraphic(b []byte, r rune) []byte` +`appendQuoteRuneToGraphic(s string, r rune) string` + +- `b`: byte slice to append the quoted graphic rune to. +- `s`: string to append the quoted graphic rune to. +- `r`: the rune to be quoted in graphic form and appended. + +### Examples +```cel +grpc.federation.strings.appendQuoteRuneToGraphic(b"graphic: ", 'a') //=> "graphic: 'a'" +grpc.federation.strings.appendQuoteRuneToGraphic("graphic: ", 'a') //=> "graphic: 'a'" +``` + +## appendQuoteToASCII +Appends the ASCII-quoted string form of `s` to a byte slice. + +### Parameters +`appendQuoteToASCII(b []byte, s string) []byte` +`appendQuoteToASCII(s string, s string) string` + +- `b`: byte slice to append the quoted ASCII string to. +- `s`: string to append the quoted ASCII string to. +- `s`: the string to be quoted in ASCII form and appended. + +### Examples +```cel +grpc.federation.strings.appendQuoteToASCII(b"ascii: ", "abc") //=> "ascii: \"abc\"" +grpc.federation.strings.appendQuoteToASCII("ascii: ", "abc") //=> "ascii: \"abc\"" +``` + +## appendUint +Appends the string form of an unsigned integer value to a byte slice. + +### Parameters +`appendUint(b []byte, u uint64, base int) []byte` +`appendUint(s string, u uint64, base int) string` + +- `b`: byte slice to append the unsigned integer string to. +- `s`: string to append the unsigned integer string to. +- `u`: the unsigned integer value to convert to a string and append. +- `base`: the numeric base (e.g., 10 for decimal, 16 for hexadecimal). + +### Examples +```cel +grpc.federation.strings.appendUint(b"number: ", 123, 10) //=> "number: 123" +grpc.federation.strings.appendUint("number: ", 123, 10) //=> "number: 123" +``` + +## atoi +Parses a string and returns the integer it represents. + +### Parameters +`atoi(s string) int` + +- `s`: the string to parse as an integer. + +### Examples +```cel +grpc.federation.strings.atoi("123") //=> 123 +``` + +## canBackquote +Reports whether the string `s` can be represented unchanged as a single-line backquoted string. + +### Parameters +`canBackquote(s string) bool` + +- `s`: the string to check if it can be backquoted. + +### Examples +```cel +grpc.federation.strings.canBackquote("hello") //=> true +grpc.federation.strings.canBackquote("hello\nworld") //=> false +``` + +## formatBool +Returns the string representation of a boolean value. + +### Parameters +`formatBool(v bool) string` + +- `v`: the boolean value to format as a string. + +### Examples +```cel +grpc.federation.strings.formatBool(true) //=> "true" +grpc.federation.strings.formatBool(false) //=> "false" +``` + +## formatComplex +Returns the string representation of a complex number. + +### Parameters +`formatComplex(c complex128, fmt byte, prec int, bitSize int) string` + +- `c`: the complex number to format as a string. +- `fmt`: the format for the complex number. +- `prec`: the precision of the complex number. +- `bitSize`: the bit size of the complex number. + +### Examples +```cel +grpc.federation.strings.formatComplex(1.23+4.56i, 'f', 2, 64) //=> "(1.23+4.56i)" +``` + +## formatFloat +Returns the string representation of a floating-point number. + +### Parameters +`formatFloat(f float64, fmt byte, prec int, bitSize int) string` + +- `f`: the floating-point number to format as a string. +- `fmt`: the format for the floating-point number (`'f'`, `'e'`, `'g'`, etc.). +- `prec`: the precision of the floating-point number. +- `bitSize`: the size of the float (32 for `float32`, 64 for `float64`). + +### Examples +```cel +grpc.federation.strings.formatFloat(1.23, 'f', 2, 64) //=> "1 + +.23" +``` + +## formatInt +Returns the string representation of an integer. + +### Parameters +`formatInt(i int64, base int) string` + +- `i`: the integer value to format as a string. +- `base`: the numeric base (e.g., 10 for decimal, 16 for hexadecimal). + +### Examples +```cel +grpc.federation.strings.formatInt(42, 10) //=> "42" +``` + +## formatUint +Returns the string representation of an unsigned integer. + +### Parameters +`formatUint(u uint64, base int) string` + +- `u`: the unsigned integer value to format as a string. +- `base`: the numeric base (e.g., 10 for decimal, 16 for hexadecimal). + +### Examples +```cel +grpc.federation.strings.formatUint(123, 10) //=> "123" +``` + +## isGraphic +Returns `true` if the provided rune is a graphic, i.e., a printable character other than space. + +### Parameters +`isGraphic(r rune) bool` + +- `r`: the rune to check if it's a graphic character. + +### Examples +```cel +grpc.federation.strings.isGraphic('a') //=> true +grpc.federation.strings.isGraphic(' ') //=> false +``` + +## isPrint +Returns `true` if the provided rune is printable, meaning it is either a letter, number, punctuation, space, or symbol. + +### Parameters +`isPrint(r rune) bool` + +- `r`: the rune to check if it's printable. + +### Examples +```cel +grpc.federation.strings.isPrint('a') //=> true +grpc.federation.strings.isPrint('\n') //=> false +``` + +## itoa +Converts an integer to its string representation. + +### Parameters +`itoa(i int) string` + +- `i`: the integer to convert to a string. + +### Examples +```cel +grpc.federation.strings.itoa(123) //=> "123" +``` + +## parseBool +Parses a boolean value from its string representation. + +### Parameters +`parseBool(s string) bool` + +- `s`: the string to parse as a boolean. + +### Examples +```cel +grpc.federation.strings.parseBool("true") //=> true +grpc.federation.strings.parseBool("false") //=> false +``` + +## parseComplex +Parses a complex number from a string representation. + +### Parameters +`parseComplex(s string, bitSize int) complex128` + +- `s`: the string to parse as a complex number. +- `bitSize`: the bit size for the complex number (64 or 128). + +### Examples +```cel +grpc.federation.strings.parseComplex("(1.23+4.56i)", 128) //=> (1.23 + 4.56i) +``` + +## parseFloat +Parses a floating-point number from a string representation. + +### Parameters +`parseFloat(s string, bitSize int) float64` + +- `s`: the string to parse as a floating-point number. +- `bitSize`: the size of the float (32 for `float32`, 64 for `float64`). + +### Examples +```cel +grpc.federation.strings.parseFloat("1.23", 64) //=> 1.23 +``` + +## parseInt +Parses an integer from a string representation, supporting base conversions. + +### Parameters +`parseInt(s string, base int, bitSize int) int64` + +- `s`: the string to parse as an integer. +- `base`: the numeric base (e.g., 10 for decimal, 16 for hexadecimal). +- `bitSize`: the size of the integer. + +### Examples +```cel +grpc.federation.strings.parseInt("42", 10, 64) //=> 42 +grpc.federation.strings.parseInt("101010", 2, 8) //=> 42 +``` + +## parseUint +Parses an unsigned integer from a string representation, supporting base conversions. + +### Parameters +`parseUint(s string, base int, bitSize int) uint64` + +- `s`: the string to parse as an unsigned integer. +- `base`: the numeric base (e.g., 10 for decimal, 16 for hexadecimal). +- `bitSize`: the size of the unsigned integer. + +### Examples +```cel +grpc.federation.strings.parseUint("42", 10, 64) //=> 42 +grpc.federation.strings.parseUint("101010", 2, 8) //=> 42 +``` + +## quote +Returns a double-quoted string with any special characters escaped. + +### Parameters +`quote(s string) string` + +- `s`: the string to quote. + +### Examples +```cel +grpc.federation.strings.quote("hello") //=> "\"hello\"" +grpc.federation.strings.quote("tab\t") //=> "\"tab\\t\"" +``` + +## quoteRune +Returns a single-quoted string literal with the provided rune, escaping any special characters. + +### Parameters +`quoteRune(r rune) string` + +- `r`: the rune to quote. + +### Examples +```cel +grpc.federation.strings.quoteRune('a') //=> "'a'" +grpc.federation.strings.quoteRune('\n') //=> "'\\n'" +``` + +## quoteRuneToGraphic +Returns a graphic-quoted string literal for the provided rune. + +### Parameters +`quoteRuneToGraphic(r rune) string` + +- `r`: the rune to quote in a graphic string literal. + +### Examples +```cel +grpc.federation.strings.quoteRuneToGraphic('a') //=> "'a'" +grpc.federation.strings.quoteRuneToGraphic('\n') //=> "'\\n'" +``` + +## quoteToASCII +Returns a double-quoted string with any non-ASCII characters escaped. + +### Parameters +`quoteToASCII(s string) string` + +- `s`: the string to quote with ASCII escapes. + +### Examples +```cel +grpc.federation.strings.quoteToASCII("abc") //=> "\"abc\"" +grpc.federation.strings.quoteToASCII("こんにちは") //=> "\"\\u3053\\u3093\\u306b\\u3061\\u306f\"" +``` + +## quoteToGraphic +Returns a double-quoted string with non-printable characters quoted in their graphic representations. + +### Parameters +`quoteToGraphic(s string) string` + +- `s`: the string to quote with graphic character escapes. + +### Examples +```cel +grpc.federation.strings.quoteToGraphic("abc") //=> "\"abc\"" +grpc.federation.strings.quoteToGraphic("\u2028") //=> "\"\\u2028\"" +``` + +## quotedPrefix +Parses a quoted prefix from the input string. + +### Parameters +`quotedPrefix(s string) string` + +- `s`: the string containing the quoted prefix. + +### Examples +```cel +grpc.federation.strings.quotedPrefix("\"hello\" world") //=> "hello" +``` + +## unquote +Removes the surrounding quotes from a quoted string and unescapes any special characters. + +### Parameters +`unquote(s string) string` + +- `s`: the string to unquote. + +### Examples +```cel +grpc.federation.strings.unquote("\"hello\"") //=> "hello" +``` + +## unquoteChar +Decodes the next character or byte in the quoted string literal. + +### Parameters +`unquoteChar(s string, quote byte) rune` + +- `s`: the string containing the quoted character. +- `quote`: the quote character used (`'` or `"`). + +### Examples +```cel +grpc.federation.strings.unquoteChar("\\n", '"') //=> '\n' +``` diff --git a/grpc/federation/cel/strings.go b/grpc/federation/cel/strings.go index d072676c..8b7e1644 100644 --- a/grpc/federation/cel/strings.go +++ b/grpc/federation/cel/strings.go @@ -2,6 +2,7 @@ package cel import ( "context" + "strconv" "strings" "github.com/google/cel-go/cel" @@ -39,6 +40,7 @@ func (lib *StringsLibrary) CompileOptions() []cel.EnvOption { opts := []cel.EnvOption{} for _, funcOpts := range [][]cel.EnvOption{ + // strings package functions BindFunction( createStringsName("clone"), OverloadFunc(createStringsID("clone_string_string"), []*cel.Type{cel.StringType}, cel.StringType, @@ -394,6 +396,378 @@ func (lib *StringsLibrary) CompileOptions() []cel.EnvOption { }, ), ), + + // strconv package functions + BindFunction( + createStringsName("appendBool"), + OverloadFunc(createStringsID("appendBool_bytes_bool_bytes"), []*cel.Type{cel.BytesType, cel.BoolType}, cel.BytesType, + func(_ context.Context, args ...ref.Val) ref.Val { + return types.Bytes(strconv.AppendBool(args[0].(types.Bytes).Value().([]byte), args[1].(types.Bool).Value().(bool))) + }, + ), + OverloadFunc(createStringsID("appendBool_string_bool_string"), []*cel.Type{cel.StringType, cel.BoolType}, cel.StringType, + func(_ context.Context, args ...ref.Val) ref.Val { + return types.String(strconv.AppendBool([]byte(args[0].(types.String).Value().(string)), args[1].(types.Bool).Value().(bool))) + }, + ), + ), + BindFunction( + createStringsName("appendFloat"), + OverloadFunc(createStringsID("appendFloat_bytes_float64_string_int_int_bytes"), []*cel.Type{cel.BytesType, cel.DoubleType, cel.StringType, cel.IntType, cel.IntType}, cel.BytesType, + func(_ context.Context, args ...ref.Val) ref.Val { + return types.Bytes(strconv.AppendFloat(args[0].(types.Bytes).Value().([]byte), args[1].(types.Double).Value().(float64), args[2].(types.String).Value().(string)[0], int(args[3].(types.Int).Value().(int64)), int(args[4].(types.Int).Value().(int64)))) + }, + ), + OverloadFunc(createStringsID("appendFloat_string_float64_int_string_int_string"), []*cel.Type{cel.StringType, cel.DoubleType, cel.StringType, cel.IntType, cel.IntType}, cel.StringType, + func(_ context.Context, args ...ref.Val) ref.Val { + return types.String(strconv.AppendFloat([]byte(args[0].(types.String).Value().(string)), args[1].(types.Double).Value().(float64), args[2].(types.String).Value().(string)[0], int(args[3].(types.Int).Value().(int64)), int(args[4].(types.Int).Value().(int64)))) + }, + ), + ), + BindFunction( + createStringsName("appendInt"), + OverloadFunc(createStringsID("appendInt_bytes_int_int_bytes"), []*cel.Type{cel.BytesType, cel.IntType, cel.IntType}, cel.BytesType, + func(_ context.Context, args ...ref.Val) ref.Val { + return types.Bytes(strconv.AppendInt(args[0].(types.Bytes).Value().([]byte), args[1].(types.Int).Value().(int64), int(args[2].(types.Int).Value().(int64)))) + }, + ), + OverloadFunc(createStringsID("appendInt_string_int_int_string"), []*cel.Type{cel.StringType, cel.IntType, cel.IntType}, cel.StringType, + func(_ context.Context, args ...ref.Val) ref.Val { + return types.String(strconv.AppendInt([]byte(args[0].(types.String).Value().(string)), args[1].(types.Int).Value().(int64), int(args[2].(types.Int).Value().(int64)))) + }, + ), + ), + BindFunction( + createStringsName("appendQuote"), + OverloadFunc(createStringsID("appendQuote_bytes_string_bytes"), []*cel.Type{cel.BytesType, cel.StringType}, cel.BytesType, + func(_ context.Context, args ...ref.Val) ref.Val { + return types.Bytes(strconv.AppendQuote(args[0].(types.Bytes).Value().([]byte), args[1].(types.String).Value().(string))) + }, + ), + OverloadFunc(createStringsID("appendQuote_string_string_string"), []*cel.Type{cel.StringType, cel.StringType}, cel.StringType, + func(_ context.Context, args ...ref.Val) ref.Val { + return types.String(strconv.AppendQuote([]byte(args[0].(types.String).Value().(string)), args[1].(types.String).Value().(string))) + }, + ), + ), + BindFunction( + createStringsName("appendQuoteRune"), + OverloadFunc(createStringsID("appendQuoteRune_bytes_int_bytes"), []*cel.Type{cel.BytesType, cel.StringType}, cel.BytesType, + func(_ context.Context, args ...ref.Val) ref.Val { + return types.Bytes(strconv.AppendQuoteRune(args[0].(types.Bytes).Value().([]byte), rune(args[1].(types.String).Value().(string)[0]))) + }, + ), + OverloadFunc(createStringsID("appendQuoteRune_string_int_string"), []*cel.Type{cel.StringType, cel.StringType}, cel.StringType, + func(_ context.Context, args ...ref.Val) ref.Val { + return types.String(strconv.AppendQuoteRune([]byte(args[0].(types.String).Value().(string)), rune(args[1].(types.String).Value().(string)[0]))) + }, + ), + ), + BindFunction( + createStringsName("appendQuoteRuneToASCII"), + OverloadFunc(createStringsID("appendQuoteRuneToASCII_bytes_string_bytes"), []*cel.Type{cel.BytesType, cel.StringType}, cel.BytesType, + func(_ context.Context, args ...ref.Val) ref.Val { + return types.Bytes(strconv.AppendQuoteRuneToASCII(args[0].(types.Bytes).Value().([]byte), rune(args[1].(types.String).Value().(string)[0]))) + }, + ), + OverloadFunc(createStringsID("appendQuoteRuneToASCII_string_string_string"), []*cel.Type{cel.StringType, cel.StringType}, cel.StringType, + func(_ context.Context, args ...ref.Val) ref.Val { + return types.String(strconv.AppendQuoteRuneToASCII([]byte(args[0].(types.String).Value().(string)), rune(args[1].(types.String).Value().(string)[0]))) + }, + ), + ), + BindFunction( + createStringsName("appendQuoteRuneToGraphic"), + OverloadFunc(createStringsID("appendQuoteRuneToGraphic_bytes_string_bytes"), []*cel.Type{cel.BytesType, cel.StringType}, cel.BytesType, + func(_ context.Context, args ...ref.Val) ref.Val { + return types.Bytes(strconv.AppendQuoteRuneToGraphic(args[0].(types.Bytes).Value().([]byte), rune(args[1].(types.String).Value().(string)[0]))) + }, + ), + OverloadFunc(createStringsID("appendQuoteRuneToGraphic_string_string_string"), []*cel.Type{cel.StringType, cel.StringType}, cel.StringType, + func(_ context.Context, args ...ref.Val) ref.Val { + return types.String(strconv.AppendQuoteRuneToGraphic([]byte(args[0].(types.String).Value().(string)), rune(args[1].(types.String).Value().(string)[0]))) + }, + ), + ), + BindFunction( + createStringsName("appendQuoteToASCII"), + OverloadFunc(createStringsID("appendQuoteToASCII_bytes_string_bytes"), []*cel.Type{cel.BytesType, cel.StringType}, cel.BytesType, + func(_ context.Context, args ...ref.Val) ref.Val { + return types.Bytes(strconv.AppendQuoteToASCII(args[0].(types.Bytes).Value().([]byte), args[1].(types.String).Value().(string))) + }, + ), + OverloadFunc(createStringsID("appendQuoteToASCII_string_string_string"), []*cel.Type{cel.StringType, cel.StringType}, cel.StringType, + func(_ context.Context, args ...ref.Val) ref.Val { + return types.String(strconv.AppendQuoteToASCII([]byte(args[0].(types.String).Value().(string)), args[1].(types.String).Value().(string))) + }, + ), + ), + BindFunction( + createStringsName("appendQuoteToGraphic"), + OverloadFunc(createStringsID("appendQuoteToGraphic_bytes_string_bytes"), []*cel.Type{cel.BytesType, cel.StringType}, cel.BytesType, + func(_ context.Context, args ...ref.Val) ref.Val { + return types.Bytes(strconv.AppendQuoteToGraphic(args[0].(types.Bytes).Value().([]byte), args[1].(types.String).Value().(string))) + }, + ), + OverloadFunc(createStringsID("appendQuoteToGraphic_string_string_string"), []*cel.Type{cel.StringType, cel.StringType}, cel.StringType, + func(_ context.Context, args ...ref.Val) ref.Val { + return types.String(strconv.AppendQuoteToGraphic([]byte(args[0].(types.String).Value().(string)), args[1].(types.String).Value().(string))) + }, + ), + ), + BindFunction( + createStringsName("appendUint"), + OverloadFunc(createStringsID("appendUint_bytes_uint_int_bytes"), []*cel.Type{cel.BytesType, cel.UintType, cel.IntType}, cel.BytesType, + func(_ context.Context, args ...ref.Val) ref.Val { + return types.Bytes(strconv.AppendUint(args[0].(types.Bytes).Value().([]byte), args[1].(types.Uint).Value().(uint64), int(args[2].(types.Int).Value().(int64)))) + }, + ), + OverloadFunc(createStringsID("appendUint_string_uint_int_string"), []*cel.Type{cel.StringType, cel.UintType, cel.IntType}, cel.StringType, + func(_ context.Context, args ...ref.Val) ref.Val { + return types.String(strconv.AppendUint([]byte(args[0].(types.String).Value().(string)), args[1].(types.Uint).Value().(uint64), int(args[2].(types.Int).Value().(int64)))) + }, + ), + ), + BindFunction( + createStringsName("atoi"), + OverloadFunc(createStringsID("atoi_string_int"), []*cel.Type{cel.StringType}, cel.IntType, + func(_ context.Context, args ...ref.Val) ref.Val { + i, err := strconv.Atoi(args[0].(types.String).Value().(string)) + if err != nil { + return types.NewErr(err.Error()) + } + return types.Int(i) + }, + ), + ), + BindFunction( + createStringsName("canBackquote"), + OverloadFunc(createStringsID("canBackquote_string_bool"), []*cel.Type{cel.StringType}, cel.BoolType, + func(_ context.Context, args ...ref.Val) ref.Val { + return types.Bool(strconv.CanBackquote(args[0].(types.String).Value().(string))) + }, + ), + ), + BindFunction( + createStringsName("formatBool"), + OverloadFunc(createStringsID("formatBool_bool_string"), []*cel.Type{cel.BoolType}, cel.StringType, + func(_ context.Context, args ...ref.Val) ref.Val { + return types.String(strconv.FormatBool(args[0].(types.Bool).Value().(bool))) + }, + ), + ), + BindFunction( + createStringsName("formatComplex"), + OverloadFunc(createStringsID("formatComplex_complex128_string_int_int_string"), []*cel.Type{cel.ListType(cel.DoubleType), cel.StringType, cel.IntType, cel.IntType}, cel.StringType, + func(_ context.Context, args ...ref.Val) ref.Val { + cList := args[0].(traits.Lister) + c := complex(cList.Get(types.IntZero).(types.Double).Value().(float64), cList.Get(types.IntOne).(types.Double).Value().(float64)) + return types.String(strconv.FormatComplex(c, args[1].(types.String).Value().(string)[0], int(args[2].(types.Int).Value().(int64)), int(args[3].(types.Int).Value().(int64)))) + }, + ), + ), + BindFunction( + createStringsName("formatFloat"), + OverloadFunc(createStringsID("formatFloat_float64_string_int_int_string"), []*cel.Type{cel.DoubleType, cel.StringType, cel.IntType, cel.IntType}, cel.StringType, + func(_ context.Context, args ...ref.Val) ref.Val { + return types.String(strconv.FormatFloat(args[0].(types.Double).Value().(float64), args[1].(types.String).Value().(string)[0], int(args[2].(types.Int).Value().(int64)), int(args[3].(types.Int).Value().(int64)))) + }, + ), + ), + BindFunction( + createStringsName("formatInt"), + OverloadFunc(createStringsID("formatInt_int_int_string"), []*cel.Type{cel.IntType, cel.IntType}, cel.StringType, + func(_ context.Context, args ...ref.Val) ref.Val { + return types.String(strconv.FormatInt(args[0].(types.Int).Value().(int64), int(args[1].(types.Int).Value().(int64)))) + }, + ), + ), + BindFunction( + createStringsName("formatUint"), + OverloadFunc(createStringsID("formatUint_uint_int_string"), []*cel.Type{cel.UintType, cel.IntType}, cel.StringType, + func(_ context.Context, args ...ref.Val) ref.Val { + return types.String(strconv.FormatUint(args[0].(types.Uint).Value().(uint64), int(args[1].(types.Int).Value().(int64)))) + }, + ), + ), + BindFunction( + createStringsName("isGraphic"), + OverloadFunc(createStringsID("isGraphic_byte_bool"), []*cel.Type{cel.BytesType}, cel.BoolType, + func(_ context.Context, args ...ref.Val) ref.Val { + return types.Bool(strconv.IsGraphic(rune(args[0].(types.Bytes).Value().(byte)))) + }, + ), + OverloadFunc(createStringsID("isGraphic_string_bool"), []*cel.Type{cel.StringType}, cel.BoolType, + func(_ context.Context, args ...ref.Val) ref.Val { + return types.Bool(strconv.IsGraphic(rune(args[0].(types.String).Value().(string)[0]))) + }, + ), + ), + BindFunction( + createStringsName("isPrint"), + OverloadFunc(createStringsID("isPrint_byte_bool"), []*cel.Type{cel.BytesType}, cel.BoolType, + func(_ context.Context, args ...ref.Val) ref.Val { + return types.Bool(strconv.IsPrint(rune(args[0].(types.Bytes).Value().(byte)))) + }, + ), + OverloadFunc(createStringsID("isPrint_string_bool"), []*cel.Type{cel.StringType}, cel.BoolType, + func(_ context.Context, args ...ref.Val) ref.Val { + return types.Bool(strconv.IsPrint(rune(args[0].(types.String).Value().(string)[0]))) + }, + ), + ), + BindFunction( + createStringsName("itoa"), + OverloadFunc(createStringsID("itoa_int_string"), []*cel.Type{cel.IntType}, cel.StringType, + func(_ context.Context, args ...ref.Val) ref.Val { + return types.String(strconv.Itoa(int(args[0].(types.Int).Value().(int64)))) + }, + ), + ), + BindFunction( + createStringsName("parseBool"), + OverloadFunc(createStringsID("parseBool_string_bool"), []*cel.Type{cel.StringType}, cel.BoolType, + func(_ context.Context, args ...ref.Val) ref.Val { + b, err := strconv.ParseBool(args[0].(types.String).Value().(string)) + if err != nil { + return types.NewErr(err.Error()) + } + return types.Bool(b) + }, + ), + ), + BindFunction( + createStringsName("parseComplex"), + OverloadFunc(createStringsID("parseComplex_string_int_complex128"), []*cel.Type{cel.StringType, cel.IntType}, cel.ListType(cel.DoubleType), + func(_ context.Context, args ...ref.Val) ref.Val { + c, err := strconv.ParseComplex(args[0].(types.String).Value().(string), int(args[1].(types.Int).Value().(int64))) + if err != nil { + return types.NewErr(err.Error()) + } + return types.NewDynamicList(types.DefaultTypeAdapter, []ref.Val{types.Double(real(c)), types.Double(imag(c))}) + }, + ), + ), + BindFunction( + createStringsName("parseFloat"), + OverloadFunc(createStringsID("parseFloat_string_int_float64"), []*cel.Type{cel.StringType, cel.IntType}, cel.DoubleType, + func(_ context.Context, args ...ref.Val) ref.Val { + f, err := strconv.ParseFloat(args[0].(types.String).Value().(string), int(args[1].(types.Int).Value().(int64))) + if err != nil { + return types.NewErr(err.Error()) + } + return types.Double(f) + }, + ), + ), + BindFunction( + createStringsName("parseInt"), + OverloadFunc(createStringsID("parseInt_string_int_int_int"), []*cel.Type{cel.StringType, cel.IntType, cel.IntType}, cel.IntType, + func(_ context.Context, args ...ref.Val) ref.Val { + i, err := strconv.ParseInt(args[0].(types.String).Value().(string), int(args[1].(types.Int).Value().(int64)), int(args[2].(types.Int).Value().(int64))) + if err != nil { + return types.NewErr(err.Error()) + } + return types.Int(i) + }, + ), + ), + BindFunction( + createStringsName("parseUint"), + OverloadFunc(createStringsID("parseUint_string_int_int__uint"), []*cel.Type{cel.StringType, cel.IntType, cel.IntType}, cel.UintType, + func(_ context.Context, args ...ref.Val) ref.Val { + u, err := strconv.ParseUint(args[0].(types.String).Value().(string), int(args[1].(types.Int).Value().(int64)), int(args[2].(types.Int).Value().(int64))) + if err != nil { + return types.NewErr(err.Error()) + } + return types.Uint(u) + }, + ), + ), + BindFunction( + createStringsName("quote"), + OverloadFunc(createStringsID("quote_string_string"), []*cel.Type{cel.StringType}, cel.StringType, + func(_ context.Context, args ...ref.Val) ref.Val { + return types.String(strconv.Quote(args[0].(types.String).Value().(string))) + }, + ), + ), + BindFunction( + createStringsName("quoteRune"), + OverloadFunc(createStringsID("quoteRune_string_string"), []*cel.Type{cel.StringType}, cel.StringType, + func(_ context.Context, args ...ref.Val) ref.Val { + return types.String(strconv.QuoteRune(rune(args[0].(types.String).Value().(string)[0]))) + }, + ), + ), + BindFunction( + createStringsName("quoteRuneToASCII"), + OverloadFunc(createStringsID("quoteRuneToASCII_string_string"), []*cel.Type{cel.StringType}, cel.StringType, + func(_ context.Context, args ...ref.Val) ref.Val { + return types.String(strconv.QuoteRuneToASCII(rune(args[0].(types.String).Value().(string)[0]))) + }, + ), + ), + BindFunction( + createStringsName("quoteRuneToGraphic"), + OverloadFunc(createStringsID("quoteRuneToGraphic_string_string"), []*cel.Type{cel.StringType}, cel.StringType, + func(_ context.Context, args ...ref.Val) ref.Val { + return types.String(strconv.QuoteRuneToGraphic(rune(args[0].(types.String).Value().(string)[0]))) + }, + ), + ), + BindFunction( + createStringsName("quoteToASCII"), + OverloadFunc(createStringsID("quoteToASCII_string_string"), []*cel.Type{cel.StringType}, cel.StringType, + func(_ context.Context, args ...ref.Val) ref.Val { + return types.String(strconv.QuoteToASCII(args[0].(types.String).Value().(string))) + }, + ), + ), + BindFunction( + createStringsName("quoteToGraphic"), + OverloadFunc(createStringsID("quoteToGraphic_string_string"), []*cel.Type{cel.StringType}, cel.StringType, + func(_ context.Context, args ...ref.Val) ref.Val { + return types.String(strconv.QuoteToGraphic(args[0].(types.String).Value().(string))) + }, + ), + ), + BindFunction( + createStringsName("quotedPrefix"), + OverloadFunc(createStringsID("quotedPrefix_string_string"), []*cel.Type{cel.StringType}, cel.StringType, + func(_ context.Context, args ...ref.Val) ref.Val { + s, err := strconv.QuotedPrefix(args[0].(types.String).Value().(string)) + if err != nil { + return types.NewErr(err.Error()) + } + return types.String(s) + }, + ), + ), + BindFunction( + createStringsName("unquote"), + OverloadFunc(createStringsID("unquote_string_string"), []*cel.Type{cel.StringType}, cel.StringType, + func(_ context.Context, args ...ref.Val) ref.Val { + s, err := strconv.Unquote(args[0].(types.String).Value().(string)) + if err != nil { + return types.NewErr(err.Error()) + } + return types.String(s) + }, + ), + ), + BindFunction( + createStringsName("unquoteChar"), + OverloadFunc(createStringsID("unquoteChar_string_byte_string_bool_string"), []*cel.Type{cel.StringType, cel.StringType}, cel.ListType(cel.AnyType), + func(_ context.Context, args ...ref.Val) ref.Val { + s, b, t, err := strconv.UnquoteChar(args[0].(types.String).Value().(string), args[1].(types.String).Value().(string)[0]) + if err != nil { + return types.NewErr(err.Error()) + } + return types.NewDynamicList(types.DefaultTypeAdapter, []ref.Val{types.String(s), types.Bool(b), types.String(t)}) + }, + ), + ), } { opts = append(opts, funcOpts...) } diff --git a/grpc/federation/cel/strings_test.go b/grpc/federation/cel/strings_test.go index 32175413..2d4989d3 100644 --- a/grpc/federation/cel/strings_test.go +++ b/grpc/federation/cel/strings_test.go @@ -3,6 +3,7 @@ package cel_test import ( "context" "fmt" + "strconv" "strings" "testing" @@ -24,6 +25,7 @@ func TestStringsFunctions(t *testing.T) { args map[string]any cmp func(ref.Val) error }{ + // strings package { name: "clone", expr: "grpc.federation.strings.clone('abc')", @@ -637,6 +639,741 @@ func TestStringsFunctions(t *testing.T) { return nil }, }, + + // strconv package + { + name: "appendBool(bytes)", + expr: "grpc.federation.strings.appendBool(b\"abc\", true)", + cmp: func(got ref.Val) error { + _, ok := got.(types.Bytes) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + + expected := types.Bytes(strconv.AppendBool([]byte("abc"), true)) + if diff := cmp.Diff(got, expected); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "appendBool(string)", + expr: "grpc.federation.strings.appendBool('ab', true)", + cmp: func(got ref.Val) error { + gotV, ok := got.(types.String) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + expected := types.String(strconv.AppendBool([]byte("ab"), true)) + if diff := cmp.Diff(gotV, expected); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "appendFloat(bytes)", + expr: "grpc.federation.strings.appendFloat(b\"abc\", 1.23, 'f', 2, 64)", + cmp: func(got ref.Val) error { + _, ok := got.(types.Bytes) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + + expected := types.Bytes(strconv.AppendFloat([]byte("abc"), 1.23, 'f', 2, 64)) + if diff := cmp.Diff(got, expected); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "appendFloat(string)", + expr: "grpc.federation.strings.appendFloat('ab', 1.23, 'f', 2, 64)", + cmp: func(got ref.Val) error { + gotV, ok := got.(types.String) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + expected := types.String(strconv.AppendFloat([]byte("ab"), 1.23, 'f', 2, 64)) + if diff := cmp.Diff(gotV, expected); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "appendInt(bytes)", + expr: "grpc.federation.strings.appendInt(b\"abc\", 123, 10)", + cmp: func(got ref.Val) error { + _, ok := got.(types.Bytes) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + + expected := types.Bytes(strconv.AppendInt([]byte("abc"), 123, 10)) + if diff := cmp.Diff(got, expected); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "appendInt(string)", + expr: "grpc.federation.strings.appendInt('ab', 123, 10)", + cmp: func(got ref.Val) error { + gotV, ok := got.(types.String) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + expected := types.String(strconv.AppendInt([]byte("ab"), 123, 10)) + if diff := cmp.Diff(gotV, expected); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "appendQuote(bytes)", + expr: "grpc.federation.strings.appendQuote(b\"abc\", 'a')", + cmp: func(got ref.Val) error { + _, ok := got.(types.Bytes) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + + expected := types.Bytes(strconv.AppendQuote([]byte("abc"), "a")) + if diff := cmp.Diff(got, expected); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "appendQuote(string)", + expr: "grpc.federation.strings.appendQuote('ab', 'a')", + cmp: func(got ref.Val) error { + gotV, ok := got.(types.String) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + expected := types.String(strconv.AppendQuote([]byte("ab"), "a")) + if diff := cmp.Diff(gotV, expected); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "appendQuoteRune(bytes)", + expr: "grpc.federation.strings.appendQuoteRune(b\"abc\", 'a')", + cmp: func(got ref.Val) error { + _, ok := got.(types.Bytes) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + + expected := types.Bytes(strconv.AppendQuoteRune([]byte("abc"), 'a')) + if diff := cmp.Diff(got, expected); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "appendQuoteRune(string)", + expr: "grpc.federation.strings.appendQuoteRune('ab', 'a')", + cmp: func(got ref.Val) error { + gotV, ok := got.(types.String) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + expected := types.String(strconv.AppendQuoteRune([]byte("ab"), 'a')) + if diff := cmp.Diff(gotV, expected); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "appendQuoteRuneToASCII(bytes)", + expr: "grpc.federation.strings.appendQuoteRuneToASCII(b\"abc\", 'a')", + cmp: func(got ref.Val) error { + _, ok := got.(types.Bytes) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + + expected := types.Bytes(strconv.AppendQuoteRuneToASCII([]byte("abc"), 'a')) + if diff := cmp.Diff(got, expected); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "appendQuoteRuneToASCII(string)", + expr: "grpc.federation.strings.appendQuoteRuneToASCII('ab', 'a')", + cmp: func(got ref.Val) error { + gotV, ok := got.(types.String) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + expected := types.String(strconv.AppendQuoteRuneToASCII([]byte("ab"), 'a')) + if diff := cmp.Diff(gotV, expected); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "appendQuoteRuneToGraphic(bytes)", + expr: "grpc.federation.strings.appendQuoteRuneToGraphic(b\"abc\", 'a')", + cmp: func(got ref.Val) error { + _, ok := got.(types.Bytes) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + + expected := types.Bytes(strconv.AppendQuoteRuneToGraphic([]byte("abc"), 'a')) + if diff := cmp.Diff(got, expected); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "appendQuoteRuneToGraphic(string)", + expr: "grpc.federation.strings.appendQuoteRuneToGraphic('ab', 'a')", + cmp: func(got ref.Val) error { + gotV, ok := got.(types.String) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + expected := types.String(strconv.AppendQuoteRuneToGraphic([]byte("ab"), 'a')) + if diff := cmp.Diff(gotV, expected); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "appendQuoteToASCII(bytes)", + expr: "grpc.federation.strings.appendQuoteToASCII(b\"abc\", 'a')", + cmp: func(got ref.Val) error { + _, ok := got.(types.Bytes) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + + expected := types.Bytes(strconv.AppendQuoteToASCII([]byte("abc"), "a")) + if diff := cmp.Diff(got, expected); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "appendQuoteToASCII(string)", + expr: "grpc.federation.strings.appendQuoteToASCII('ab', 'a')", + cmp: func(got ref.Val) error { + gotV, ok := got.(types.String) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + expected := types.String(strconv.AppendQuoteToASCII([]byte("ab"), "a")) + if diff := cmp.Diff(gotV, expected); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "appendQuoteToGraphic(bytes)", + expr: "grpc.federation.strings.appendQuoteToGraphic(b\"abc\", 'a')", + cmp: func(got ref.Val) error { + _, ok := got.(types.Bytes) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + + expected := types.Bytes(strconv.AppendQuoteToGraphic([]byte("abc"), "a")) + if diff := cmp.Diff(got, expected); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "appendQuoteToGraphic(string)", + expr: "grpc.federation.strings.appendQuoteToGraphic('ab', 'a')", + cmp: func(got ref.Val) error { + gotV, ok := got.(types.String) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + expected := types.String(strconv.AppendQuoteToGraphic([]byte("ab"), "a")) + if diff := cmp.Diff(gotV, expected); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "appendUint(bytes)", + expr: "grpc.federation.strings.appendUint(b\"abc\", uint(123), 10)", + cmp: func(got ref.Val) error { + _, ok := got.(types.Bytes) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + + expected := types.Bytes(strconv.AppendUint([]byte("abc"), 123, 10)) + if diff := cmp.Diff(got, expected); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "appendUint(string)", + expr: "grpc.federation.strings.appendUint('ab', uint(123), 10)", + cmp: func(got ref.Val) error { + gotV, ok := got.(types.String) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + expected := types.String(strconv.AppendUint([]byte("ab"), 123, 10)) + if diff := cmp.Diff(gotV, expected); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "atoi", + expr: "grpc.federation.strings.atoi('123')", + cmp: func(got ref.Val) error { + gotV, ok := got.(types.Int) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + i, err := strconv.Atoi("123") + if err != nil { + return err + } + expected := types.Int(i) + if diff := cmp.Diff(gotV, expected); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "canBackquote", + expr: "grpc.federation.strings.canBackquote('abc')", + cmp: func(got ref.Val) error { + gotV, ok := got.(types.Bool) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + expected := types.Bool(strconv.CanBackquote("abc")) + if diff := cmp.Diff(gotV, expected); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "formatBool", + expr: "grpc.federation.strings.formatBool(true)", + cmp: func(got ref.Val) error { + gotV, ok := got.(types.String) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + expected := types.String(strconv.FormatBool(true)) + if diff := cmp.Diff(gotV, expected); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "formatComplex", + expr: "grpc.federation.strings.formatComplex([1.23, 4.56], 'f', 2, 64)", + cmp: func(got ref.Val) error { + gotV, ok := got.(types.String) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + + expected := types.String(strconv.FormatComplex(1.23+4.56i, 'f', 2, 64)) + if diff := cmp.Diff(gotV, expected); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "formatFloat", + expr: "grpc.federation.strings.formatFloat(1.23, 'f', 2, 64)", + cmp: func(got ref.Val) error { + gotV, ok := got.(types.String) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + + expected := types.String(strconv.FormatFloat(1.23, 'f', 2, 64)) + if diff := cmp.Diff(gotV, expected); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "formatInt", + expr: "grpc.federation.strings.formatInt(123, 10)", + cmp: func(got ref.Val) error { + gotV, ok := got.(types.String) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + + expected := types.String(strconv.FormatInt(123, 10)) + if diff := cmp.Diff(gotV, expected); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "formatUint", + expr: "grpc.federation.strings.formatUint(uint(123), 10)", + cmp: func(got ref.Val) error { + gotV, ok := got.(types.String) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + + expected := types.String(strconv.FormatUint(123, 10)) + if diff := cmp.Diff(gotV, expected); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "isGraphic", + expr: "grpc.federation.strings.isGraphic('a')", + cmp: func(got ref.Val) error { + gotV, ok := got.(types.Bool) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + + expected := types.Bool(strconv.IsGraphic('a')) + if diff := cmp.Diff(gotV, expected); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "isPrint", + expr: "grpc.federation.strings.isPrint('a')", + cmp: func(got ref.Val) error { + gotV, ok := got.(types.Bool) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + + expected := types.Bool(strconv.IsPrint('a')) + if diff := cmp.Diff(gotV, expected); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "itoa", + expr: "grpc.federation.strings.itoa(123)", + cmp: func(got ref.Val) error { + gotV, ok := got.(types.String) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + + expected := types.String(strconv.Itoa(123)) + if diff := cmp.Diff(gotV, expected); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "parseBool", + expr: "grpc.federation.strings.parseBool('true')", + cmp: func(got ref.Val) error { + gotV, ok := got.(types.Bool) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + + expected, err := strconv.ParseBool("true") + if err != nil { + return err + } + if diff := cmp.Diff(gotV, types.Bool(expected)); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "parseComplex", + expr: "grpc.federation.strings.parseComplex('1.23', 64)", + cmp: func(got ref.Val) error { + gotV, ok := got.(traits.Lister) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + + c, err := strconv.ParseComplex("1.23", 64) + if err != nil { + return err + } + re, im := real(c), imag(c) + expected := []ref.Val{types.Double(re), types.Double(im)} + if diff := cmp.Diff(gotV.Get(types.Int(0)), expected[0]); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + if diff := cmp.Diff(gotV.Get(types.Int(1)), expected[1]); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "parseFloat", + expr: "grpc.federation.strings.parseFloat('1.23', 64)", + cmp: func(got ref.Val) error { + gotV, ok := got.(types.Double) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + + expected, err := strconv.ParseFloat("1.23", 64) + if err != nil { + return err + } + if diff := cmp.Diff(gotV, types.Double(expected)); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "parseInt", + expr: "grpc.federation.strings.parseInt('123', 10, 64)", + cmp: func(got ref.Val) error { + gotV, ok := got.(types.Int) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + + expected, err := strconv.ParseInt("123", 10, 64) + if err != nil { + return err + } + if diff := cmp.Diff(gotV, types.Int(expected)); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "parseUint", + expr: "grpc.federation.strings.parseUint('123', 10, 64)", + cmp: func(got ref.Val) error { + gotV, ok := got.(types.Uint) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + + expected, err := strconv.ParseUint("123", 10, 64) + if err != nil { + return err + } + if diff := cmp.Diff(gotV, types.Uint(expected)); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "quote", + expr: "grpc.federation.strings.quote('abc')", + cmp: func(got ref.Val) error { + gotV, ok := got.(types.String) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + + expected := types.String(strconv.Quote("abc")) + if diff := cmp.Diff(gotV, expected); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "quoteRune", + expr: "grpc.federation.strings.quoteRune('a')", + cmp: func(got ref.Val) error { + gotV, ok := got.(types.String) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + + expected := types.String(strconv.QuoteRune('a')) + if diff := cmp.Diff(gotV, expected); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "quoteRuneToASCII", + expr: "grpc.federation.strings.quoteRuneToASCII('a')", + cmp: func(got ref.Val) error { + gotV, ok := got.(types.String) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + + expected := types.String(strconv.QuoteRuneToASCII('a')) + if diff := cmp.Diff(gotV, expected); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "quoteRuneToGraphic", + expr: "grpc.federation.strings.quoteRuneToGraphic('a')", + cmp: func(got ref.Val) error { + gotV, ok := got.(types.String) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + + expected := types.String(strconv.QuoteRuneToGraphic('a')) + if diff := cmp.Diff(gotV, expected); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "quoteToASCII", + expr: "grpc.federation.strings.quoteToASCII('abc')", + cmp: func(got ref.Val) error { + gotV, ok := got.(types.String) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + + expected := types.String(strconv.QuoteToASCII("abc")) + if diff := cmp.Diff(gotV, expected); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "quoteToGraphic", + expr: "grpc.federation.strings.quoteToGraphic('abc')", + cmp: func(got ref.Val) error { + gotV, ok := got.(types.String) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + + expected := types.String(strconv.QuoteToGraphic("abc")) + if diff := cmp.Diff(gotV, expected); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "quotedPrefix", + expr: "grpc.federation.strings.quotedPrefix('`or backquoted` with more trailing text')", + cmp: func(got ref.Val) error { + gotV, ok := got.(types.String) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + + expected, err := strconv.QuotedPrefix("`or backquoted` with more trailing text") + if err != nil { + return err + } + + if diff := cmp.Diff(gotV.Value(), expected); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "unquote", + expr: "grpc.federation.strings.unquote('\"abc\"')", + cmp: func(got ref.Val) error { + gotV, ok := got.(types.String) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + + expected, err := strconv.Unquote("\"abc\"") + if err != nil { + return err + } + if diff := cmp.Diff(gotV, types.String(expected)); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, + { + name: "unquoteChar", + expr: "grpc.federation.strings.unquoteChar('`a`', 'a')", + cmp: func(got ref.Val) error { + gotV, ok := got.(traits.Lister) + if !ok { + return fmt.Errorf("invalid result type: %T", got) + } + s := rune(gotV.Get(types.Int(0)).Value().(string)[0]) + b := gotV.Get(types.Int(1)).Value().(bool) + t2 := gotV.Get(types.Int(2)).Value().(string) + es, eb, et, err := strconv.UnquoteChar("`a`", 'a') + if err != nil { + return err + } + if diff := cmp.Diff(s, es); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + if diff := cmp.Diff(b, eb); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + if diff := cmp.Diff(t2, et); diff != "" { + return fmt.Errorf("(-got, +want)\n%s", diff) + } + return nil + }, + }, } for _, test := range tests {