github.com/XiaoMi/Gaea@v1.2.5/backend/mocks/ConnectionPool.go (about) 1 // Code generated by mockery v1.0.0. DO NOT EDIT. 2 3 package mocks 4 5 import ( 6 context "context" 7 8 backend "github.com/XiaoMi/Gaea/backend" 9 10 mock "github.com/stretchr/testify/mock" 11 12 time "time" 13 ) 14 15 // ConnectionPool is an autogenerated mock type for the ConnectionPool type 16 type ConnectionPool struct { 17 mock.Mock 18 } 19 20 // Active provides a mock function with given fields: 21 func (_m *ConnectionPool) Active() int64 { 22 ret := _m.Called() 23 24 var r0 int64 25 if rf, ok := ret.Get(0).(func() int64); ok { 26 r0 = rf() 27 } else { 28 r0 = ret.Get(0).(int64) 29 } 30 31 return r0 32 } 33 34 // Addr provides a mock function with given fields: 35 func (_m *ConnectionPool) Addr() string { 36 ret := _m.Called() 37 38 var r0 string 39 if rf, ok := ret.Get(0).(func() string); ok { 40 r0 = rf() 41 } else { 42 r0 = ret.Get(0).(string) 43 } 44 45 return r0 46 } 47 48 // Available provides a mock function with given fields: 49 func (_m *ConnectionPool) Available() int64 { 50 ret := _m.Called() 51 52 var r0 int64 53 if rf, ok := ret.Get(0).(func() int64); ok { 54 r0 = rf() 55 } else { 56 r0 = ret.Get(0).(int64) 57 } 58 59 return r0 60 } 61 62 // Capacity provides a mock function with given fields: 63 func (_m *ConnectionPool) Capacity() int64 { 64 ret := _m.Called() 65 66 var r0 int64 67 if rf, ok := ret.Get(0).(func() int64); ok { 68 r0 = rf() 69 } else { 70 r0 = ret.Get(0).(int64) 71 } 72 73 return r0 74 } 75 76 // Close provides a mock function with given fields: 77 func (_m *ConnectionPool) Close() { 78 _m.Called() 79 } 80 81 // Get provides a mock function with given fields: ctx 82 func (_m *ConnectionPool) Get(ctx context.Context) (backend.PooledConnect, error) { 83 ret := _m.Called(ctx) 84 85 var r0 backend.PooledConnect 86 if rf, ok := ret.Get(0).(func(context.Context) backend.PooledConnect); ok { 87 r0 = rf(ctx) 88 } else { 89 if ret.Get(0) != nil { 90 r0 = ret.Get(0).(backend.PooledConnect) 91 } 92 } 93 94 var r1 error 95 if rf, ok := ret.Get(1).(func(context.Context) error); ok { 96 r1 = rf(ctx) 97 } else { 98 r1 = ret.Error(1) 99 } 100 101 return r0, r1 102 } 103 104 // IdleClosed provides a mock function with given fields: 105 func (_m *ConnectionPool) IdleClosed() int64 { 106 ret := _m.Called() 107 108 var r0 int64 109 if rf, ok := ret.Get(0).(func() int64); ok { 110 r0 = rf() 111 } else { 112 r0 = ret.Get(0).(int64) 113 } 114 115 return r0 116 } 117 118 // IdleTimeout provides a mock function with given fields: 119 func (_m *ConnectionPool) IdleTimeout() time.Duration { 120 ret := _m.Called() 121 122 var r0 time.Duration 123 if rf, ok := ret.Get(0).(func() time.Duration); ok { 124 r0 = rf() 125 } else { 126 r0 = ret.Get(0).(time.Duration) 127 } 128 129 return r0 130 } 131 132 // InUse provides a mock function with given fields: 133 func (_m *ConnectionPool) InUse() int64 { 134 ret := _m.Called() 135 136 var r0 int64 137 if rf, ok := ret.Get(0).(func() int64); ok { 138 r0 = rf() 139 } else { 140 r0 = ret.Get(0).(int64) 141 } 142 143 return r0 144 } 145 146 // MaxCap provides a mock function with given fields: 147 func (_m *ConnectionPool) MaxCap() int64 { 148 ret := _m.Called() 149 150 var r0 int64 151 if rf, ok := ret.Get(0).(func() int64); ok { 152 r0 = rf() 153 } else { 154 r0 = ret.Get(0).(int64) 155 } 156 157 return r0 158 } 159 160 // Open provides a mock function with given fields: 161 func (_m *ConnectionPool) Open() { 162 _m.Called() 163 } 164 165 // Put provides a mock function with given fields: pc 166 func (_m *ConnectionPool) Put(pc backend.PooledConnect) { 167 _m.Called(pc) 168 } 169 170 // SetCapacity provides a mock function with given fields: capacity 171 func (_m *ConnectionPool) SetCapacity(capacity int) error { 172 ret := _m.Called(capacity) 173 174 var r0 error 175 if rf, ok := ret.Get(0).(func(int) error); ok { 176 r0 = rf(capacity) 177 } else { 178 r0 = ret.Error(0) 179 } 180 181 return r0 182 } 183 184 // SetIdleTimeout provides a mock function with given fields: idleTimeout 185 func (_m *ConnectionPool) SetIdleTimeout(idleTimeout time.Duration) { 186 _m.Called(idleTimeout) 187 } 188 189 // StatsJSON provides a mock function with given fields: 190 func (_m *ConnectionPool) StatsJSON() string { 191 ret := _m.Called() 192 193 var r0 string 194 if rf, ok := ret.Get(0).(func() string); ok { 195 r0 = rf() 196 } else { 197 r0 = ret.Get(0).(string) 198 } 199 200 return r0 201 } 202 203 // WaitCount provides a mock function with given fields: 204 func (_m *ConnectionPool) WaitCount() int64 { 205 ret := _m.Called() 206 207 var r0 int64 208 if rf, ok := ret.Get(0).(func() int64); ok { 209 r0 = rf() 210 } else { 211 r0 = ret.Get(0).(int64) 212 } 213 214 return r0 215 } 216 217 // WaitTime provides a mock function with given fields: 218 func (_m *ConnectionPool) WaitTime() time.Duration { 219 ret := _m.Called() 220 221 var r0 time.Duration 222 if rf, ok := ret.Get(0).(func() time.Duration); ok { 223 r0 = rf() 224 } else { 225 r0 = ret.Get(0).(time.Duration) 226 } 227 228 return r0 229 }