func (db *Db) SetTablesDataYaml(yaml string) (err error) { data := make(map[string][]map[string]string) err = kmgYaml.Unmarshal([]byte(yaml), &data) if err != nil { return err } return db.SetTablesData(data) }
// @deprecated func MustSetDbDataYaml(c *redis.Client, yaml string) { data := map[string]string{} err := kmgYaml.Unmarshal([]byte(yaml), &data) if err != nil { panic(err) } MustSetDbData(c, data) return }
// @deprecated func (db DB) SetTablesDataYaml(yaml string) (err error) { data := make(map[string][]map[string]string) err = kmgYaml.Unmarshal([]byte(yaml), &data) if err != nil { return err } if len(data) == 0 { return fmt.Errorf("[SetTablesDataYaml] try to set tables with no data,wrong format?") } return db.SetTablesData(data) }