mirror of
https://github.com/InazumaV/Ratte.git
synced 2026-02-04 12:40:12 +00:00
Initial commit
This commit is contained in:
22
conf/core.go
Normal file
22
conf/core.go
Normal file
@@ -0,0 +1,22 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user