mirror of
https://gitee.com/dromara/mayfly-go
synced 2026-04-15 08:45:19 +08:00
feat: 系统升级支持数据库自动迁移,避免手动执行升级脚本
This commit is contained in:
@@ -203,6 +203,15 @@ export function randomPassword(length = 10) {
|
||||
return password.join('');
|
||||
}
|
||||
|
||||
export function randomString(length = 8) {
|
||||
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
let result = '';
|
||||
for (let i = 0; i < length; i++) {
|
||||
result += getRandomChar(chars);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function getRandomChar(charSet: string) {
|
||||
const randomIndex = Math.floor(Math.random() * charSet.length);
|
||||
return charSet[randomIndex];
|
||||
|
||||
Reference in New Issue
Block a user