github.com/turingchain2020/turingchain@v1.1.21/common/db/mocks/db.go (about) 1 // Code generated by mockery v1.0.0. DO NOT EDIT. 2 3 package mocks 4 5 import ( 6 db "github.com/turingchain2020/turingchain/common/db" 7 lru "github.com/hashicorp/golang-lru" 8 9 mock "github.com/stretchr/testify/mock" 10 ) 11 12 // DB is an autogenerated mock type for the DB type 13 type DB struct { 14 mock.Mock 15 } 16 17 // Begin provides a mock function with given fields: 18 func (_m *DB) Begin() { 19 _m.Called() 20 } 21 22 // BeginTx provides a mock function with given fields: 23 func (_m *DB) BeginTx() (db.TxKV, error) { 24 ret := _m.Called() 25 26 var r0 db.TxKV 27 if rf, ok := ret.Get(0).(func() db.TxKV); ok { 28 r0 = rf() 29 } else { 30 if ret.Get(0) != nil { 31 r0 = ret.Get(0).(db.TxKV) 32 } 33 } 34 35 var r1 error 36 if rf, ok := ret.Get(1).(func() error); ok { 37 r1 = rf() 38 } else { 39 r1 = ret.Error(1) 40 } 41 42 return r0, r1 43 } 44 45 // Close provides a mock function with given fields: 46 func (_m *DB) Close() { 47 _m.Called() 48 } 49 50 // Commit provides a mock function with given fields: 51 func (_m *DB) Commit() error { 52 ret := _m.Called() 53 54 var r0 error 55 if rf, ok := ret.Get(0).(func() error); ok { 56 r0 = rf() 57 } else { 58 r0 = ret.Error(0) 59 } 60 61 return r0 62 } 63 64 // CompactRange provides a mock function with given fields: start, limit 65 func (_m *DB) CompactRange(start []byte, limit []byte) error { 66 ret := _m.Called(start, limit) 67 68 var r0 error 69 if rf, ok := ret.Get(0).(func([]byte, []byte) error); ok { 70 r0 = rf(start, limit) 71 } else { 72 r0 = ret.Error(0) 73 } 74 75 return r0 76 } 77 78 // Delete provides a mock function with given fields: _a0 79 func (_m *DB) Delete(_a0 []byte) error { 80 ret := _m.Called(_a0) 81 82 var r0 error 83 if rf, ok := ret.Get(0).(func([]byte) error); ok { 84 r0 = rf(_a0) 85 } else { 86 r0 = ret.Error(0) 87 } 88 89 return r0 90 } 91 92 // DeleteSync provides a mock function with given fields: _a0 93 func (_m *DB) DeleteSync(_a0 []byte) error { 94 ret := _m.Called(_a0) 95 96 var r0 error 97 if rf, ok := ret.Get(0).(func([]byte) error); ok { 98 r0 = rf(_a0) 99 } else { 100 r0 = ret.Error(0) 101 } 102 103 return r0 104 } 105 106 // Get provides a mock function with given fields: key 107 func (_m *DB) Get(key []byte) ([]byte, error) { 108 ret := _m.Called(key) 109 110 var r0 []byte 111 if rf, ok := ret.Get(0).(func([]byte) []byte); ok { 112 r0 = rf(key) 113 } else { 114 if ret.Get(0) != nil { 115 r0 = ret.Get(0).([]byte) 116 } 117 } 118 119 var r1 error 120 if rf, ok := ret.Get(1).(func([]byte) error); ok { 121 r1 = rf(key) 122 } else { 123 r1 = ret.Error(1) 124 } 125 126 return r0, r1 127 } 128 129 // GetCache provides a mock function with given fields: 130 func (_m *DB) GetCache() *lru.ARCCache { 131 ret := _m.Called() 132 133 var r0 *lru.ARCCache 134 if rf, ok := ret.Get(0).(func() *lru.ARCCache); ok { 135 r0 = rf() 136 } else { 137 if ret.Get(0) != nil { 138 r0 = ret.Get(0).(*lru.ARCCache) 139 } 140 } 141 142 return r0 143 } 144 145 // Iterator provides a mock function with given fields: start, end, reserver 146 func (_m *DB) Iterator(start []byte, end []byte, reserver bool) db.Iterator { 147 ret := _m.Called(start, end, reserver) 148 149 var r0 db.Iterator 150 if rf, ok := ret.Get(0).(func([]byte, []byte, bool) db.Iterator); ok { 151 r0 = rf(start, end, reserver) 152 } else { 153 if ret.Get(0) != nil { 154 r0 = ret.Get(0).(db.Iterator) 155 } 156 } 157 158 return r0 159 } 160 161 // NewBatch provides a mock function with given fields: sync 162 func (_m *DB) NewBatch(sync bool) db.Batch { 163 ret := _m.Called(sync) 164 165 var r0 db.Batch 166 if rf, ok := ret.Get(0).(func(bool) db.Batch); ok { 167 r0 = rf(sync) 168 } else { 169 if ret.Get(0) != nil { 170 r0 = ret.Get(0).(db.Batch) 171 } 172 } 173 174 return r0 175 } 176 177 // Print provides a mock function with given fields: 178 func (_m *DB) Print() { 179 _m.Called() 180 } 181 182 // Rollback provides a mock function with given fields: 183 func (_m *DB) Rollback() { 184 _m.Called() 185 } 186 187 // Set provides a mock function with given fields: key, value 188 func (_m *DB) Set(key []byte, value []byte) error { 189 ret := _m.Called(key, value) 190 191 var r0 error 192 if rf, ok := ret.Get(0).(func([]byte, []byte) error); ok { 193 r0 = rf(key, value) 194 } else { 195 r0 = ret.Error(0) 196 } 197 198 return r0 199 } 200 201 // SetCacheSize provides a mock function with given fields: size 202 func (_m *DB) SetCacheSize(size int) { 203 _m.Called(size) 204 } 205 206 // SetSync provides a mock function with given fields: _a0, _a1 207 func (_m *DB) SetSync(_a0 []byte, _a1 []byte) error { 208 ret := _m.Called(_a0, _a1) 209 210 var r0 error 211 if rf, ok := ret.Get(0).(func([]byte, []byte) error); ok { 212 r0 = rf(_a0, _a1) 213 } else { 214 r0 = ret.Error(0) 215 } 216 217 return r0 218 } 219 220 // Stats provides a mock function with given fields: 221 func (_m *DB) Stats() map[string]string { 222 ret := _m.Called() 223 224 var r0 map[string]string 225 if rf, ok := ret.Get(0).(func() map[string]string); ok { 226 r0 = rf() 227 } else { 228 if ret.Get(0) != nil { 229 r0 = ret.Get(0).(map[string]string) 230 } 231 } 232 233 return r0 234 }