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>
20 lines
414 B
Go
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
|
|
}
|