众所周知的类型的可用性'在proto3协议缓冲区中

时间:2017-05-18 21:47:34

标签: protocol-buffers

我看到StringValue是字符串消息的消息包装器,我尝试在其中使用:

 > dput(D2[c(8,9,10)])
structure(list(flightStatuses = structure(list(flightId = 890465980L, 
    carrierFsCode = "6L", flightNumber = "406", departureAirportFsCode = "YUB", 
    arrivalAirportFsCode = "YEV", departureDate = structure(list(
        dateLocal = "2017-05-12T18:00:00.000", dateUtc = "2017-05-13T00:00:00.000Z"), .Names = c("dateLocal", 
    "dateUtc"), class = "data.frame", row.names = 1L), arrivalDate = structure(list(
        dateLocal = "2017-05-12T18:30:00.000", dateUtc = "2017-05-13T00:30:00.000Z"), .Names = c("dateLocal", 
    "dateUtc"), class = "data.frame", row.names = 1L), status = "U", 
    schedule = structure(list(flightType = "J", serviceClasses = "Y", 
        restrictions = ""), .Names = c("flightType", "serviceClasses", 
    "restrictions"), class = "data.frame", row.names = 1L), operationalTimes = structure(list(
        publishedDeparture = structure(list(dateLocal = "2017-05-12T18:00:00.000", 
            dateUtc = "2017-05-13T00:00:00.000Z"), .Names = c("dateLocal", 
        "dateUtc"), class = "data.frame", row.names = 1L), publishedArrival = structure(list(
            dateLocal = "2017-05-12T18:30:00.000", dateUtc = "2017-05-13T00:30:00.000Z"), .Names = c("dateLocal", 
        "dateUtc"), class = "data.frame", row.names = 1L), scheduledGateDeparture = structure(list(
            dateLocal = "2017-05-12T18:00:00.000", dateUtc = "2017-05-13T00:00:00.000Z"), .Names = c("dateLocal", 
        "dateUtc"), class = "data.frame", row.names = 1L), flightPlanPlannedDeparture = structure(list(
            dateLocal = "2017-05-12T18:16:00.000", dateUtc = "2017-05-13T00:16:00.000Z"), .Names = c("dateLocal", 
        "dateUtc"), class = "data.frame", row.names = 1L), scheduledGateArrival = structure(list(
            dateLocal = "2017-05-12T18:30:00.000", dateUtc = "2017-05-13T00:30:00.000Z"), .Names = c("dateLocal", 
        "dateUtc"), class = "data.frame", row.names = 1L), flightPlanPlannedArrival = structure(list(
            dateLocal = "2017-05-12T18:42:00.000", dateUtc = "2017-05-13T00:42:00.000Z"), .Names = c("dateLocal", 
        "dateUtc"), class = "data.frame", row.names = 1L)), .Names = c("publishedDeparture", 
    "publishedArrival", "scheduledGateDeparture", "flightPlanPlannedDeparture", 
    "scheduledGateArrival", "flightPlanPlannedArrival"), class = "data.frame", row.names = 1L), 
    flightDurations = structure(list(scheduledBlockMinutes = 30L, 
        scheduledAirMinutes = 26L, scheduledTaxiOutMinutes = 16L), .Names = c("scheduledBlockMinutes", 
    "scheduledAirMinutes", "scheduledTaxiOutMinutes"), class = "data.frame", row.names = 1L), 
    flightEquipment = structure(list(scheduledEquipmentIataCode = "DHT", 
        actualEquipmentIataCode = "DHT"), .Names = c("scheduledEquipmentIataCode", 
    "actualEquipmentIataCode"), class = "data.frame", row.names = 1L)), .Names = c("flightId", 
"carrierFsCode", "flightNumber", "departureAirportFsCode", "arrivalAirportFsCode", 
"departureDate", "arrivalDate", "status", "schedule", "operationalTimes", 
"flightDurations", "flightEquipment"), class = "data.frame", row.names = 1L), 
    flightStatuses = list(), flightStatuses = structure(list(
        flightId = c(892402226L, 891883063L), carrierFsCode = c("4K", 
        "6L"), flightNumber = c("201", "402"), departureAirportFsCode = c("YUB", 
        "YUB"), arrivalAirportFsCode = c("YEV", "YEV"), departureDate = structure(list(
            dateLocal = c("2017-05-13T09:30:00.000", "2017-05-13T10:30:00.000"
            ), dateUtc = c("2017-05-13T15:30:00.000Z", "2017-05-13T16:30:00.000Z"
            )), .Names = c("dateLocal", "dateUtc"), class = "data.frame", row.names = 1:2), 
        arrivalDate = structure(list(dateLocal = c("2017-05-13T11:42:00.000", 
        "2017-05-13T11:10:00.000"), dateUtc = c("2017-05-13T17:42:00.000Z", 
        "2017-05-13T17:10:00.000Z")), .Names = c("dateLocal", 
        "dateUtc"), class = "data.frame", row.names = 1:2), status = c("U", 
        "U"), operationalTimes = structure(list(scheduledGateDeparture = structure(list(
            dateLocal = c("2017-05-13T09:30:00.000", "2017-05-13T10:30:00.000"
            ), dateUtc = c("2017-05-13T15:30:00.000Z", "2017-05-13T16:30:00.000Z"
            )), .Names = c("dateLocal", "dateUtc"), class = "data.frame", row.names = 1:2), 
            estimatedRunwayDeparture = structure(list(dateLocal = c("2017-05-13T11:19:00.000", 
            NA), dateUtc = c("2017-05-13T17:19:00.000Z", NA)), .Names = c("dateLocal", 
            "dateUtc"), class = "data.frame", row.names = 1:2), 
            actualRunwayDeparture = structure(list(dateLocal = c("2017-05-13T11:19:00.000", 
            NA), dateUtc = c("2017-05-13T17:19:00.000Z", NA)), .Names = c("dateLocal", 
            "dateUtc"), class = "data.frame", row.names = 1:2), 
            estimatedRunwayArrival = structure(list(dateLocal = c("2017-05-13T11:42:00.000", 
            NA), dateUtc = c("2017-05-13T17:42:00.000Z", NA)), .Names = c("dateLocal", 
            "dateUtc"), class = "data.frame", row.names = 1:2), 
            flightPlanPlannedDeparture = structure(list(dateLocal = c(NA, 
            "2017-05-13T10:45:00.000"), dateUtc = c(NA, "2017-05-13T16:45:00.000Z"
            )), .Names = c("dateLocal", "dateUtc"), class = "data.frame", row.names = 1:2), 
            flightPlanPlannedArrival = structure(list(dateLocal = c(NA, 
            "2017-05-13T11:10:00.000"), dateUtc = c(NA, "2017-05-13T17:10:00.000Z"
            )), .Names = c("dateLocal", "dateUtc"), class = "data.frame", row.names = 1:2)), .Names = c("scheduledGateDeparture", 
        "estimatedRunwayDeparture", "actualRunwayDeparture", 
        "estimatedRunwayArrival", "flightPlanPlannedDeparture", 
        "flightPlanPlannedArrival"), class = "data.frame", row.names = 1:2), 
        flightEquipment = structure(list(actualEquipmentIataCode = c("BE2", 
        "DHT")), .Names = "actualEquipmentIataCode", class = "data.frame", row.names = 1:2), 
        flightDurations = structure(list(scheduledAirMinutes = c(NA, 
        25L), scheduledTaxiOutMinutes = c(NA, 15L)), .Names = c("scheduledAirMinutes", 
        "scheduledTaxiOutMinutes"), class = "data.frame", row.names = 1:2)), .Names = c("flightId", 
    "carrierFsCode", "flightNumber", "departureAirportFsCode", 
    "arrivalAirportFsCode", "departureDate", "arrivalDate", "status", 
    "operationalTimes", "flightEquipment", "flightDurations"), class = "data.frame", row.names = 1:2)), .Names = c("flightStatuses", 
"flightStatuses", "flightStatuses"))

但是,我收到来自protoc的消息:

  

somefile.proto:30:14:" StringValue"没有定义。

我使用的是proto3语法。我错过了什么?

1 个答案:

答案 0 :(得分:2)

行。

我需要:import "google/protobuf/wrappers.proto";

并使用完全限定的google.protobuf.StringValue