com.google.cloud.Timestamp.toProto()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(3.1k)|赞(0)|评价(0)|浏览(124)

本文整理了Java中com.google.cloud.Timestamp.toProto()方法的一些代码示例,展示了Timestamp.toProto()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Timestamp.toProto()方法的具体详情如下:
包路径:com.google.cloud.Timestamp
类名称:Timestamp
方法名:toProto

Timestamp.toProto介绍

[英]Returns a com.google.protobuf.Timestamp initialized to the same point in time as this.
[中]返回一个com。谷歌。protobuf。时间戳初始化为与此相同的时间点。

代码示例

代码示例来源:origin: googleapis/google-cloud-java

@Override
 protected void setValue(TimestampValue from, com.google.datastore.v1.Value.Builder to) {
  to.setTimestampValue(from.get().toProto());
 }
};

代码示例来源:origin: googleapis/google-cloud-java

TransactionOptions.ReadOnly.Builder applyToBuilder(TransactionOptions.ReadOnly.Builder builder) {
 switch (mode) {
  case STRONG:
   return builder.setStrong(true);
  case READ_TIMESTAMP:
   return builder.setReadTimestamp(timestamp.toProto());
  case MIN_READ_TIMESTAMP:
   return builder.setMinReadTimestamp(timestamp.toProto());
  case EXACT_STALENESS:
   return builder.setExactStaleness(staleness);
  case MAX_STALENESS:
   return builder.setMaxStaleness(staleness);
  default:
   throw new AssertionError("Unexpected mode: " + mode);
 }
}

代码示例来源:origin: googleapis/google-cloud-java

com.google.firestore.v1beta1.Precondition toPb() {
 com.google.firestore.v1beta1.Precondition.Builder precondition =
   com.google.firestore.v1beta1.Precondition.newBuilder();
 if (exists != null) {
  precondition.setExists(exists);
 }
 if (updateTime != null) {
  precondition.setUpdateTime(updateTime.toProto());
 }
 return precondition.build();
}

代码示例来源:origin: googleapis/google-cloud-java

} else if (sanitizedObject instanceof Timestamp) {
 Timestamp timestamp = (Timestamp) sanitizedObject;
 return Value.newBuilder().setTimestampValue(timestamp.toProto()).build();
} else if (sanitizedObject instanceof List) {
 ArrayValue.Builder res = ArrayValue.newBuilder();

代码示例来源:origin: com.google.cloud/google-cloud-datastore

@Override
 protected void setValue(TimestampValue from, com.google.datastore.v1.Value.Builder to) {
  to.setTimestampValue(from.get().toProto());
 }
};

代码示例来源:origin: com.google.cloud/google-cloud-spanner

TransactionOptions.ReadOnly.Builder applyToBuilder(TransactionOptions.ReadOnly.Builder builder) {
 switch (mode) {
  case STRONG:
   return builder.setStrong(true);
  case READ_TIMESTAMP:
   return builder.setReadTimestamp(timestamp.toProto());
  case MIN_READ_TIMESTAMP:
   return builder.setMinReadTimestamp(timestamp.toProto());
  case EXACT_STALENESS:
   return builder.setExactStaleness(staleness);
  case MAX_STALENESS:
   return builder.setMaxStaleness(staleness);
  default:
   throw new AssertionError("Unexpected mode: " + mode);
 }
}

代码示例来源:origin: com.google.cloud/google-cloud-firestore

com.google.firestore.v1beta1.Precondition toPb() {
 com.google.firestore.v1beta1.Precondition.Builder precondition =
   com.google.firestore.v1beta1.Precondition.newBuilder();
 if (exists != null) {
  precondition.setExists(exists);
 }
 if (updateTime != null) {
  precondition.setUpdateTime(updateTime.toProto());
 }
 return precondition.build();
}

代码示例来源:origin: com.google.cloud/google-cloud-firestore

} else if (sanitizedObject instanceof Timestamp) {
 Timestamp timestamp = (Timestamp) sanitizedObject;
 return Value.newBuilder().setTimestampValue(timestamp.toProto()).build();
} else if (sanitizedObject instanceof List) {
 ArrayValue.Builder res = ArrayValue.newBuilder();

相关文章