/
fakerdb.go
80 lines (63 loc) · 2.61 KB
/
fakerdb.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package test
import (
"math/big"
"github.com/crypto-com/chain-indexing/appinterface/rdb"
)
type FakeRDbConn struct{}
func NewFakeRDbConn() *FakeRDbConn {
return &FakeRDbConn{}
}
func (conn *FakeRDbConn) Begin() (rdb.Tx, error) {
return &FakeRDbTx{}, nil
}
func (conn *FakeRDbConn) Exec(sql string, args ...interface{}) (rdb.ExecResult, error) {
return &FakeRDbExecResult{}, nil
}
func (conn *FakeRDbConn) Query(sql string, args ...interface{}) (rdb.RowsResult, error) {
return &FakeRDbRowsResult{}, nil
}
func (conn *FakeRDbConn) QueryRow(sql string, args ...interface{}) rdb.RowResult {
return &FakeRDbRowResult{}
}
func (conn *FakeRDbConn) ToHandle() *rdb.Handle { return nil }
type FakeRDbTx struct{}
func (tx *FakeRDbTx) Exec(sql string, args ...interface{}) (rdb.ExecResult, error) {
return &FakeRDbExecResult{}, nil
}
func (tx *FakeRDbTx) Query(sql string, args ...interface{}) (rdb.RowsResult, error) {
return &FakeRDbRowsResult{}, nil
}
func (tx *FakeRDbTx) QueryRow(sql string, args ...interface{}) rdb.RowResult {
return &FakeRDbRowResult{}
}
func (tx *FakeRDbTx) Commit() error { return nil }
func (tx *FakeRDbTx) Rollback() error { return nil }
func (tx *FakeRDbTx) ToHandle() *rdb.Handle { return nil }
type FakeRDbRowsResult struct{}
func (result *FakeRDbRowsResult) Close() {}
func (result *FakeRDbRowsResult) Err() error { return nil }
func (result *FakeRDbRowsResult) ExecResult() rdb.ExecResult {
return &FakeRDbExecResult{}
}
func (result *FakeRDbRowsResult) Next() bool { return false }
func (result *FakeRDbRowsResult) Scan(dest ...interface{}) error { return nil }
type FakeRDbExecResult struct{}
func (result *FakeRDbExecResult) RowsAffected() int64 { return 0 }
func (result *FakeRDbExecResult) IsInsert() bool { return false }
func (result *FakeRDbExecResult) IsUpdate() bool { return false }
func (result *FakeRDbExecResult) IsDelete() bool { return false }
func (result *FakeRDbExecResult) IsSelect() bool { return false }
func (result *FakeRDbExecResult) String() string { return "" }
type FakeRDbRowResult struct{}
func (result *FakeRDbRowResult) Scan(dest ...interface{}) error { return nil }
type FakeRDbTypeConv struct{}
func (conv *FakeRDbTypeConv) Bton(bigInt *big.Int) interface{} { return nil }
func (conv *FakeRDbTypeConv) Iton(i int) interface{} { return nil }
func (conv *FakeRDbTypeConv) NtobReader() rdb.NtobReader {
return &FakeRDbNtobReader{}
}
type FakeRDbNtobReader struct{}
func (reader *FakeRDbNtobReader) ScannableArg() interface{} { return nil }
func (reader *FakeRDbNtobReader) Parse() (*big.Int, error) {
return nil, nil
}