A dumb little SQL engine.

I wrote a little SQL engine, based on ideas floating around head. Maybe one day I will write a bit more.

Features etc

The big thing missing is a parser for SQL itself.

Key interface: iterable

type iterable interface {
  next(context.Context) (*row, error)
}

This is used by each operation (select, group by, order by etc) to provide a new row of results to the calling operation. For example, where would call next on its source until it gets a row matching the where clause, then it would return that row to the caller.

A errStop is called on there being no more rows to return.

Key interface: expr

type expr interface {
  value(r *row) (interface{}, typ, error)
}

This is used to evaluate different expressions in the context of a single row. Example expressios:

Expressions are currently

CSV

CSV is an iterable, using a CSF file as the source for the data. Its lame, but works.