{"id":28865948,"url":"https://github.com/pgvector/pgvector-gleam","last_synced_at":"2026-02-03T15:08:10.399Z","repository":{"id":266776438,"uuid":"899326657","full_name":"pgvector/pgvector-gleam","owner":"pgvector","description":"pgvector examples for Gleam","archived":false,"fork":false,"pushed_at":"2025-12-31T20:45:06.000Z","size":8,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-05T07:56:46.590Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Gleam","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pgvector.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-12-06T03:28:38.000Z","updated_at":"2025-12-31T20:45:10.000Z","dependencies_parsed_at":"2024-12-06T04:28:27.199Z","dependency_job_id":"a91e9c57-1cc1-40d9-9dee-2a3a52ad6bb2","html_url":"https://github.com/pgvector/pgvector-gleam","commit_stats":null,"previous_names":["pgvector/pgvector-gleam"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pgvector/pgvector-gleam","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgvector%2Fpgvector-gleam","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgvector%2Fpgvector-gleam/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgvector%2Fpgvector-gleam/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgvector%2Fpgvector-gleam/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pgvector","download_url":"https://codeload.github.com/pgvector/pgvector-gleam/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgvector%2Fpgvector-gleam/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29047814,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-03T14:55:20.264Z","status":"ssl_error","status_checked_at":"2026-02-03T14:55:19.725Z","response_time":96,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":"2025-06-20T10:39:47.632Z","updated_at":"2026-02-03T15:08:07.116Z","avatar_url":"https://github.com/pgvector.png","language":"Gleam","funding_links":[],"categories":["Sdks \u0026 Libraries"],"sub_categories":[],"readme":"# pgvector-gleam\n\n[pgvector](https://github.com/pgvector/pgvector) examples for Gleam\n\nSupports [pog](https://github.com/lpil/pog)\n\n[![Build Status](https://github.com/pgvector/pgvector-gleam/actions/workflows/build.yml/badge.svg)](https://github.com/pgvector/pgvector-gleam/actions)\n\n## Getting Started\n\nFollow the instructions for your database library:\n\n- [pog](#pog)\n\n## pog\n\nEnable the extension\n\n```gleam\nlet assert Ok(_) =\n  pog.query(\"CREATE EXTENSION IF NOT EXISTS vector\")\n  |\u003e pog.execute(db)\n```\n\nCreate a table\n\n```gleam\nlet assert Ok(_) =\n  pog.query(\"CREATE TABLE items (id bigserial PRIMARY KEY, embedding vector(3))\")\n  |\u003e pog.execute(db)\n```\n\nInsert vectors\n\n```gleam\nlet assert Ok(_) =\n  pog.query(\"INSERT INTO items (embedding) VALUES ($1::text::vector), ($2::text::vector)\")\n  |\u003e pog.parameter(pog.text(\"[1,2,3]\"))\n  |\u003e pog.parameter(pog.text(\"[4,5,6]\"))\n  |\u003e pog.execute(db)\n```\n\nGet the nearest neighbors\n\n```gleam\nlet assert Ok(response) =\n  pog.query(\"SELECT id FROM items ORDER BY embedding \u003c-\u003e $1::text::vector LIMIT 5\")\n  |\u003e pog.parameter(pog.text(\"[3,1,2]\"))\n  |\u003e pog.returning(decode.at([0], decode.int))\n  |\u003e pog.execute(db)\n```\n\nAdd an approximate index\n\n```gleam\nlet assert Ok(_) =\n  pog.query(\"CREATE INDEX ON items USING hnsw (embedding vector_l2_ops)\")\n  |\u003e pog.execute(db)\n```\n\nUse `vector_ip_ops` for inner product and `vector_cosine_ops` for cosine distance\n\nSee a [full example](src/pgvector.gleam)\n\n## Contributing\n\nEveryone is encouraged to help improve this project. Here are a few ways you can help:\n\n- [Report bugs](https://github.com/pgvector/pgvector-gleam/issues)\n- Fix bugs and [submit pull requests](https://github.com/pgvector/pgvector-gleam/pulls)\n- Write, clarify, or fix documentation\n- Suggest or add new features\n\nTo get started with development:\n\n```sh\ngit clone https://github.com/pgvector/pgvector-gleam.git\ncd pgvector-gleam\ncreatedb pgvector_gleam_test\ngleam run\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpgvector%2Fpgvector-gleam","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpgvector%2Fpgvector-gleam","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpgvector%2Fpgvector-gleam/lists"}