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.
35 lines
512 B
35 lines
512 B
package service
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
)
|
|
|
|
func VideoList2String(list []VideoInHB) []string {
|
|
res := []string{}
|
|
|
|
for _, v := range list {
|
|
r, err := json.Marshal(v)
|
|
if err != nil {
|
|
continue
|
|
}
|
|
res = append(res, string(r))
|
|
}
|
|
|
|
return res
|
|
}
|
|
|
|
func String2VideoList(list []string) []VideoInHB {
|
|
res := []VideoInHB{}
|
|
|
|
for _, v := range list {
|
|
temp := VideoInHB{}
|
|
err := json.Unmarshal([]byte(v), &temp)
|
|
if err != nil {
|
|
fmt.Println(err)
|
|
}
|
|
res = append(res, temp)
|
|
}
|
|
|
|
return res
|
|
}
|
|
|