From 37524a4485b736f43a10f9803608b5421bd49746 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Matczuk?= Date: Tue, 25 Jul 2017 11:13:34 +0200 Subject: [PATCH] named query compilation --- named.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/named.go b/named.go index 75fb86a..d2b3c75 100644 --- a/named.go +++ b/named.go @@ -3,16 +3,10 @@ package gocqlx import ( "bytes" "errors" - "github.com/gocql/gocql" "strconv" "unicode" ) -type Queryx struct { - *gocql.Query - names []string -} - // Allow digits and letters in bind params; additionally runes are // checked against underscores, meaning that bind params can have be // alphanumeric with underscores. Mind the difference between unicode @@ -21,7 +15,7 @@ var allowedBindRunes = []*unicode.RangeTable{unicode.Letter, unicode.Digit} // CompileNamedQuery compiles a named query into an unbound query using the // '?' bindvar and a list of names. -func CompileNamedQuery(qs []byte) (cql string, names []string, err error) { +func CompileNamedQuery(qs []byte) (stmt string, names []string, err error) { // guess number of names n := bytes.Count(qs, []byte(":")) if n == 0 { @@ -44,7 +38,7 @@ func CompileNamedQuery(qs []byte) (cql string, names []string, err error) { continue } else if inName { err = errors.New("unexpected `:` while reading named param at " + strconv.Itoa(i)) - return cql, names, err + return stmt, names, err } inName = true name = []byte{}