Skip to content
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

feat(minato): add primary type for auto generated primary key #36

Merged
merged 9 commits into from
Aug 25, 2023

Conversation

Hieuzest
Copy link
Contributor

close #35

@codecov
Copy link

codecov bot commented Aug 21, 2023

Codecov Report

Merging #36 (27e58e7) into master (cf2e8db) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master      #36   +/-   ##
=======================================
  Coverage   98.04%   98.05%           
=======================================
  Files          23       23           
  Lines        4652     4670   +18     
  Branches     1142     1150    +8     
=======================================
+ Hits         4561     4579   +18     
  Misses         91       91           
Files Changed Coverage Δ
packages/core/src/model.ts 97.05% <100.00%> (+0.12%) ⬆️
packages/mongo/src/index.ts 98.10% <100.00%> (+0.02%) ⬆️
packages/mysql/src/index.ts 97.68% <100.00%> (+<0.01%) ⬆️
packages/sqlite/src/index.ts 96.93% <100.00%> (+<0.01%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more


export type Type<T = any> =
| T extends number ? 'integer' | 'unsigned' | 'float' | 'double' | 'decimal'
: T extends string ? 'char' | 'string' | 'text'
: T extends boolean ? 'boolean'
: T extends Date ? 'timestamp' | 'date' | 'time'
: T extends unknown[] ? 'list' | 'json'
: T extends Primary ? 'primary' | 'unsigned'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why unsigned here?

Copy link
Contributor Author

@Hieuzest Hieuzest Aug 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unsigned refer to the original autoInc. This allows mongo users to only change type Primary and still use old style autoInc as kind of compatibility. Also i don't have to edit definitions in tests lol.

@Hieuzest Hieuzest requested a review from shigma August 22, 2023 17:14
packages/core/src/model.ts Outdated Show resolved Hide resolved
packages/core/src/model.ts Outdated Show resolved Hide resolved
@shigma shigma merged commit 2834186 into cordiverse:master Aug 25, 2023
@shigma shigma changed the title feat: add primary type for auto generated primary key feat(minato): add primary type for auto generated primary key Aug 25, 2023
@Hieuzest Hieuzest deleted the dev-primary-bare branch August 27, 2023 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: Introduce ObjectId as primary key for mongo
2 participants