Exemplo n.º 1
0
func (resultBean *ResultBean) Xml() (bool, string, error) {

	if resultBean.Error != nil {
		return false, "", resultBean.Error
	}
	if !resultBean.Has {
		return resultBean.Has, "", nil
	}
	has, result, err := resultBean.Json()
	if err != nil {
		return false, "", err
	}
	if !has {
		return has, "", nil
	}
	var anydata = []byte(result)
	var i interface{}
	err = json.Unmarshal(anydata, &i)
	if err != nil {
		return false, "", err
	}
	resultByte, err := anyxml.Xml(i)
	if err != nil {
		return false, "", err
	}

	return resultBean.Has, string(resultByte), err
}
Exemplo n.º 2
0
func (resultMap *ResultMap) Xml() (string, error) {
	if resultMap.Error != nil {
		return "", resultMap.Error
	}
	results, err := anyxml.Xml(resultMap.Results)
	if err != nil {
		return "", err
	}
	return string(results), nil
}
Exemplo n.º 3
0
func (session *Session) queryAllToXmlString(sql string, paramStr ...interface{}) (string, error) {
	resultMap, err := session.queryAll(sql, paramStr...)

	if err != nil {
		return "", err
	}
	results, err := anyxml.Xml(resultMap)
	if err != nil {
		return "", err
	}
	return string(results), nil
}
Exemplo n.º 4
0
func (resultStructs *ResultStructs) Xml() (string, error) {
	if resultStructs.Error != nil {
		return "", resultStructs.Error
	}

	result, err := resultStructs.Json()
	if err != nil {
		return "", err
	}

	var anydata = []byte(result)
	var i interface{}
	err = json.Unmarshal(anydata, &i)
	if err != nil {
		return "", err
	}
	resultByte, err := anyxml.Xml(i)
	if err != nil {
		return "", err
	}

	return string(resultByte), nil
}