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

重构: randx.RandCode 代码 #241

Merged
merged 6 commits into from
Jan 14, 2024
Merged

重构: randx.RandCode 代码 #241

merged 6 commits into from
Jan 14, 2024

Conversation

dxyinme
Copy link
Contributor

@dxyinme dxyinme commented Jan 12, 2024

  1. 支持字符类型自由组合
  2. 增加对特殊字符的支持
  3. 增加函数RandStrByCharset,可以自定义字符集
  4. 增加对length小于0的异常处理
  5. 增加benchmark

Copy link

codecov bot commented Jan 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (eba89e1) 95.91% compared to head (4b42722) 95.79%.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #241      +/-   ##
==========================================
- Coverage   95.91%   95.79%   -0.13%     
==========================================
  Files          66       66              
  Lines        3404     3424      +20     
==========================================
+ Hits         3265     3280      +15     
- Misses        108      110       +2     
- Partials       31       34       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

randx/rand_code.go Outdated Show resolved Hide resolved
randx/rand_code.go Outdated Show resolved Hide resolved
randx/rand_code.go Outdated Show resolved Hide resolved
randx/rand_code_test.go Outdated Show resolved Hide resolved
randx/rand_code_test.go Show resolved Hide resolved
randx/rand_code_test.go Outdated Show resolved Hide resolved
@dxyinme dxyinme requested a review from longyue0521 January 13, 2024 08:42
Copy link
Contributor

@flycash flycash left a comment

Choose a reason for hiding this comment

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

我有一个小问题,就是有没有必要同时暴露 RandCode 和 RandStrCahrset 两个方法?

比如说,我不暴露 RandCode,我直接暴露 RandStrCharset,那么我直接用 RandStrCharset 会有什么问题吗?

randx/rand_code.go Outdated Show resolved Hide resolved
@dxyinme
Copy link
Contributor Author

dxyinme commented Jan 13, 2024

我有一个小问题,就是有没有必要同时暴露 RandCode 和 RandStrCahrset 两个方法?

比如说,我不暴露 RandCode,我直接暴露 RandStrCharset,那么我直接用 RandStrCharset 会有什么问题吗?

不会有什么问题,RandCode的存在只是给RandStrByCharset做了一个封装,个人感觉还是可以保留的,为了给使用者带来方便,他们可以直接使用RandCode,而不需要自己拼凑字符集

@dxyinme dxyinme requested a review from flycash January 13, 2024 09:10
@longyue0521 longyue0521 linked an issue Jan 14, 2024 that may be closed by this pull request
@longyue0521 longyue0521 merged commit 4628cd1 into ecodeclub:dev Jan 14, 2024
4 checks passed
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.

重构randx.RandCode以及传入的RandType数值
3 participants