mirror of
https://github.com/InazumaV/Ratte.git
synced 2026-02-04 04:30:09 +00:00
23 lines
478 B
Go
23 lines
478 B
Go
package conf
|
|
|
|
import "github.com/goccy/go-json"
|
|
|
|
type Core struct {
|
|
Name string `json:"Name,omitempty"`
|
|
Path string `json:"Path,omitempty"`
|
|
DataPath string `json:"DataPath,omitempty"`
|
|
Config json.RawMessage `json:"Config,omitempty"`
|
|
}
|
|
type _core Core
|
|
|
|
func (c *Core) UnmarshalJSON(data []byte) error {
|
|
err := json.Unmarshal(data, (*_core)(c))
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if len(c.Config) == 0 {
|
|
c.Config = data
|
|
}
|
|
return nil
|
|
}
|