package models

import (
	"fmt"
	"io/ioutil"

	"gopkg.in/yaml.v2"
)

type YmlRead struct {
}

func (this *YmlRead) Read(filePath string) (map[string]interface{}, error) {
	data, err := ioutil.ReadFile(filePath)
	if err != nil {
		fmt.Println("err")
		return nil, err
	}
	a := make(map[string]interface{})
	err1 := yaml.Unmarshal([]byte(data), &a)
	if err1 != nil {
		fmt.Println("err1")
		return nil, err1
	}
	return a, nil
}
