mirror of
https://github.com/wahyd4/go-mocket.git
synced 2026-08-09 04:46:54 +10:00
Fixed simple naming, comment conventions Fixed pointer references to a struc where there was also a pointer. Govet complain was right.
27 lines
641 B
Go
27 lines
641 B
Go
package gomocket
|
|
|
|
import (
|
|
"database/sql/driver"
|
|
)
|
|
|
|
// FakeResult implementation of sql Result interface
|
|
type FakeResult struct {
|
|
insertID int64
|
|
rowsAffected int64
|
|
}
|
|
|
|
// NewFakeResult returns result interface instance
|
|
func NewFakeResult(insertID int64, rowsAffected int64) driver.Result {
|
|
return &FakeResult{insertID, rowsAffected}
|
|
}
|
|
|
|
// LastInsertId required to give sql package ability get ID of inserted record
|
|
func (fr *FakeResult) LastInsertId() (int64, error) {
|
|
return fr.insertID, nil
|
|
}
|
|
|
|
// RowsAffected returns the number of rows affected
|
|
func (fr *FakeResult) RowsAffected() (int64, error) {
|
|
return fr.rowsAffected, nil
|
|
}
|