package main import ( "fmt" _ "github.com/go-sql-driver/mysql" "github.com/xormplus/xorm" "testing" ) func TestRflect(t *testing.T) { db, err := xorm.NewEngine("mysql", "root:gSRGZqb121TlYIbJy0@tcp(47.103.202.94:3306)/i2bill?charset=utf8&loc=Local&parseTime=true") if err != nil { panic(err) } db.RegisterSqlMap(xorm.Xml("sqlconfig", ".xml")) db.RegisterSqlTemplate(xorm.Pongo2("sqlconfig", ".stpl")) db.RegisterSqlTemplate(xorm.Jet("sqlconfig", ".jet")) db.RegisterSqlTemplate(xorm.Default("../i2-bill-openapi/internal/sql", ".tpl")) db.StartFSWatcher() db.ShowSQL(true) stplkey := fmt.Sprintf("i2bill_acquirer_attendance_record_page_select.tpl") paramMap_i_t := map[string]interface{}{ "page": 1, "rows": 10, "date_sta": "", "date_end": "", "user_id": 3, "all": false, } result, err := db.SqlTemplateClient(stplkey, ¶mMap_i_t).Query().List() if err != nil { fmt.Println(err) return } fmt.Println(result) }