Class: Hecks::Bluebook::Query
- Inherits:
-
QuerySpecification::Common::Options
- Object
- QuerySpecification::Common::Options
- Hecks::Bluebook::Query
- Includes:
- Behaviour::Query, Construct, IR
- Defined in:
- lib/hecks/bluebook/query.rb
Overview
A query — an ASK, declared on an aggregate or on one of its entities.
It crosses over as an INSTANCE rather than a class, and the reason is worth
stating because it is the boundary of the pattern. A query inherits its
whole body from QuerySpecification::Common::Options — wheres,
order_by, limit, offset, cursor,
authorization, null_semantics, inspection — and those
are INSTANCE methods that the runtime and the SQLite adapter both read.
Hoisting the declaration onto a metaclass would put the identity and the
specification on opposite sides of the object.
And nothing is lost, because Class#name was the only reason a construct
ever needed a second word for its own name. An instance answers name
truthfully. So a query gains an owner and an identity — which is what the
graph is for — and keeps the name it always had.
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Attributes included from Construct
#hecks_name, #hecks_owner, #hecks_root
Attributes inherited from QuerySpecification::Common::Options
#authorization, #cursor, #inspection, #limit, #null_semantics, #offset, #order_by, #wheres
Instance Method Summary collapse
-
#initialize(name:, description: nil, attributes: [], wheres: [], order_by: nil, limit: nil, offset: nil, cursor: nil, authorization: nil, null_semantics: nil, inspection: nil) ⇒ Query
constructor
A new instance of Query.
-
#to_h ⇒ Object
A query's shape is NOT fixed —
extra_options_to_hcarries whatever options the specification layer grew (count, median, group_by, scope_to).
Methods included from Behaviour::Query
Methods included from IR
Methods included from Construct
#hecks_fqn, #hecks_root?, #hecks_separator
Methods inherited from QuerySpecification::Common::Options
#extra_options_to_h, #options_to_h
Constructor Details
#initialize(name:, description: nil, attributes: [], wheres: [], order_by: nil, limit: nil, offset: nil, cursor: nil, authorization: nil, null_semantics: nil, inspection: nil) ⇒ Query
Returns a new instance of Query.
39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/hecks/bluebook/query.rb', line 39 def initialize(name:, description: nil, attributes: [], wheres: [], order_by: nil, limit: nil, offset: nil, cursor: nil, authorization: nil, null_semantics: nil, inspection: nil) null_semantics ||= QuerySpecification::Common::NullSemantics.default super(wheres: wheres, order_by: order_by, limit: limit, offset: offset, cursor: cursor, authorization: , null_semantics: null_semantics, inspection: inspection) @name = name.to_s @hecks_name = @name @description = description @attributes = attributes end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
37 38 39 |
# File 'lib/hecks/bluebook/query.rb', line 37 def attributes @attributes end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
37 38 39 |
# File 'lib/hecks/bluebook/query.rb', line 37 def description @description end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
37 38 39 |
# File 'lib/hecks/bluebook/query.rb', line 37 def name @name end |
Instance Method Details
#to_h ⇒ Object
A query's shape is NOT fixed — extra_options_to_h carries
whatever options the specification layer grew (count, median,
group_by, scope_to). Declared emission covers the settled part
and super hands it over; the tail stays dynamic, which is the
honest description of it.
58 |
# File 'lib/hecks/bluebook/query.rb', line 58 def to_h = super.merge() |