Example #1
0
// parseFilterParam takes the basic configuration and generates a filter parameter.
func (q *Query) parseFilterParam(paramName, remainingKeyData, value string) (*definition.Parameter, error) {
	remainingDataMatches := fieldFilter.FindStringSubmatch(remainingKeyData)
	operation := defaultOperation
	possibleRemainingAlias := ""
	if remainingDataMatches != nil {
		operation = remainingDataMatches[1]
		possibleRemainingAlias = remainingDataMatches[2]
	}
	remainingAliasMatches := fieldFilter.FindStringSubmatch(possibleRemainingAlias)
	alias := paramName
	if remainingAliasMatches != nil {
		alias = remainingAliasMatches[1]
	}
	parameter := definition.NewParameter(alias)
	parameter.Name = paramName
	parameter.Filter = q.getFilter(operation)
	parameter.Value = value
	if parameter.Filter == nil {
		return nil, NewUnsupportedOperation(operation)
	}

	return parameter, nil
}
Example #2
0
func (c *current) onTerm1() (interface{}, error) {
	name := strings.TrimSpace(string(c.text))
	return definition.NewParameter(name), nil
}