class

Spacetime::SQL

Inherits Reference < Object

Fluent, allocation-light SQL query builder for SpacetimeDB subscriptions and one-off queries.

Example:

query = Spacetime::SQL.select_from("users")
  .where_eq("online", true)
  .where_gt("score", 100)
  .to_sql
# => "SELECT * FROM users WHERE online = TRUE AND score > 100"

Constructors

new(table : String, columns : Array(String) = ["*"])
Source
select_from(table : String) : self
Source
select_from(table : String, *columns : String) : self
Source

Class methods

format_literal(value : Literal) : String
Source

Instance methods

columns
Source
conditions
Source
limit(count : Int32) : self
Source
limit_count
Source
select(*columns : String) : self
Source
table
Source
to_s(io : IO) : Nil

Appends a short String representation of this object which includes its class name and its object address.

class Person
  def initialize(@name : String, @age : Int32)
  end
end

Person.new("John", 32).to_s # => #<Person:0x10a199f20>
Source
to_sql
Source
where(raw_clause : String) : self
Source
where_eq(column : String, value : Literal) : self
Source
where_gt(column : String, value : Literal) : self
Source
where_gte(column : String, value : Literal) : self
Source
where_lt(column : String, value : Literal) : self
Source
where_lte(column : String, value : Literal) : self
Source
where_neq(column : String, value : Literal) : self
Source

Nested types