From c53efdb06fc8b7d06e36f600f80b0ce77f462a3b Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Sat, 5 Nov 2016 14:00:15 +0000 Subject: [PATCH] Define basic parameters immediately --- sql/let.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sql/let.go b/sql/let.go index 14c07003..586bc98f 100644 --- a/sql/let.go +++ b/sql/let.go @@ -49,6 +49,19 @@ func (p *parser) parseLetStatement() (stmt *LetStatement, err error) { return nil, err } + // If the defined paramater is a basic type, + // then instead of defining it at a later + // stage, convert it to that type here. + + switch stmt.What.(type) { + case bool, int64, float64, string: + p.v[stmt.Name] = stmt.What + case []interface{}, map[string]interface{}: + p.v[stmt.Name] = stmt.What + case *Null, *Void, *Empty, *Table, *Thing, *Param: + p.v[stmt.Name] = stmt.What + } + // Check that we have reached the end of the // statement with either a ';' or EOF.