You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: languages/go/xorm/README.md
+165Lines changed: 165 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -79,3 +79,168 @@ Run tests:
79
79
```shell
80
80
./run.sh tests
81
81
```
82
+
83
+
## Integrating EQL into a Xorm app
84
+
85
+
Before starting to integrate, follow the EQL installation steps in the main [README file](../../../README.md).
86
+
87
+
The [goeql package](https://github.com/cipherstash/encrypt-query-language/blob/main/languages/go/goeql/goeql.go) contains functions to help with serializing data into the format that CipherStash Proxy expects and deserializing data from this format back to the original value.
88
+
89
+
For reference there is an example setup in the [main.go](./main.go) file.
90
+
91
+
Example migrations are in the [migrations.go](./migrations.go) file.
CREATEINDEXON examples USING GIN (cs_ste_vec_v1(encrypted_jsonb_field));
201
+
202
+
-- Run these functions to activate
203
+
204
+
SELECT cs_encrypt_v1();
205
+
SELECT cs_activate_v1();
206
+
```
207
+
208
+
## Inserting
209
+
210
+
Inserting data remains the same.
211
+
212
+
The `toDB()` function that was setup in [this earlier step](README.md#integrating-eql-into-a-xorm-app), serializes the plaintext value into the json payload CipherStash Proxy expects.
213
+
214
+
Retrieving data remains the same as well.
215
+
216
+
The `fromDb()` function for the relevant encrypted field will deserialize the json payload returned from CipherStash Proxy and return the plaintext value
217
+
218
+
## Querying
219
+
220
+
The queries to retrieve data do change.
221
+
222
+
EQL provides specialized functions to interact with encrypted data.
223
+
224
+
You can read about these functions [here](../../../README.md#querying-data-with-eql).
225
+
226
+
Similar to how CipherStash Proxy require's a specific json payload when inserting data, a similar payload is required when querying.
227
+
228
+
Goeql has functions that will serialize a value into the format required by CipherStash Proxy.
229
+
230
+
[These functions](https://github.com/cipherstash/encrypt-query-language/blob/main/languages/go/goeql/goeql.go#L153-L171) will need to be used for the relevant query.
231
+
232
+
Examples of how to use these are in the [example_queries.go](./example_queries.go) file.
233
+
234
+
Below is an example of running a match query on a text field.
0 commit comments