Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduced Runner API for cleaner client embedding #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions session.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ import (
"time"
)


type Runner interface {
Run(query Exp) *Rows
}

// Session represents a connection to a server, use it to run queries against a
// database, with either sess.Run(query) or query.Run(session). Do not share a
// session between goroutines, create a new one for each goroutine.
Expand Down Expand Up @@ -180,6 +185,6 @@ func (s *Session) getContext() context {

// Run runs a query using the given session, there is one Run()
// method for each type of query.
func (e Exp) Run(session *Session) *Rows {
return session.Run(e)
func (e Exp) Run(runner Runner) *Rows {
return runner.Run(e)
}