func (pages *Pages) QueryNumberRangeInclusive(field string, start, end interface{}, startInc bool, endInc bool) *Pages { var fstart *float64 = nil var fend *float64 = nil if start != nil { if f, err := cast.ToFloat64E(start); err == nil { fstart = &f } } if end != nil { if f, err := cast.ToFloat64E(end); err == nil { fend = &f } } q := bleve.NewNumericRangeInclusiveQuery(fstart, fend, &startInc, &endInc) q.SetField(field) pages.queries = append(pages.queries, q) pages.clear() return pages }
func (bc BoltCoder) Decode(value []byte) (interface{}, error) { if len(value) == 0 { return nil, fmt.Errorf("bytes len zero") } switch value[0] { case value_nil: return nil, nil case value_bool: if value[1] == 1 { return true, nil } return false, nil case value_number: f, err := cast.ToFloat64E(string(value[1:])) if err != nil { return nil, err } return f, nil case value_duration: f, err := cast.ToFloat64E(string(value[1:])) if err != nil { return nil, err } return time.Duration(f), nil case value_datetime: tm := &time.Time{} if err := tm.UnmarshalBinary(value[1:]); err != nil { return nil, err } return *tm, nil case value_string: return string(value[1:]), nil case value_bytes: return value[1:], nil } return nil, nil }