mirror of
https://github.com/fumiama/tienyik.git
synced 2026-07-01 16:30:26 +08:00
feat: add log & supporting packages
This commit is contained in:
22
internal/hson/req.go
Normal file
22
internal/hson/req.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package hson
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/fumiama/tienyik"
|
||||
"github.com/fumiama/tienyik/internal/log"
|
||||
)
|
||||
|
||||
func Marshal(tya *tienyik.AES, v any) []byte {
|
||||
w := bytes.NewBuffer(make([]byte, 0, 1024))
|
||||
err := json.NewEncoder(w).Encode(v)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
log.Debugln("Marshal JSON:", w.String())
|
||||
if tya != nil {
|
||||
return tya.Encrypt(w.Bytes())
|
||||
}
|
||||
return w.Bytes()
|
||||
}
|
||||
Reference in New Issue
Block a user