func (*DB) QueryRowContext¶
func (db *DB) QueryRowContext(ctx context.Context, query string, args ...interface{}) *Row
QueryRowContext 执行最多返回一行的查询。QueryRowContext 总是返回一个非空值。错误将推迟到调用 Row.Scan 方法之后。如果查询没有选择任何行,Row.Scan 将返回 ErrNoRows。否则,Row.Scan将扫描第一个选定的行并丢弃其余的行。
提供的上下文用查询。