{"id":34973149,"url":"https://github.com/harryplusplus/knex-pglite","last_synced_at":"2026-01-20T17:03:12.304Z","repository":{"id":318070686,"uuid":"1069804249","full_name":"harryplusplus/knex-pglite","owner":"harryplusplus","description":"A dialect for using PGlite with Knex.js.","archived":false,"fork":false,"pushed_at":"2025-10-29T16:00:34.000Z","size":1345,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-29T17:42:49.499Z","etag":null,"topics":["knex","knex-dialect","knex-js","knex-plugin","knexjs","pg","pglite","postgres","postgresql"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/harryplusplus.png","metadata":{"files":{"readme":"README.ko.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2025-10-04T16:51:47.000Z","updated_at":"2025-10-29T16:00:35.000Z","dependencies_parsed_at":"2025-10-04T22:25:07.834Z","dependency_job_id":"9b84b1bd-1171-4832-9ab4-90f94104fbb6","html_url":"https://github.com/harryplusplus/knex-pglite","commit_stats":null,"previous_names":["harryplusplus/knex-pglite"],"tags_count":45,"template":false,"template_full_name":null,"purl":"pkg:github/harryplusplus/knex-pglite","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harryplusplus%2Fknex-pglite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harryplusplus%2Fknex-pglite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harryplusplus%2Fknex-pglite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harryplusplus%2Fknex-pglite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/harryplusplus","download_url":"https://codeload.github.com/harryplusplus/knex-pglite/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harryplusplus%2Fknex-pglite/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28607624,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T16:10:39.856Z","status":"ssl_error","status_checked_at":"2026-01-20T16:10:39.493Z","response_time":117,"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":["knex","knex-dialect","knex-js","knex-plugin","knexjs","pg","pglite","postgres","postgresql"],"created_at":"2025-12-26T23:53:30.185Z","updated_at":"2026-01-20T17:03:12.290Z","avatar_url":"https://github.com/harryplusplus.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Knex.js PGlite Dialect\n\n[![test](https://github.com/harryplusplus/knex-pglite/actions/workflows/test.yml/badge.svg)](https://github.com/harryplusplus/knex-pglite/actions/workflows/test.yml)\n[![npm version](https://img.shields.io/npm/v/@harryplusplus/knex-pglite)](https://www.npmjs.com/package/@harryplusplus/knex-pglite)\n[![npm downloads](https://img.shields.io/npm/dm/@harryplusplus/knex-pglite)](https://www.npmjs.com/package/@harryplusplus/knex-pglite)\n\n[PGlite](https://pglite.dev/)를 [Knex.js](https://knexjs.org/)과 함께 사용하기 위한 방언입니다.\n\n## 목차\n\n\u003c!-- toc --\u003e\n\n- [언어](#%EC%96%B8%EC%96%B4)\n- [설치](#%EC%84%A4%EC%B9%98)\n- [사용법](#%EC%82%AC%EC%9A%A9%EB%B2%95)\n  - [쉬운 초기화](#%EC%89%AC%EC%9A%B4-%EC%B4%88%EA%B8%B0%ED%99%94)\n  - [PGlite 인스턴스 주입](#pglite-%EC%9D%B8%EC%8A%A4%ED%84%B4%EC%8A%A4-%EC%A3%BC%EC%9E%85)\n- [API](#api)\n  - [`client`](#client)\n  - [`connection`](#connection)\n    - [`pglite`](#pglite)\n- [라이선스](#%EB%9D%BC%EC%9D%B4%EC%84%A0%EC%8A%A4)\n\n\u003c!-- tocstop --\u003e\n\n## 언어\n\n- [English](/README.md)\n- [한국어](/README.ko.md)\n\n## 설치\n\n아래 명령어로 설치합니다.\n\n```sh\n# npm 사용 시\nnpm i knex @electric-sql/pglite @harryplusplus/knex-pglite\n# pnpm 사용 시\npnpm add knex @electric-sql/pglite @harryplusplus/knex-pglite\n```\n\n\u003e [!WARNING]  \n\u003e [Yarn](https://yarnpkg.com/)과 [Bun](https://bun.com/) 환경에서는 아직 테스트되지 않았습니다.\n\n## 사용법\n\n### 쉬운 초기화\n\nKnex 생성 함수의 `client` 및 `connection` 속성을 구성합니다.\n`connection` 속성의 값은 PGlite 생성자의 `dataDir` 매개변수로 사용됩니다.\n\n\u003e [!NOTE]  \n\u003e PGlite 생성자의 `dataDir`의 자세한 스펙은 [PGlite API `dataDir`](https://pglite.dev/docs/api#datadir) 문서를 확인해주세요.\n\n아래 예제는 쉬운 초기화를 하는 방법입니다.\n\n```typescript\nimport { PGliteDialect } from \"@harryplusplus/knex-pglite\";\nimport Knex from \"knex\";\n\nconst knex = Knex({\n  client: PGliteDialect, // Knex PGlite Dialect\n\n  // In-memory 임시 저장소\n  connection: {},\n  connection: \"\",\n  connection: \"memory://\",\n\n  // IndexedDB 저장소\n  connection: \"idb://\",\n\n  // 파일 시스템 저장소\n  connection: \"/my/pglite/data\",\n});\n```\n\n\u003e [!WARNING]  \n\u003e `connection` 속성이 없으면 Knex는 **비연결 모드**로 동작합니다.\n\u003e 비연결 모드는 SQL 문자열 생성기로 동작하는 것이기 때문에, PGlite를 사용하기 위해서는 반드시 빈 객체라도 값을 정의해야 합니다.\n\n\u003e [!WARNING]  \n\u003e File URI (e.g. `file:///my/pglite/data`) 형태의 `connection` 값은 현재 Knex의 연결 문자열 파싱 규칙상 PGlite를 초기화하기 위한 형태로 분석되지 않기 때문에 사용할 수 없습니다.\n\u003e File URI가 아닌 파일 경로 (e.g. `/my/pglite/data`) 형태로 입력해주세요.\n\n### PGlite 인스턴스 주입\n\n[쉬운 초기화](#%EC%89%AC%EC%9A%B4-%EC%B4%88%EA%B8%B0%ED%99%94) 방법을 사용할 경우, PGlite 인스턴스는 Knex 인스턴스가 소유한(**owned**) 상태가 됩니다.\n다시 말해 PGlite 인스턴스는 Knex 인스턴스와 생명주기를 공유합니다.\n\nIn-memory 임시 저장소 방식의 PGlite 인스턴스의 경우, 사용 사례에 따라 Knex 인스턴스와 생명주기를 공유하는 것이 요구사항에 부합하지 않을 수 있습니다.\n또한 PGlite 초기화를 위한 다양한 매개변수를 활용할 수 없습니다.\n\n`connection.pglite` 속성을 PGlite 인스턴스를 반환하는 동기 또는 비동기 함수로 구성합니다.\n이 경우 Knex 내부에서는 PGlite 인스턴스를 빌린(**borrowed**) 상태로 간주합니다.\n다시 말해 Knex는 PGlite 인스턴스의 생명주기를 외부로 위임했기 때문에, PGlite 인스턴스의 생성과 소멸을 관리하지 않습니다.\n\n아래 예제는 PGlite 인스턴스를 주입하는 방법입니다.\n\n```typescript\nimport { PGlite } from \"@electric-sql/pglite\";\nimport Knex from \"knex\";\nimport {\n  PGliteConnectionConfig,\n  PGliteDialect,\n} from \"@harryplusplus/knex-pglite\";\n\nconst pglite = new PGlite();\n\nconst knex = Knex({\n  client: PGliteDialect,\n  connection: {\n    pglite: () =\u003e pglite,\n  } satisfies PGliteConnectionConfig as Knex.Knex.StaticConnectionConfig,\n});\n```\n\n\u003e [!NOTE]  \n\u003e `satisfies PGliteConnectionConfig as Knex.Knex.StaticConnectionConfig`를 사용하는 이유는 다음과 같습니다.\n\u003e\n\u003e 1. `satisfies PGliteConnectionConfig`를 사용해 Knex PGlite Dialect에 필요한 `connection` 속성의 타입을 강제합니다.\n\u003e 2. `as Knex.Knex.StaticConnectionConfig`를 사용해 Knex 타입 정의에 부합하도록 단언합니다.\n\n## API\n\nKnex 생성 함수의 매개변수 중에서 다음 속성을 구성합니다.\n\n### `client`\n\n`client` 속성에 `PGliteDialect` 클래스를 지정해야 Knex PGlite Dialect를 사용할 수 있습니다.\n\n### `connection`\n\n`connection` 속성의 타입은 다음과 같습니다.\n\n```typescript\nexport interface PGliteConnectionConfig {\n  pglite?: PGliteProvider;\n}\n```\n\n다음은 `connection`을 구성하기 위한 속성입니다.\n\n#### `pglite`\n\n`pglite` 속성의 타입은 다음과 같습니다.\n\n```typescript\nexport interface PGliteProvider {\n  (): MaybePromise\u003cPGlite\u003e; // (): PGlite | Promise\u003cPGlite\u003e\n}\n```\n\n\u003e [!NOTE]  \n\u003e PGlite의 다양한 기능을 확인하려면 [PGlite API](https://pglite.dev/docs/api) 문서를 읽어주세요.\n\n## 라이선스\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharryplusplus%2Fknex-pglite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharryplusplus%2Fknex-pglite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharryplusplus%2Fknex-pglite/lists"}