This commit is contained in:
xing 2023-06-01 22:46:59 +08:00
parent e4fa93e893
commit 3493eee919

View File

@ -1,7 +1,6 @@
package config
import (
"encoding/json"
"fmt"
"github.com/fthvgb1/wp-go/safety"
"gopkg.in/yaml.v2"
@ -112,20 +111,6 @@ func InitConfig(conf string) error {
return nil
}
func jsonToYaml[T any](b []byte, c T) error {
var v map[string]any
err := json.Unmarshal(b, &v)
if err != nil {
return err
}
marshal, er := yaml.Marshal(v)
if er != nil {
return er
}
err = yaml.Unmarshal(marshal, c)
return err
}
type Dsn struct {
Host string `yaml:"host" json:"host,omitempty"`
Port string `yaml:"port" json:"port,omitempty"`