19 lines
308 B
Go
19 lines
308 B
Go
|
package bean
|
||
|
|
||
|
import "encoding/json"
|
||
|
|
||
|
type FileData struct {
|
||
|
Name string `json:"name"`
|
||
|
Path string `json:"path"`
|
||
|
}
|
||
|
|
||
|
func (f FileData) ToString() string {
|
||
|
marshal, _ := json.Marshal(f)
|
||
|
return string(marshal)
|
||
|
}
|
||
|
|
||
|
func (f FileData) Parse(data string) FileData {
|
||
|
json.Unmarshal([]byte(data), &f)
|
||
|
return f
|
||
|
}
|