File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -79,15 +79,15 @@ Insert a new user instance:
7979
8080` ` ` crystal
8181user = User.new(name: "John")
82- user = Onyx.query(user.insert.returning("*")).first
82+ user = Onyx::SQL .query(user.insert.returning("*")).first
8383
8484pp user # => #<User @id=1, @name="John", @created_at=#<Time ...>>
8585` ` `
8686
8787Query the user :
8888
8989` ` ` crystal
90- user = Onyx.query(User.where(id: 1)).first?
90+ user = Onyx::SQL .query(User.where(id: 1)).first?
9191` ` `
9292
9393With another PostgreSQL table :
@@ -136,13 +136,13 @@ Create a new post:
136136` ` ` crystal
137137user = User.new(id: 1)
138138post = Post.new(author: user, content: "Hello, world!")
139- Onyx.exec(post.insert)
139+ Onyx::SQL .exec(post.insert)
140140` ` `
141141
142142Query all the posts by a user with name "John" :
143143
144144` ` ` crystal
145- posts = Onyx.query(Post
145+ posts = Onyx::SQL .query(Post
146146 .join(author: true) do |x|
147147 x.select(:id, :name)
148148 x.where(name: "John")
You can’t perform that action at this time.
0 commit comments