Compare commits
No commits in common. "b05c586efb8078526a64a6d02c500b2df2bdcc35" and "77e73281adae32e67e76a088f1ccf36e28bb36cb" have entirely different histories.
b05c586efb
...
77e73281ad
@ -1,13 +1,5 @@
|
||||
# Changelog: @go/encoding
|
||||
|
||||
## v1.5.4 (2026-06-21)
|
||||
- **重构与错误堆栈支持**:
|
||||
- 重构 `js_export.go`,将 `EncodeInt` 等匿名包装以及 `UnHex`/`UnBase64`/`UnURLBase64`/`UnURLEncode` 直接抛错的 Go 接口重写为具名函数,并动态使用 `jsmod.MakeError` 包裹错误。
|
||||
- 升级 `jsmod` 依赖至 v1.5.3,`cast` 依赖至 v1.5.3。
|
||||
|
||||
## v1.5.3 (2026-06-11)
|
||||
- **依赖对齐**: 升级 `jsmod` 依赖至 v1.5.2,升级 `cast` 依赖至 v1.5.2。
|
||||
|
||||
## v1.5.2 (2026-06-08)
|
||||
- **回滚与修复**: 修正了 `v1.5.1` 中架构设计的失误,将 Go 核心层的 `EncodeInt` 及 `IntEncoder.EncodeInt` 返回值从 `string` 恢复为 `[]byte`,彻底消除由于频繁强制转换导致的内存逃逸,恢复了高频并发场景下的零拷贝性能基准。
|
||||
- **JS 智能桥接**: 通过在 `js_export.go` 的注册阶段采用匿名闭包函数 `func(u uint64) string`,完美兼顾了底层的高效性和 JS 环境面向字符串开发的友好体验。
|
||||
|
||||
4
go.mod
4
go.mod
@ -2,6 +2,6 @@ module apigo.cc/go/encoding
|
||||
|
||||
go 1.25.0
|
||||
|
||||
require apigo.cc/go/cast v1.5.3
|
||||
require apigo.cc/go/cast v1.5.0
|
||||
|
||||
require apigo.cc/go/jsmod v1.5.3
|
||||
require apigo.cc/go/jsmod v1.5.0
|
||||
|
||||
76
js_export.go
76
js_export.go
@ -4,60 +4,26 @@ import "apigo.cc/go/jsmod"
|
||||
|
||||
func init() {
|
||||
jsmod.Register("encoding", map[string]any{
|
||||
"Base64": Base64,
|
||||
"Base64Raw": Base64Raw,
|
||||
"UnBase64": jsUnBase64,
|
||||
"URLBase64": URLBase64,
|
||||
"URLBase64Raw": URLBase64Raw,
|
||||
"UnURLBase64": jsUnURLBase64,
|
||||
"Hex": Hex,
|
||||
"UnHex": jsUnHex,
|
||||
"URLEncode": URLEncode,
|
||||
"UnURLEncode": jsUnURLEncode,
|
||||
"HTMLEscape": HTMLEscape,
|
||||
"HTMLUnescape": HTMLUnescape,
|
||||
"UTF8Valid": UTF8Valid,
|
||||
"SortJoin": SortJoin,
|
||||
"EncodeInt": jsEncodeInt,
|
||||
"DecodeInt": DecodeInt,
|
||||
"FillInt": FillInt,
|
||||
"ExchangeInt": ExchangeInt,
|
||||
"HashInt": HashInt,
|
||||
"Base64": Base64,
|
||||
"Base64Raw": Base64Raw,
|
||||
"UnBase64": UnBase64,
|
||||
"URLBase64": URLBase64,
|
||||
"URLBase64Raw": URLBase64Raw,
|
||||
"UnURLBase64": UnURLBase64,
|
||||
"Hex": Hex,
|
||||
"UnHex": UnHex,
|
||||
"URLEncode": URLEncode,
|
||||
"UnURLEncode": UnURLEncode,
|
||||
"HTMLEscape": HTMLEscape,
|
||||
"HTMLUnescape": HTMLUnescape,
|
||||
"UTF8Valid": UTF8Valid,
|
||||
"SortJoin": SortJoin,
|
||||
"EncodeInt": func(u uint64) string {
|
||||
return string(EncodeInt(u))
|
||||
},
|
||||
"DecodeInt": DecodeInt,
|
||||
"FillInt": FillInt,
|
||||
"ExchangeInt": ExchangeInt,
|
||||
"HashInt": HashInt,
|
||||
})
|
||||
}
|
||||
|
||||
func jsUnBase64(data any) ([]byte, error) {
|
||||
res, err := UnBase64(data)
|
||||
if err != nil {
|
||||
return nil, jsmod.MakeError(err)
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func jsUnURLBase64(data any) ([]byte, error) {
|
||||
res, err := UnURLBase64(data)
|
||||
if err != nil {
|
||||
return nil, jsmod.MakeError(err)
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func jsUnHex(data any) ([]byte, error) {
|
||||
res, err := UnHex(data)
|
||||
if err != nil {
|
||||
return nil, jsmod.MakeError(err)
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func jsUnURLEncode(data any) ([]byte, error) {
|
||||
res, err := UnURLEncode(data)
|
||||
if err != nil {
|
||||
return nil, jsmod.MakeError(err)
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func jsEncodeInt(u uint64) string {
|
||||
return string(EncodeInt(u))
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user