So from what I gather is you would like a simple wrapper around node-promise-mysql library so that you can use it the same way with createPool and createConnection, with validation checks around this. Is there specific validations you want for this e.g. specific validation queries, validation frequency etc or would it all be configurable. Also is there a specific testing framework you would like to use?
I would suggest a validator config option to be passed into the createPool function. This validator could look something like this:
validator = {
//the query to be executed on validation
validation_query: "Select 1",
//how to determine the validation was successful based on the query response
validation_predicate: function(response) { response === 1 },
//other configurables retries, frequency etc
}
I would need to have a proper look at the problem in action though to determine if this would be the best approach. Obviously you don't want to execute this on every query as it would generate overhead, if I could see the problem in action I would be able to figure out an optimal case for performing validation