You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
245 B
Go
15 lines
245 B
Go
3 years ago
|
package message
|
||
|
|
||
|
import "ngs/internal/env"
|
||
|
|
||
|
func Serialize(v interface{}) ([]byte, error) {
|
||
|
if data, ok := v.([]byte); ok {
|
||
|
return data, nil
|
||
|
}
|
||
|
data, err := env.Serializer.Marshal(v)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
return data, nil
|
||
|
}
|