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>
23 lines
463 B
Go
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)
|
|
}
|