Add docstring to ConnectionQueryist and move interface implementation assert to immediately after struct definition.

This commit is contained in:
Nick Tobey
2023-05-22 12:36:45 -07:00
parent 49fb8908b3
commit 72b6dec169

View File

@@ -454,10 +454,13 @@ func secondsSince(start time.Time, end time.Time) float64 {
return timeDisplay
}
// ConnectionQueryist executes queries by connecting to a running mySql server.
type ConnectionQueryist struct {
connection *dbr.Connection
}
var _ cli.Queryist = ConnectionQueryist{}
func (c ConnectionQueryist) Query(ctx *sql.Context, query string) (sql.Schema, sql.RowIter, error) {
rows, err := c.connection.QueryContext(ctx, query)
if err != nil {
@@ -470,8 +473,6 @@ func (c ConnectionQueryist) Query(ctx *sql.Context, query string) (sql.Schema, s
return rowIter.Schema(), rowIter, nil
}
var _ cli.Queryist = ConnectionQueryist{}
// BuildConnectionStringQueryist returns a Queryist that connects to the server specified by the given server config. Presence in this
// module isn't ideal, but it's the only way to get the server config into the queryist.
func BuildConnectionStringQueryist(ctx context.Context, cwdFS filesys.Filesys, apr *argparser.ArgParseResults, port int, database string) (cli.LateBindQueryist, error) {