Module: Hecks::QuerySpecification::Common::DSL

Included in:
Bluebook::DSL::QueryBuilder, Bluebook::DSL::ReadModelBuilder
Defined in:
lib/hecks/query_specification/common/dsl.rb

Instance Method Summary collapse

Instance Method Details

#authorize_impl(policy, tenant: nil) ⇒ Object



39
# File 'lib/hecks/query_specification/common/dsl.rb', line 39

def authorize_impl(policy, tenant: nil) = @authorization = AuthorizationSpec.new(policy: policy, tenant: tenant)

#cursor(value) ⇒ Object



38
# File 'lib/hecks/query_specification/common/dsl.rb', line 38

def cursor(value) = @cursor = CursorSpec.new(value: value)

#inspect_query(mode = :sql) ⇒ Object



41
# File 'lib/hecks/query_specification/common/dsl.rb', line 41

def inspect_query(mode = :sql) = @inspection = InspectionSpec.new(mode: mode)

#limit_impl(value) ⇒ Object



36
# File 'lib/hecks/query_specification/common/dsl.rb', line 36

def limit_impl(value) = @limit = LimitSpec.new(value: value)

#nulls(mode) ⇒ Object



40
# File 'lib/hecks/query_specification/common/dsl.rb', line 40

def nulls(mode) = @null_semantics = NullSemantics.new(mode: mode)

#offset_impl(value) ⇒ Object



37
# File 'lib/hecks/query_specification/common/dsl.rb', line 37

def offset_impl(value) = @offset = OffsetSpec.new(value: value)

#order_by_impl(field, direction = :asc) ⇒ Object



32
33
34
# File 'lib/hecks/query_specification/common/dsl.rb', line 32

def order_by_impl(field, direction = :asc)
  @order_by = OrderBy.new(field: field, direction: direction)
end

#where_impl(clauses) ⇒ Object

RENAMED FROM where/order_by/limit/offset/authorize (all below) — item #13's full metaprogrammed dispatch (slice 4c). A SHARED mixin, same shape attribute_impl proved in slice 3: ONE renamed method each, both Query and ReadModel Keyword rows name it in calls:. where/order_by are bootstrap-reachable (every core chapter's own read_model filters its roster with them), so both are in BOOTSTRAP_CALLS_FALLBACK for the ReadModel context; limit/ offset/authorize are not (checked directly).



24
25
26
27
28
29
30
# File 'lib/hecks/query_specification/common/dsl.rb', line 24

def where_impl(clauses)
  @wheres ||= []
  clauses.each do |field, value|
    op, operand = split_comparator(value)
    @wheres << WhereClause.new(field: field, op: op, value: operand)
  end
end