From 743d64c8ac495e0f1b1e88287863b9eefd3e2de8 Mon Sep 17 00:00:00 2001 From: vickyhui Date: Thu, 23 Jul 2020 18:39:39 +0800 Subject: [PATCH] Update varcols.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 获取sql查询每一列的数据 --- varcols.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/varcols.md b/varcols.md index 02d8323..97adcc1 100644 --- a/varcols.md +++ b/varcols.md @@ -51,6 +51,11 @@ for rows.Next() { // Now you can check each element of vals for nil-ness, // and you can use type introspection and type assertions // to fetch the column into a typed variable. + + //If you want to get the column value,you can just do it like this + col_value := scanArgs[i].(*sql.RawBytes) + value := string(*col_value) + fmt.Println(value) }