Class: Google::Apis::DatastoreV1::Value

Inherits:
Object
  • Object
show all
Includes:
Core::Hashable, Core::JsonObjectSupport
Defined in:
generated/google/apis/datastore_v1/classes.rb,
generated/google/apis/datastore_v1/representations.rb,
generated/google/apis/datastore_v1/representations.rb

Overview

A message that can hold any of the supported value types and associated metadata.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Core::JsonObjectSupport

#to_json

Methods included from Core::Hashable

process_value, #to_h

Constructor Details

#initialize(**args) ⇒ Value

Returns a new instance of Value



535
536
537
# File 'generated/google/apis/datastore_v1/classes.rb', line 535

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#array_valueGoogle::Apis::DatastoreV1::ArrayValue

An array value. Corresponds to the JSON property arrayValue



458
459
460
# File 'generated/google/apis/datastore_v1/classes.rb', line 458

def array_value
  @array_value
end

#blob_valueString

A blob value. May have at most 1,000,000 bytes. When exclude_from_indexes is false, may have at most 1500 bytes. In JSON requests, must be base64-encoded. Corresponds to the JSON property blobValue NOTE: Values are automatically base64 encoded/decoded in the client library.

Returns:

  • (String)


448
449
450
# File 'generated/google/apis/datastore_v1/classes.rb', line 448

def blob_value
  @blob_value
end

#boolean_valueBoolean Also known as: boolean_value?

A boolean value. Corresponds to the JSON property booleanValue

Returns:

  • (Boolean)


438
439
440
# File 'generated/google/apis/datastore_v1/classes.rb', line 438

def boolean_value
  @boolean_value
end

#double_valueFloat

A double value. Corresponds to the JSON property doubleValue

Returns:

  • (Float)


421
422
423
# File 'generated/google/apis/datastore_v1/classes.rb', line 421

def double_value
  @double_value
end

#entity_valueGoogle::Apis::DatastoreV1::Entity

A Datastore data object. An entity is limited to 1 megabyte when stored. That roughly corresponds to a limit of 1 megabyte for the serialized form of this message. Corresponds to the JSON property entityValue



466
467
468
# File 'generated/google/apis/datastore_v1/classes.rb', line 466

def entity_value
  @entity_value
end

#exclude_from_indexesBoolean Also known as: exclude_from_indexes?

If the value should be excluded from all indexes including those defined explicitly. Corresponds to the JSON property excludeFromIndexes

Returns:

  • (Boolean)


532
533
534
# File 'generated/google/apis/datastore_v1/classes.rb', line 532

def exclude_from_indexes
  @exclude_from_indexes
end

#geo_point_valueGoogle::Apis::DatastoreV1::LatLng

An object representing a latitude/longitude pair. This is expressed as a pair of doubles representing degrees latitude and degrees longitude. Unless specified otherwise, this must conform to the WGS84 standard. Values must be within normalized ranges. Example of normalization code in Python: def NormalizeLongitude(longitude): """Wraps decimal degrees longitude to [-180.0, 180.0].""" q, r = divmod(longitude, 360.0) if r > 180.0 or (r == 180.0 and q <= -1.0): return r - 360.0 return r def NormalizeLatLng(latitude, longitude): """Wraps decimal degrees latitude and longitude to [-90.0, 90.0] and [-180.0, 180.0], respectively.""" r = latitude % 360.0 if r <= 90.0: return r, NormalizeLongitude(longitude) elif r >= 270.0: return r - 360, NormalizeLongitude(longitude) else: return 180 - r, NormalizeLongitude(longitude + 180.0) assert 180.0 == NormalizeLongitude(180.0) assert -180.0 == NormalizeLongitude(-180.0) assert -179.0 == NormalizeLongitude(181.0) assert (0.0, 0.0) == NormalizeLatLng(360.0, 0.0) assert (0.0, 0.0) == NormalizeLatLng(-360.0, 0.0) assert (85.0, 180.0) == NormalizeLatLng(95.0, 0.0) assert (-85.0, -170.0) == NormalizeLatLng(-95.0, 10.0) assert (90.0, 10.0) == NormalizeLatLng(90.0, 10.0) assert (-90.0, -10.0) == NormalizeLatLng(-90.0, -10.0) assert (0.0, -170.0) == NormalizeLatLng(-180.0, 10.0) assert (0.0, -170.0) == NormalizeLatLng(180.0, 10.0) assert (-90.0, 10.0) == NormalizeLatLng(270.0, 10.0) assert (90.0, 10.0) == NormalizeLatLng(-270.0, 10.0) Corresponds to the JSON property geoPointValue



505
506
507
# File 'generated/google/apis/datastore_v1/classes.rb', line 505

def geo_point_value
  @geo_point_value
end

#integer_valueFixnum

An integer value. Corresponds to the JSON property integerValue

Returns:

  • (Fixnum)


518
519
520
# File 'generated/google/apis/datastore_v1/classes.rb', line 518

def integer_value
  @integer_value
end

#key_valueGoogle::Apis::DatastoreV1::Key

A unique identifier for an entity. If a key's partition ID or any of its path kinds or names are reserved/read-only, the key is reserved/read-only. A reserved/read-only key is forbidden in certain documented contexts. Corresponds to the JSON property keyValue



513
514
515
# File 'generated/google/apis/datastore_v1/classes.rb', line 513

def key_value
  @key_value
end

#meaningFixnum

The meaning field should only be populated for backwards compatibility. Corresponds to the JSON property meaning

Returns:

  • (Fixnum)


453
454
455
# File 'generated/google/apis/datastore_v1/classes.rb', line 453

def meaning
  @meaning
end

#null_valueString

A null value. Corresponds to the JSON property nullValue

Returns:

  • (String)


433
434
435
# File 'generated/google/apis/datastore_v1/classes.rb', line 433

def null_value
  @null_value
end

#string_valueString

A UTF-8 encoded string value. When exclude_from_indexes is false (it is indexed) , may have at most 1500 bytes. Otherwise, may be set to at least 1,000,000 bytes. Corresponds to the JSON property stringValue

Returns:

  • (String)


526
527
528
# File 'generated/google/apis/datastore_v1/classes.rb', line 526

def string_value
  @string_value
end

#timestamp_valueString

A timestamp value. When stored in the Datastore, precise only to microseconds; any additional precision is rounded down. Corresponds to the JSON property timestampValue

Returns:

  • (String)


428
429
430
# File 'generated/google/apis/datastore_v1/classes.rb', line 428

def timestamp_value
  @timestamp_value
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
# File 'generated/google/apis/datastore_v1/classes.rb', line 540

def update!(**args)
  @double_value = args[:double_value] if args.key?(:double_value)
  @timestamp_value = args[:timestamp_value] if args.key?(:timestamp_value)
  @null_value = args[:null_value] if args.key?(:null_value)
  @boolean_value = args[:boolean_value] if args.key?(:boolean_value)
  @blob_value = args[:blob_value] if args.key?(:blob_value)
  @meaning = args[:meaning] if args.key?(:meaning)
  @array_value = args[:array_value] if args.key?(:array_value)
  @entity_value = args[:entity_value] if args.key?(:entity_value)
  @geo_point_value = args[:geo_point_value] if args.key?(:geo_point_value)
  @key_value = args[:key_value] if args.key?(:key_value)
  @integer_value = args[:integer_value] if args.key?(:integer_value)
  @string_value = args[:string_value] if args.key?(:string_value)
  @exclude_from_indexes = args[:exclude_from_indexes] if args.key?(:exclude_from_indexes)
end