func BuildSelect(table string, where map[string]interface{}, selectField []string) (cond string, vals []interface{}, err error) {
	var orderBy string
	var limit *eleLimit
	var groupBy string
	var having map[string]interface{}
	var lockMode string
	if val, ok := where["_orderby"]; ok {
		s, ok := val.(string)
		if !ok {
			err = errOrderByValueType
			return
		}
		orderBy = strings.TrimSpace(s)
	}
	if val, ok := where["_groupby"]; ok {
		s, ok := val.(string)
		if !ok {
			err = errGroupByValueType
			return
		}
		groupBy = strings.TrimSpace(s)
		if "" != groupBy {
			if h, ok := where["_having"]; ok {
				having, err = resolveHaving(h)
				if nil != err {
					return
				}
			}
		}
	}
	if val, ok := where["_limit"]; ok {
		arr, ok := val.([]uint)
		if !ok {
			err = errLimitValueType
			return
		}
		if len(arr) != 2 {
			if len(arr) == 1 {
				arr = []uint{0, arr[0]}
			} else {
				err = errLimitValueLength
				return
			}
		}
		begin, step := arr[0], arr[1]
		limit = &eleLimit{
			begin: begin,
			step:  step,
		}
	}
	if val, ok := where["_lockMode"]; ok {
		s, ok := val.(string)
		if !ok {
			err = errLockModeValueType
			return
		}
		lockMode = strings.TrimSpace(s)
		if _, ok := allowedLockMode[lockMode]; !ok {
			err = errNotAllowedLockMode
			return
		}
	}
	conditions, err := getWhereConditions(where, defaultIgnoreKeys)
	if nil != err {
		return
	}
	if having != nil {
		havingCondition, err1 := getWhereConditions(having, defaultIgnoreKeys)
		if nil != err1 {
			err = err1
			return
		}
		conditions = append(conditions, nilComparable(0))
		conditions = append(conditions, havingCondition...)
	}
	return buildSelect(table, selectField, groupBy, orderBy, lockMode, limit, conditions...)
}
BuildSelect work as its name says.
supported operators including: =,in,>,>=,<,<=,<>,!=.
key without operator will be regarded as =.
special key begin with _: _orderby,_groupby,_limit,_having.
the value of _limit must be a slice whose type should be []uint and must contain two uints(ie: []uint{0, 100}).
the value of _having must be a map just like where but only support =,in,>,>=,<,<=,<>,!=
for more examples,see README.md or open a issue.
package builder
import (
	"errors"
	"fmt"
	"reflect"
	"regexp"
	"strings"
)
var (
	errSplitEmptyKey = errors.New("[builder] couldn't split a empty string")
	ErrUnsupportedOperator       = errors.New("[builder] unsupported operator")
	errOrValueType               = errors.New(`[builder] the value of "_or" must be of slice of map[string]interface{} type`)
	errOrderByValueType          = errors.New(`[builder] the value of "_orderby" must be of string type`)
	errGroupByValueType          = errors.New(`[builder] the value of "_groupby" must be of string type`)
	errLimitValueType            = errors.New(`[builder] the value of "_limit" must be of []uint type`)
	errLimitValueLength          = errors.New(`[builder] the value of "_limit" must contain one or two uint elements`)
	errHavingValueType           = errors.New(`[builder] the value of "_having" must be of map[string]interface{}`)
	errHavingUnsupportedOperator = errors.New(`[builder] "_having" contains unsupported operator`)
	errLockModeValueType         = errors.New(`[builder] the value of "_lockMode" must be of string type`)
	errNotAllowedLockMode        = errors.New(`[builder] the value of "_lockMode" is not allowed`)
	errUpdateLimitType           = errors.New(`[builder] the value of "_limit" in update query must be one of int,uint,int64,uint64`)
	errWhereInterfaceSliceType = `[builder] the value of "xxx %s" must be of []interface{} type`
	errEmptySliceCondition     = `[builder] the value of "%s" must contain at least one element`
	defaultIgnoreKeys = map[string]struct{}{
		"_orderby":  struct{}{},
		"_groupby":  struct{}{},
		"_having":   struct{}{},
		"_limit":    struct{}{},
		"_lockMode": struct{}{},
	}
)
type whereMapSet struct {
	set map[string]map[string]interface{}
}
func (w *whereMapSet) add(op, field string, val interface{}) {
	if nil == w.set {
		w.set = make(map[string]map[string]interface{})
	}
	s, ok := w.set[op]
	if !ok {
		s = make(map[string]interface{})
		w.set[op] = s
	}
	s[field] = val
}
type eleLimit struct {
	begin, step uint
}