gf/database/gdb/gdb_batch_result.go

26 lines
653 B
Go
Raw Normal View History

// Copyright 2019 gf Author(https://github.com/gogf/gf). All Rights Reserved.
2019-01-27 19:44:05 +08:00
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://github.com/gogf/gf.
2019-01-27 19:44:05 +08:00
package gdb
import "database/sql"
// 批量执行的结果对象
type batchSqlResult struct {
rowsAffected int64
lastResult sql.Result
}
// see sql.Result.RowsAffected
func (r *batchSqlResult) RowsAffected() (int64, error) {
2019-06-19 09:06:52 +08:00
return r.rowsAffected, nil
2019-01-27 19:44:05 +08:00
}
// see sql.Result.LastInsertId
func (r *batchSqlResult) LastInsertId() (int64, error) {
2019-06-19 09:06:52 +08:00
return r.lastResult.LastInsertId()
}