spark-server/internal/transport/tcp/protocol/envelope.go
zhr ae9a71034d feat: implement Spark IM V3 modular monolith
Add HTTP /v1 MVC, TCP send path, groups with server-side member-avatar collage, object-storage upload, and friends/favorites around the architecture-v3 layout.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-17 19:52:11 +08:00

23 lines
463 B
Go

package protocol
import (
"spark-server/internal/pkg/i18n"
"spark-server/internal/pkg/reply"
)
func EncodeOK(data any) []byte {
return reply.MustMarshal(reply.OK(data))
}
func EncodeErr(err error) []byte {
return EncodeErrLang(i18n.Default, err)
}
func EncodeErrLang(lang i18n.Lang, err error) []byte {
return reply.MustMarshal(reply.FromErrorLang(lang, err))
}
func DecodeEnvelope(body []byte) (reply.Envelope, error) {
return reply.Unmarshal(body)
}