You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1017 B
52 lines
1017 B
2 months ago
|
package convert
|
||
|
|
||
|
import (
|
||
|
"encoding/json"
|
||
|
"matchmaking-system/internal/biz/structure"
|
||
|
)
|
||
|
|
||
|
// ConvertAggregates
|
||
|
//
|
||
|
// @Description:
|
||
|
// @param body
|
||
|
// @return *structure.Aggregates
|
||
|
// @return error
|
||
|
func ConvertAggregates(body string) (*structure.Aggregates, error) {
|
||
|
var aggregates structure.Aggregates
|
||
|
if err := json.Unmarshal([]byte(body), &aggregates); err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
return &aggregates, nil
|
||
|
}
|
||
|
|
||
|
// ConvertInTraDay
|
||
|
//
|
||
|
// @Description:
|
||
|
// @param body
|
||
|
// @return []*structure.InTraDay
|
||
|
// @return error
|
||
|
func ConvertInTraDay(body string) ([]*structure.InTraDay, error) {
|
||
|
var inTraDay []*structure.InTraDay
|
||
|
if err := json.Unmarshal([]byte(body), &inTraDay); err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
return inTraDay, nil
|
||
|
}
|
||
|
|
||
|
// ConvertEod
|
||
|
//
|
||
|
// @Description:
|
||
|
// @param body
|
||
|
// @return []*structure.Eod
|
||
|
// @return error
|
||
|
func ConvertEod(body string) ([]*structure.Eod, error) {
|
||
|
var eod []*structure.Eod
|
||
|
if err := json.Unmarshal([]byte(body), &eod); err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
return eod, nil
|
||
|
}
|