[Feature Request] nanoid support custom alphabet
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
- #2377 @sanny-io による — マージされずにクローズ
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- sqlite, typescript
- 領域
- databases
調査の方向性
The request is to let @default(nanoid(16)) in the ZenStack schema draw from a user-supplied alphabet, configured via a new option on ZenStackClient (shown next to SqliteDialect in the body). Start by locating where the nanoid default is resolved and where client options are declared, then thread a nanoidCustomAlphabet value through to the ID generator so existing nanoid(n) usage keeps working. Done means the schema default honors the configured alphabet and the behaviour is covered by a test; note that a linked pull request (#2377) was closed unmerged and the thread has been silent for months, so confirm the desired API with maintainers before starting.
索引モデルが issue の本文から書いたものです。
説明
Most of the time, we need to define a special business ID field for models, such as post_id or user_id. We often choose UUID or nanoid for generating these IDs. However, when using nanoid, we found that it cannot meet our requirements because it defaults to generating IDs with uppercase letters and numbers. Sometimes we prefer IDs in lowercase letters and numbers, which nanoid cannot handle. As a result, we are forced to set the ID field as non‑nullable and generate a compliant ID in the code layer when creating records.
This is not an ideal practice. Providing a custom alphabet feature for nanoid would help reduce this mental overhead. Moreover, I believe the optimal API design would be:
-
Keep the usage as is:
@default(nanoid(16)) -
Add an optional parameter when creating the client:
export const db = new ZenStackClient(schema, {
dialect: new SqliteDialect({
database: new SQLite(':memory:'),
}),
nanoidCustomAlphabet: "1234567890abcdef"
});
- 主要言語
- TypeScript
- スター
- 2.9k
- フォーク
- 157
- 平均マージ
- 2日 46分
- マージ済み PR(30日)
- 17
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
zenstackhq/zenstack のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
zenstackhq/zenstack#2873 ·
メンテナーはふだん 1 日以内に返信
-
`@default` on a field of a `@map`-ed enum emits the enum name as the column default対応中かも @jkugsiya が 4 日前に担当しました。 オープンruntime
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
zenstackhq/zenstack#2868 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
zenstackhq/zenstack#2694 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
zenstackhq/zenstack#2659 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
zenstackhq/zenstack#2542 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
zenstackhq/zenstack の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
TomerAberbach/profiler-md#733 ·
メンテナーはふだん 1 日以内に返信
-
bug priority: medium
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
brentspine/brents-toasts#143 ·
-
🐛 bug 🗺️ DB Models & Ops
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
LibreChat-AI/LibreChat#17214 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
Wavvon/Wavvon-clients#136 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
umami-software/umami#4637 ·
メンテナーはふだん 3 日以内に返信