package db import ( "testing" ) var oDB *DB func init() { oDB = Open(map[string]DBConfig{ "default": { Driver: "mysql", Host: "localhost", Port: "3366", Database: "demo", Username: "demo", Password: "ded86bf25d661bb723f3898b2440dd678382e2dd", Charset: "utf8mb4", MultiStatements: true, // ParseTime: true, }, }) } func TestScanMapSlice(t *testing.T) { dest := []map[string]any{} oDB.Select("select * from fsm", []any{}, &dest) t.Log(dest) } func TestScanValues(t *testing.T) { dest := []int{} oDB.Select("select id from fsm", []any{}, &dest) t.Log(dest) } func TestScanMap(t *testing.T) { dest := map[string]any{} oDB.Select("select * from fsm where id = 3", []any{}, &dest) t.Log(dest) } func TestScanStruct(t *testing.T) { dest := struct { Id int `db:"id"` Code string `db:"code"` }{} oDB.Select("select * from fsm", []any{}, &dest) t.Log(dest) } func TestScanStructSlice(t *testing.T) { dest := []struct { Id int `db:"id"` Code string `db:"code"` }{} oDB.Select("select * from fsm", []any{}, &dest) t.Log(dest) }