Class: Supabase::Postgrest::SelectRequestBuilder
- Inherits:
-
FilterRequestBuilder
- Object
- QueryRequestBuilder
- FilterRequestBuilder
- Supabase::Postgrest::SelectRequestBuilder
- Includes:
- SelectMixin
- Defined in:
- lib/supabase/postgrest/request_builder.rb
Overview
Returned by select() — filters + select modifiers + result-shape switchers.
Instance Attribute Summary
Attributes inherited from QueryRequestBuilder
Instance Method Summary collapse
- #csv ⇒ Object
- #explain(analyze: false, verbose: false, settings: false, buffers: false, wal: false, format: "text") ⇒ Object
- #maybe_single ⇒ Object
- #single ⇒ Object
- #text_search(column, query, options = {}) ⇒ Object
Methods included from SelectMixin
#limit, #offset, #order, #range
Methods included from FilterMixin
#adj, #cd, #contained_by, #contains, #cs, #eq, #filter, #fts, #gt, #gte, #ilike, #ilike_all_of, #ilike_any_of, #in_, #is_, #like, #like_all_of, #like_any_of, #lt, #lte, #match, #max_affected, #neq, #not_, #nxl, #nxr, #or_, #ov, #overlaps, #phfts, #plfts, #range_adjacent, #range_gt, #range_gte, #range_lt, #range_lte, #sl, #sr, #wfts
Methods inherited from QueryRequestBuilder
#execute, #initialize, #retry, #select
Constructor Details
This class inherits a constructor from Supabase::Postgrest::QueryRequestBuilder
Instance Method Details
#csv ⇒ Object
523 524 525 526 |
# File 'lib/supabase/postgrest/request_builder.rb', line 523 def csv @request.headers["Accept"] = "text/csv" SingleRequestBuilder.new(@request) end |
#explain(analyze: false, verbose: false, settings: false, buffers: false, wal: false, format: "text") ⇒ Object
541 542 543 544 545 546 547 548 549 550 |
# File 'lib/supabase/postgrest/request_builder.rb', line 541 def explain(analyze: false, verbose: false, settings: false, buffers: false, wal: false, format: "text") = [] << "analyze" if analyze << "verbose" if verbose << "settings" if settings << "buffers" if buffers << "wal" if wal @request.headers["Accept"] = "application/vnd.pgrst.plan+#{format}; options=#{.join('|')}" format == "text" ? ExplainRequestBuilder.new(@request) : SingleRequestBuilder.new(@request) end |
#maybe_single ⇒ Object
519 520 521 |
# File 'lib/supabase/postgrest/request_builder.rb', line 519 def maybe_single MaybeSingleRequestBuilder.new(@request) end |
#single ⇒ Object
514 515 516 517 |
# File 'lib/supabase/postgrest/request_builder.rb', line 514 def single @request.headers["Accept"] = "application/vnd.pgrst.object+json" SingleRequestBuilder.new(@request) end |
#text_search(column, query, options = {}) ⇒ Object
528 529 530 531 532 533 534 535 536 537 538 539 |
# File 'lib/supabase/postgrest/request_builder.rb', line 528 def text_search(column, query, = {}) type_part = case [:type] || ["type"] when "plain" then "pl" when "phrase" then "ph" when "web_search" then "w" else "" end config = [:config] || ["config"] config_part = config ? "(#{config})" : "" @request.params[column.to_s] = "#{type_part}fts#{config_part}.#{query}" QueryRequestBuilder.new(@request) end |