Skip to content

Commit 4a30c28

Browse files
committed
Driver/Crystal: Add dedicated page
1 parent 1d3251e commit 4a30c28

File tree

3 files changed

+65
-0
lines changed

3 files changed

+65
-0
lines changed

docs/_assets/icon/crystal-logo.svg

Lines changed: 4 additions & 0 deletions
Loading

docs/connect/crystal.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
(connect-crystal)=
2+
3+
# Crystal
4+
5+
:::{div} sd-text-muted
6+
Connect to CrateDB from Crystal applications.
7+
:::
8+
9+
:::{rubric} About
10+
:::
11+
12+
[crystal-pg] is a native, non-blocking Postgres driver for Crystal,
13+
building upon [crystal-db].
14+
15+
:::{rubric} Synopsis
16+
:::
17+
18+
`shard.yml`
19+
```yaml
20+
dependencies:
21+
pg:
22+
github: will/crystal-pg
23+
```
24+
```shell
25+
shards install
26+
```
27+
`example.cr`
28+
```crystal
29+
require "db"
30+
require "pg"
31+
32+
DB.open("postgres://crate:crate@localhost:5432/doc?sslmode=disable") do |db|
33+
34+
db.query "SELECT mountain, height FROM sys.summits ORDER BY height DESC LIMIT 3" do |rs|
35+
puts "#{rs.column_name(0)} (#{rs.column_name(1)})"
36+
rs.each do
37+
puts "#{rs.read(String)}: (#{rs.read(Int32)})"
38+
end
39+
end
40+
41+
end
42+
```
43+
44+
45+
[crystal-db]: https://github.com/crystal-lang/crystal-db
46+
[crystal-pg]: https://github.com/will/crystal-pg

docs/connect/index.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,20 @@ CrateDB drivers and adapters for supported programming languages, frameworks, an
4949
:margin: 4 4 0 0
5050
:padding: 0
5151

52+
::::{grid-item-card} Crystal
53+
:link: connect-crystal
54+
:link-type: ref
55+
:link-alt: Connect to CrateDB using Crystal
56+
:padding: 3
57+
:text-align: center
58+
:class-card: sd-pt-3
59+
:class-body: sd-fs-1
60+
:class-title: sd-fs-6
61+
```{image} /_assets/icon/crystal-logo.svg
62+
:height: 70px
63+
```
64+
::::
65+
5266
::::{grid-item-card} Java
5367
:link: connect-java
5468
:link-type: ref
@@ -182,6 +196,7 @@ application
182196
:maxdepth: 1
183197
:hidden:
184198
199+
crystal
185200
java
186201
javascript
187202
php

0 commit comments

Comments
 (0)