{"id":13726059,"url":"https://github.com/ian-barnes/dream-postgres-graphql","last_synced_at":"2025-05-07T21:31:05.585Z","repository":{"id":76133917,"uuid":"390713813","full_name":"ian-barnes/dream-postgres-graphql","owner":"ian-barnes","description":"Playing around with Dream, trying to get pagination of GraphQL queries working...","archived":false,"fork":false,"pushed_at":"2021-08-08T14:47:52.000Z","size":16,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-08-04T01:28:22.688Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"OCaml","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ian-barnes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-07-29T12:17:22.000Z","updated_at":"2021-08-12T01:34:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"ecb8f263-d0ec-475e-b2c6-208810261fdc","html_url":"https://github.com/ian-barnes/dream-postgres-graphql","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ian-barnes%2Fdream-postgres-graphql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ian-barnes%2Fdream-postgres-graphql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ian-barnes%2Fdream-postgres-graphql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ian-barnes%2Fdream-postgres-graphql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ian-barnes","download_url":"https://codeload.github.com/ian-barnes/dream-postgres-graphql/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224654096,"owners_count":17347669,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T01:02:51.256Z","updated_at":"2024-11-14T16:33:11.513Z","avatar_url":"https://github.com/ian-barnes.png","language":"OCaml","funding_links":[],"categories":["OCaml"],"sub_categories":[],"readme":"# dream-postgres-graphql\n\nCombines a few of the features of some of the Dream examples, in particular\n`h-sql`, `i-graphql` and `w-postgres`. Accesses the `person` table in a `demo`\ndatabase.\n\nThe URL `/view` displays an HTML view of everything in the database table. Using\nthe query query parameters `after` and/or `first` gives a partial Relay-style\npagination. For example, `/view?after=2\u0026first=3` will get the 3rd, 4th and 5th\nrows of the table.\n\nThe URL `/` displays a GraphiQL interface to a GraphQL schema for the same\ntable. The `person` query has the same optional `after` and `first` pagination\narguments.\n\n## Files\n\n- `bin/main.ml`: Main program / starting point. This is where you see the Dream\n  handler / middleware / router pipeline.\n\n- `lib/person.ml[i]`: Person model\n\n- `lib/sql.ml[i]`: Caqti types and query for fetching people from the database\n\n- `lib/api.ml[i]`: GraphQL schema definition\n\n- `templates/person.eml.html`: HTML/OCaml template for displaying a single\n  person as a table row. (A bit like a Jinja2 macro.)\n\n- `templates/page.eml.html`: HTML/OCaml template for the people page\n\n- `db.sql`: Postgres database dump with schema and data\n\n## Setup\n\nAfter cloning this repo, do:\n\n```\nopam install dream caqti-driver-postgresql\n```\n\nCreate an empty Postgres database called `demo`, then run\n\n```psql --file=db.sql demo```\n\nand it should create and populate the tables you'll need.\n\n## Build\n\n```\ndune build\n```\n\n## Run\n\n```\ndune exec main\n```\n\nAnd then point your browser at \u003chttp://localhost:8080\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fian-barnes%2Fdream-postgres-graphql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fian-barnes%2Fdream-postgres-graphql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fian-barnes%2Fdream-postgres-graphql/lists"}