spark-server/internal/module/message/logic/content.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

20 lines
414 B
Go

package logic
import (
"fmt"
"spark-server/internal/module/message/entity"
)
// EncodeContent serializes a typed payload to BLOB bytes. Callers must store the bytes, not a string.
func EncodeContent(c *entity.Content) (entity.Type, []byte, error) {
if c == nil {
return 0, nil, fmt.Errorf("content: required")
}
raw, err := c.Marshal()
if err != nil {
return 0, nil, err
}
return c.Type, raw, nil
}