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

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

本文整理了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

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

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

  1. TransactionOptions.ReadOnly.Builder applyToBuilder(TransactionOptions.ReadOnly.Builder builder) {
  2. switch (mode) {
  3. case STRONG:
  4. return builder.setStrong(true);
  5. case READ_TIMESTAMP:
  6. return builder.setReadTimestamp(timestamp.toProto());
  7. case MIN_READ_TIMESTAMP:
  8. return builder.setMinReadTimestamp(timestamp.toProto());
  9. case EXACT_STALENESS:
  10. return builder.setExactStaleness(staleness);
  11. case MAX_STALENESS:
  12. return builder.setMaxStaleness(staleness);
  13. default:
  14. throw new AssertionError("Unexpected mode: " + mode);
  15. }
  16. }

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

  1. com.google.firestore.v1beta1.Precondition toPb() {
  2. com.google.firestore.v1beta1.Precondition.Builder precondition =
  3. com.google.firestore.v1beta1.Precondition.newBuilder();
  4. if (exists != null) {
  5. precondition.setExists(exists);
  6. }
  7. if (updateTime != null) {
  8. precondition.setUpdateTime(updateTime.toProto());
  9. }
  10. return precondition.build();
  11. }

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

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

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

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

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

  1. TransactionOptions.ReadOnly.Builder applyToBuilder(TransactionOptions.ReadOnly.Builder builder) {
  2. switch (mode) {
  3. case STRONG:
  4. return builder.setStrong(true);
  5. case READ_TIMESTAMP:
  6. return builder.setReadTimestamp(timestamp.toProto());
  7. case MIN_READ_TIMESTAMP:
  8. return builder.setMinReadTimestamp(timestamp.toProto());
  9. case EXACT_STALENESS:
  10. return builder.setExactStaleness(staleness);
  11. case MAX_STALENESS:
  12. return builder.setMaxStaleness(staleness);
  13. default:
  14. throw new AssertionError("Unexpected mode: " + mode);
  15. }
  16. }

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

  1. com.google.firestore.v1beta1.Precondition toPb() {
  2. com.google.firestore.v1beta1.Precondition.Builder precondition =
  3. com.google.firestore.v1beta1.Precondition.newBuilder();
  4. if (exists != null) {
  5. precondition.setExists(exists);
  6. }
  7. if (updateTime != null) {
  8. precondition.setUpdateTime(updateTime.toProto());
  9. }
  10. return precondition.build();
  11. }

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

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

相关文章