Class: E3DB::Record

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/e3db/client.rb

Overview

A E3DB record containing data and metadata. Records are a key/value mapping containing data serialized into strings. All records are encrypted prior to sending them to the server for storage, and decrypted in the client after they are read.

New records are written to the database by calling the Client#write method.

To read a record by their unique ID, use Client#read, or to query a set of records based on their attributes, use Client#query.

Instance Attribute Summary collapse

Instance Attribute Details

#dataHash<String, String>

Returns this record's application-specific data.

Returns:

  • (Hash<String, String>)

    this record's application-specific data



148
149
150
151
152
153
154
155
156
# File 'lib/e3db/client.rb', line 148

class Record < Dry::Struct
  attribute :meta, Meta
  attribute :data, Types::Strict::Hash.default { Hash.new }

  # Allow updating metadata, used on destructive update.
  def meta=(meta)
    @meta = meta
  end
end

#metaMeta

Returns meta-information about this record.

Returns:

  • (Meta)

    meta-information about this record



148
149
150
151
152
153
154
155
156
# File 'lib/e3db/client.rb', line 148

class Record < Dry::Struct
  attribute :meta, Meta
  attribute :data, Types::Strict::Hash.default { Hash.new }

  # Allow updating metadata, used on destructive update.
  def meta=(meta)
    @meta = meta
  end
end