Documentation ¶
Index ¶
Constants ¶
const AND = 57360
const COLUMN = 57353
const FROM = 57347
const GE = 57362
const IDENT = 57357
const INTO = 57356
const LABEL = 57354
const LE = 57363
const LIMIT = 57349
const NOT = 57364
const NUMBER = 57358
const OR = 57361
const POWER = 57365
const PREDICT = 57351
const SELECT = 57346
const STRING = 57359
const TRAIN = 57350
const UMINUS = 57366
const USING = 57355
const WHERE = 57348
const WITH = 57352
Variables ¶
var ErrClosedPipe = errors.New("pipe: write on closed pipe")
Functions ¶
func Pipe ¶
func Pipe() (*PipeReader, *PipeWriter)
Pipe creates a synchronous in-memory pipe.
It is safe to call Read and Write in parallel with each other or with Close. Parallel calls to Read and parallel calls to Write are also safe: the individual calls will be gated sequentially.
Types ¶
type DB ¶
DB extends sql.DB
type PipeReader ¶
type PipeReader struct {
// contains filtered or unexported fields
}
PipeReader reads real data
func Run ¶
func Run(slct string, db *DB) *PipeReader
Run executes a SQL query and returns a stream of row or message
func (*PipeReader) Close ¶
func (r *PipeReader) Close()
Close closes the reader; subsequent writes to the
func (*PipeReader) ReadAll ¶
func (r *PipeReader) ReadAll() chan interface{}
ReadAll returns the data chan. The caller should use it as `for r := range pr.ReadAll()`
type PipeWriter ¶
type PipeWriter struct {
// contains filtered or unexported fields
}
PipeWriter writes real data
func (*PipeWriter) Close ¶
func (w *PipeWriter) Close()
Close closes the writer; subsequent ReadAll from the read half of the pipe will return a closed channel.
func (*PipeWriter) Write ¶
func (w *PipeWriter) Write(item interface{}) error
Write writes the item to the underlying data stream. It returns ErrClosedPipe when the data stream is closed.