github.com/go-kivik/kivik/v4@v4.3.2/mockdb/db.go (about) 1 // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 // use this file except in compliance with the License. You may obtain a copy of 3 // the License at 4 // 5 // http://www.apache.org/licenses/LICENSE-2.0 6 // 7 // Unless required by applicable law or agreed to in writing, software 8 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 // License for the specific language governing permissions and limitations under 11 // the License. 12 13 package mockdb 14 15 import ( 16 "github.com/go-kivik/kivik/v4/driver" 17 ) 18 19 type driverDB struct { 20 *DB 21 } 22 23 var ( 24 _ driver.DB = &driverDB{} 25 _ driver.BulkGetter = &driverDB{} 26 _ driver.Finder = &driverDB{} 27 ) 28 29 func (db *driverDB) Close() error { 30 expected := &ExpectedDBClose{ 31 commonExpectation: commonExpectation{db: db.DB}, 32 } 33 if err := db.client.nextExpectation(expected); err != nil { 34 return err 35 } 36 if expected.callback != nil { 37 return expected.callback() 38 } 39 return expected.err 40 }