xorm icon indicating copy to clipboard operation
xorm copied to clipboard

请教下使用批量sql,为什么一直报Params type error错误?参数不是这样传的嘛?

Open zouhuigang opened this issue 5 years ago • 2 comments

        sql := "select.order.stpl"
	parmas := map[string]interface{}{"id": 1}
	results, _, err := tx.Session().SqlTemplatesClient(sql, &parmas).Execute()
	if err != nil {
		fmt.Println(err)
		tx.RollbackTrans()
		return
	}

zouhuigang avatar Sep 06 '19 04:09 zouhuigang

请提供下你的SqlTemplates文件看看

xormplus avatar Sep 10 '19 08:09 xormplus

select.order.stpl

SELECT id,doctor_user_id,patient_user_id,accompanist_user_id,amount,status FROM order where is_delete=0 {% if id>0 %} and id=?id {% endif %}

zouhuigang avatar Sep 10 '19 13:09 zouhuigang