Skip to content

Commit 546a2d4

Browse files
committed
use string preprocessor and remove functions
1 parent ed36bc1 commit 546a2d4

File tree

2 files changed

+313
-347
lines changed

2 files changed

+313
-347
lines changed

README.md

-29
Original file line numberDiff line numberDiff line change
@@ -68,35 +68,6 @@ Example usage:
6868
let update_title = Article.update_title ?ctx mike thomas_article "Updated Title"
6969
```
7070

71-
### Integrate within a query (MariaDB)
72-
73-
Requirement: Run `MariaDb.start` when the executable is started.
74-
75-
The `start` function defines needed MariaDB functions for guardian. They can be integrated within your queries as well.
76-
It creates a `guardianValidate<Role>Uuid(...)` function for all roles, it takes care of all registered Relations within guardian.
77-
78-
The following example shows how to check for a specific Post:
79-
80-
```ocaml
81-
(** [guardianValidatePostUuid]
82-
83-
Input arguments:
84-
- actor_uuid (binary 16)
85-
- action (enum: 'create','read','update','delete','manage')
86-
- target_uuid (binary 16, usually within the query)
87-
88-
Outputs a boolean
89-
*)
90-
let find_accessible kind =
91-
{sql|
92-
SELECT *
93-
FROM posts
94-
GROUP BY posts.uuid
95-
HAVING guardianValidatePostUuid(guardianEncodeUuid(?), ?, posts.uuid)
96-
|sql}
97-
|> Caqti_type.(t2 UuidActor.t Action.t ->* Post.t)
98-
```
99-
10071
## Development
10172

10273
A guide how to setup the project with devcontainers can be found [here](./.devcontainer/README.md).

0 commit comments

Comments
 (0)