Compare commits

...

2 Commits
v1.5.0 ... main

2 changed files with 23 additions and 6 deletions

View File

@ -1,5 +1,8 @@
# Changelog: @go/id # Changelog: @go/id
## v1.5.1 (2026-06-08)
- **JS 极简 API**: 彻底废除 JS 侧冗长难记的 `get8Bytes...` 等方法,统一收敛为极简的 `Make(size int, forDB ...string)`。充分利用了底层 JS Bridge 的零值回退特性,在不填第二个参数时也能安全优雅地工作。
## [v1.3.2] - 2026-05-30 ## [v1.3.2] - 2026-05-30
### Added ### Added

View File

@ -1,13 +1,27 @@
package id package id
import "apigo.cc/go/jsmod" import (
"strings"
"apigo.cc/go/jsmod"
)
func init() { func init() {
jsmod.Register("id", map[string]any{ jsmod.Register("id", map[string]any{
"get8Bytes4KPerSecond": Get8Bytes4KPerSecond, "Make": func(size int, forDB *string) string {
"get9Bytes90KPerSecond": Get9Bytes90KPerSecond, dbType := ""
"get10Bytes14MPerSecond": Get10Bytes14MPerSecond, if forDB != nil {
"get11Bytes900MPerSecond": Get11Bytes900MPerSecond, dbType = strings.ToLower(*forDB)
"get12BytesUltraPerSecond": Get12BytesUltraPerSecond, }
switch dbType {
case "mysql":
return DefaultIDMaker.GetForMysql(size)
case "postgres", "pg", "pgsql":
return DefaultIDMaker.GetForPostgreSQL(size)
default:
return DefaultIDMaker.Get(size)
}
},
}) })
} }