mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
⚡ Improve performance of importing .sy.zip https://github.com/siyuan-note/siyuan/issues/10874
This commit is contained in:
parent
44d41a0856
commit
d9370560e5
2 changed files with 24 additions and 4 deletions
|
|
@ -18,13 +18,31 @@ package util
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"math/rand"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
"unicode"
|
||||
|
||||
"github.com/88250/lute/html"
|
||||
)
|
||||
|
||||
func init() {
|
||||
rand.Seed(time.Now().UTC().UnixNano())
|
||||
}
|
||||
|
||||
var (
|
||||
letter = []rune("abcdefghijklmnopqrstuvwxyz0123456789")
|
||||
)
|
||||
|
||||
func RandString(length int) string {
|
||||
b := make([]rune, length)
|
||||
for i := range b {
|
||||
b[i] = letter[rand.Intn(len(letter))]
|
||||
}
|
||||
return string(b)
|
||||
}
|
||||
|
||||
// InsertElem inserts value at index into a.
|
||||
// 0 <= index <= len(s)
|
||||
func InsertElem[T any](s []T, index int, value T) []T {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue