https://github.com/tjdevries/octane.ml
The fastest, hottest
https://github.com/tjdevries/octane.ml
Last synced: about 1 year ago
JSON representation
The fastest, hottest
- Host: GitHub
- URL: https://github.com/tjdevries/octane.ml
- Owner: tjdevries
- Created: 2024-03-06T18:08:33.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-11-14T02:27:12.000Z (over 1 year ago)
- Last Synced: 2025-03-31T11:02:12.663Z (over 1 year ago)
- Language: OCaml
- Size: 241 KB
- Stars: 97
- Watchers: 5
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# `octane.ml`
> The fastest, the hottest
## Usage
Create a User model. The model has two columns.
> **Note:** Migrations coming later
```ocaml
module User = struct
type t =
{ id : int
; name : string
}
[@@deriving table { name = "users" }]
end
```
After you have a model, you can write typesafe queries!
```ocaml
let%query (module UserName) = "SELECT User.id, User.name FROM User"
let print_users db =
let* users = UserName.query db in
List.iter users ~f:(fun { id; name } ->
Fmt.pr "@.We read this from the database: %d - %s@." id name);
Ok ()
;;
```
There's more things too, but I haven't written those parts yet.