-
-
Notifications
You must be signed in to change notification settings - Fork 0
feat: createAdapter and createTable #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
productdevbook
commented
Apr 19, 2025
•
edited
Loading
edited
…s for better type safety
…enhanced type safety
… as a separate argument
…cleaner interface
…y model type parameters
…tion for cleaner code
…istency across adapters and utilities
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces the new functions createAdapter and createTable with updated type definitions throughout the codebase. Key changes include the renaming of UnDbSchema to TablesSchema, enhanced generic handling in adapter functions, and updates to documentation and playground examples to reflect these changes.
Reviewed Changes
Copilot reviewed 35 out of 35 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
src/utils/create.ts | Added createAdapter and createTable functions with better generics. |
src/types/* | Updated types from UnDbSchema to TablesSchema. |
src/adapters/* | Refactored adapter implementations to support new type definitions. |
playground/memory.ts & README.md | Updated examples and documentation to align with new types. |
@@ -66,7 +66,7 @@ export async function createKyselyAdapter(config: AnyOptions) { | |||
|
|||
let dialect: Dialect | undefined | |||
|
|||
const databaseType = getDatabaseType(db) | |||
const databaseType = getDatabaseType(db as any) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid using 'as any' for the db parameter. Instead, consider refining the type of db to maintain type safety throughout the adapter.
const databaseType = getDatabaseType(db as any) | |
const databaseType = getDatabaseType(db) |
Copilot uses AI. Check for mistakes.
options: options as any, | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid casting options to any. Strengthen the type constraint on options to ensure proper type safety in the adapter instance creation.
options: options as any, | |
}) | |
options: options as AdapterOptions, |
Copilot uses AI. Check for mistakes.