stmt, err := db.Prepare("INSERT person SET name=?")
sqlRes, err := stmt.Exec(person.Name)
心有法竹
浏览 129回答 2
2回答
开心每一天1111
替换sqlRes为空白标识符( _)。从规范:空白标识符提供了一种忽略赋值中右侧值的方法:_ = x // evaluate x but ignore itx, _ = f() // evaluate f() but ignore second result value例子:stmt, err := db.Prepare("INSERT person SET name=?")_, err = stmt.Exec(person.Name)