feat(sqlx): support for custom Acceptable function (#3405)
This commit is contained in:
@@ -32,7 +32,5 @@ func mysqlAcceptable(err error) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func withMysqlAcceptable() SqlOption {
|
func withMysqlAcceptable() SqlOption {
|
||||||
return func(conn *commonSqlConn) {
|
return WithAcceptable(mysqlAcceptable)
|
||||||
conn.accept = mysqlAcceptable
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -399,3 +399,11 @@ func (s statement) QueryRowsPartialCtx(ctx context.Context, v any, args ...any)
|
|||||||
return unmarshalRows(v, rows, false)
|
return unmarshalRows(v, rows, false)
|
||||||
}, s.query, args...)
|
}, s.query, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithAcceptable returns a SqlOption that setting the acceptable function.
|
||||||
|
// acceptable is the func to check if the error can be accepted.
|
||||||
|
func WithAcceptable(acceptable func(err error) bool) SqlOption {
|
||||||
|
return func(conn *commonSqlConn) {
|
||||||
|
conn.accept = acceptable
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user