Class: Readyset::Explain
- Inherits:
-
Object
- Object
- Readyset::Explain
- Defined in:
- lib/readyset/explain.rb
Overview
Represents the result of an ‘EXPLAIN CREATE CACHE` invocation on ReadySet.
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#supported ⇒ Object
readonly
Returns the value of attribute supported.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Class Method Summary collapse
-
.call(query) ⇒ Explain
Gets information about the given query from ReadySet, including whether it’s supported to be cached, its current status, the rewritten query text, and the query ID.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
Compares ‘self` with another `Explain` by comparing them attribute-wise.
-
#initialize(id:, text:, supported:) ⇒ Explain
constructor
Creates a new ‘Explain` with the given attributes.
-
#unsupported? ⇒ Boolean
Returns true if the explain information returned by ReadySet indicates that the query is unsupported.
Constructor Details
#initialize(id:, text:, supported:) ⇒ Explain
Creates a new ‘Explain` with the given attributes.
25 26 27 28 29 |
# File 'lib/readyset/explain.rb', line 25 def initialize(id:, text:, supported:) # :nodoc: @id = id @text = text @supported = supported end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/readyset/explain.rb', line 4 def id @id end |
#supported ⇒ Object (readonly)
Returns the value of attribute supported.
4 5 6 |
# File 'lib/readyset/explain.rb', line 4 def supported @supported end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
4 5 6 |
# File 'lib/readyset/explain.rb', line 4 def text @text end |
Class Method Details
.call(query) ⇒ Explain
Gets information about the given query from ReadySet, including whether it’s supported to be cached, its current status, the rewritten query text, and the query ID.
The information about the given query is retrieved by invoking ‘EXPLAIN CREATE CACHE FROM` on ReadySet.
14 15 16 17 |
# File 'lib/readyset/explain.rb', line 14 def self.call(query) raw_results = Readyset.raw_query("EXPLAIN CREATE CACHE FROM #{query}") from_readyset_results(**raw_results.first.to_h.symbolize_keys) end |
Instance Method Details
#==(other) ⇒ Boolean
Compares ‘self` with another `Explain` by comparing them attribute-wise.
35 36 37 38 39 |
# File 'lib/readyset/explain.rb', line 35 def ==(other) id == other.id && text == other.text && supported == other.supported end |
#unsupported? ⇒ Boolean
Returns true if the explain information returned by ReadySet indicates that the query is unsupported.
45 46 47 |
# File 'lib/readyset/explain.rb', line 45 def unsupported? supported == :unsupported end |