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

可以从id分解出时间和workid吗? #86

Open
jianliulin opened this issue Jan 2, 2024 · 4 comments
Open

可以从id分解出时间和workid吗? #86

jianliulin opened this issue Jan 2, 2024 · 4 comments

Comments

@jianliulin
Copy link

可以从id分解出时间和workid吗?

@yitter
Copy link
Owner

yitter commented Jan 5, 2024

可以,转成二进制后,截取其中的固定位置,就可以反推时间和WorkerId。

@jianliulin
Copy link
Author

官方会提供这个功能吗?

@yitter
Copy link
Owner

yitter commented Jan 20, 2024

可以

@leleonwu
Copy link

我也一直希望能出这个功能,这样在查询展示或者存储的时候可以省去很多的时间存储字段,另外还建议额外在YitIdHelper中增加一个方法YitIdHelper.NextId(DateTime aimDatetime),根据指定的时间生成一个Id,场景:比如想查询订单表中某个时间段的数据,这个时候就可以转换成Id来查询,既可以不用单独为时间字段建索引,还可以用Id查,可大幅提高查询效率,希望大大可以早日集成,谢谢啦

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

No branches or pull requests

3 participants