@@ -3,7 +3,6 @@ package db
33import (
44 "context"
55 "database/sql"
6- "errors"
76 "reflect"
87
98 "github.com/letsencrypt/borp"
@@ -93,60 +92,3 @@ type Rows[T any] interface {
9392 Err () error
9493 Close () error
9594}
96-
97- // MockSqlExecutor implement SqlExecutor by returning errors from every call.
98- //
99- // TODO: To mock out WithContext, we needed to be able to return objects that satisfy
100- // borp.SqlExecutor. That's a pretty big interface, so we specify one no-op mock
101- // that we can embed everywhere we need to satisfy it.
102- // Note: MockSqlExecutor does *not* implement WithContext. The expectation is
103- // that structs that embed MockSqlExecutor will define their own WithContext
104- // that returns a reference to themselves. That makes it easy for those structs
105- // to override the specific methods they need to implement (e.g. SelectOne).
106- type MockSqlExecutor struct {}
107-
108- func (mse MockSqlExecutor ) Get (ctx context.Context , i any , keys ... any ) (any , error ) {
109- return nil , errors .New ("unimplemented" )
110- }
111- func (mse MockSqlExecutor ) Insert (ctx context.Context , list ... any ) error {
112- return errors .New ("unimplemented" )
113- }
114- func (mse MockSqlExecutor ) Update (ctx context.Context , list ... any ) (int64 , error ) {
115- return 0 , errors .New ("unimplemented" )
116- }
117- func (mse MockSqlExecutor ) Delete (ctx context.Context , list ... any ) (int64 , error ) {
118- return 0 , errors .New ("unimplemented" )
119- }
120- func (mse MockSqlExecutor ) ExecContext (ctx context.Context , query string , args ... any ) (sql.Result , error ) {
121- return nil , errors .New ("unimplemented" )
122- }
123- func (mse MockSqlExecutor ) Select (ctx context.Context , i any , query string , args ... any ) ([]any , error ) {
124- return nil , errors .New ("unimplemented" )
125- }
126- func (mse MockSqlExecutor ) SelectInt (ctx context.Context , query string , args ... any ) (int64 , error ) {
127- return 0 , errors .New ("unimplemented" )
128- }
129- func (mse MockSqlExecutor ) SelectNullInt (ctx context.Context , query string , args ... any ) (sql.NullInt64 , error ) {
130- return sql.NullInt64 {}, errors .New ("unimplemented" )
131- }
132- func (mse MockSqlExecutor ) SelectFloat (ctx context.Context , query string , args ... any ) (float64 , error ) {
133- return 0 , errors .New ("unimplemented" )
134- }
135- func (mse MockSqlExecutor ) SelectNullFloat (ctx context.Context , query string , args ... any ) (sql.NullFloat64 , error ) {
136- return sql.NullFloat64 {}, errors .New ("unimplemented" )
137- }
138- func (mse MockSqlExecutor ) SelectStr (ctx context.Context , query string , args ... any ) (string , error ) {
139- return "" , errors .New ("unimplemented" )
140- }
141- func (mse MockSqlExecutor ) SelectNullStr (ctx context.Context , query string , args ... any ) (sql.NullString , error ) {
142- return sql.NullString {}, errors .New ("unimplemented" )
143- }
144- func (mse MockSqlExecutor ) SelectOne (ctx context.Context , holder any , query string , args ... any ) error {
145- return errors .New ("unimplemented" )
146- }
147- func (mse MockSqlExecutor ) QueryContext (ctx context.Context , query string , args ... any ) (* sql.Rows , error ) {
148- return nil , errors .New ("unimplemented" )
149- }
150- func (mse MockSqlExecutor ) QueryRowContext (ctx context.Context , query string , args ... any ) * sql.Row {
151- return nil
152- }
0 commit comments