读取部分字段,使用函数 QueryRowPartialCtx 。
假设有如下一张表:
CREATE TABLE test (id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, ctime DATETIME);
要读取字段 ctime 值。
定义一结构体:
type X struct {
state int `db:"-
读取部分字段,使用函数 QueryRowPartialCtx 。
假设有如下一张表:
CREATE TABLE test (id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, ctime DATETIME);
要读取字段 ctime 值。
定义一结构体:
type X struct {
state int `db:"-