module

Lustra::SQL::Query::Select

Instance methods

clear_distinct

Remove distinct

Source
clear_select
Source
default_wildcard_table=(table : String | Nil = nil)

In some case you want you query to return table.* instead of * if no select parameters has been set. This occurs in the case of joins between models.

Source
distinct(on : String | Nil = "")

Add DISTINCT to the SELECT part of the query

  • If on is blank (empty string, default), will call a simple SELECT DISTINCT ...
  • If on is nil, will remove the distinct (see clear_distinct)
  • If on is a non empty string, will call SELECT DISTINCT ON (on) ...
Source
distinct_value
Source
select(c : Column)
Source
select(*args)

Add field(s) to selection from tuple

select({user_id: "uid", updated_at: "updated_at"})
# => Output "SELECT user_id AS uid, updated_at AS updated_at"
Source