Skip to content

Commit 87424b4

Browse files
committed
docs(onboard): Add match operator example to getting started
1 parent 05caef7 commit 87424b4

File tree

3 files changed

+37
-4
lines changed

3 files changed

+37
-4
lines changed

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ In your `psql` connection to Proxy:
161161
docker compose exec proxy psql postgres://cipherstash:3ncryp7@localhost:6432/cipherstash
162162
```
163163

164-
Insert more records via Proxy, and search by salary:
164+
Insert more records via Proxy, and query by email:
165165

166166
```sql
167167
INSERT INTO users (encrypted_email, encrypted_dob, encrypted_salary) VALUES ('bob@cipherstash.com', '1991-03-06', '10');
@@ -175,13 +175,24 @@ In the `SELECT` statement, the `encrypted_salary` value is transparently encrypt
175175
In the `SELECT` statement, the `<=` comparison operation in the `WHERE` clause is evaluated against **encrypted** data.
176176
In the `SELECT` statement, the `SELECT` returns `alice` and `bob`, but not `carol`.
177177

178+
Query `users` by email:
179+
180+
```sql
181+
SELECT encrypted_email, encrypted_dob, encrypted_salary FROM users WHERE encrypted_email LIKE 'alice';
182+
```
183+
184+
The literal string `alice` is transparently encrypted by Proxy, and compared in the database against the stored encrypted date value.
185+
The `LIKE` comparison operation is evaluated against **encrypted** data.
186+
The `SELECT` will only return `alice`.
187+
188+
178189
Finally, query `users` by date:
179190

180191
```sql
181192
SELECT encrypted_email, encrypted_dob, encrypted_salary FROM users WHERE encrypted_dob > '2000-01-01' ;
182193
```
183194

184-
The `encrypted_dob` value is transparently encrypted by Proxy, and compared in the database against the stored encrypted date value.
195+
The literal date `2000-01-01` is transparently encrypted by Proxy, and compared in the database against the stored encrypted date value.
185196
The `>` comparison operation is evaluated against **encrypted** data.
186197
The `SELECT` will only return `carol`.
187198

docs/getting-started/commands.sql

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
-- INSERT users
3+
INSERT INTO users (encrypted_email, encrypted_dob, encrypted_salary) VALUES ('alice@cipherstash.com', '1970-01-01', '100');
4+
INSERT INTO users (encrypted_email, encrypted_dob, encrypted_salary) VALUES ('bob@cipherstash.com', '1991-03-06', '10');
5+
INSERT INTO users (encrypted_email, encrypted_dob, encrypted_salary) VALUES ('carol@cipherstash.com', '2005-12-30', '1000');
6+
7+
-- SELECT user by email
8+
SELECT encrypted_dob FROM users WHERE encrypted_email = 'alice@cipherstash.com';
9+
10+
-- UPDATE user by email
11+
UPDATE users SET encrypted_dob = '1978-02-01' WHERE encrypted_email = 'alice@cipherstash.com';
12+
13+
14+
-- Comparing salary
15+
SELECT encrypted_email, encrypted_dob, encrypted_salary FROM users WHERE encrypted_salary <= 100;
16+
17+
-- Comparing dob
18+
SELECT encrypted_email, encrypted_dob, encrypted_salary FROM users WHERE encrypted_dob > '2000-01-01' ;
19+
20+
-- Searching for email
21+
SELECT encrypted_email, encrypted_dob, encrypted_salary FROM users WHERE encrypted_email LIKE 'alice';

mise.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@ CS_DATABASE__USERNAME = "cipherstash"
1818
CS_DATABASE__PASSWORD = "password"
1919
CS_DATABASE__HOST = "localhost"
2020
CS_DATABASE__PORT = "5532"
21+
2122
# Default configuration for dev cipherstash-proxy run using 'mise run proxy:up'
2223
CS_PROXY__HOST = "proxy"
2324
# Misc
24-
DOCKER_CLI_HINTS = "false" # Please don't show us What's Next.
25-
CS_EQL_VERSION="eql-1.0.0"
25+
DOCKER_CLI_HINTS = "false" # Please don't show us What's Next.
26+
CS_EQL_VERSION = "eql-1.0.1"
2627

2728
[tools]
2829
"cargo:cargo-binstall" = "latest"

0 commit comments

Comments
 (0)