Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Ranges #7

Merged
merged 3 commits into from
Mar 13, 2017
Merged

Custom Ranges #7

merged 3 commits into from
Mar 13, 2017

Conversation

mattevans
Copy link
Collaborator

This introduces custom ranges.

An example:

query := &Query{
		Metrics: []Metric{
			{Type: "count", Field: "salary"},
		},
		Bucket: &Bucket{
			Field: &Field{
				Name: "location",
				Type: "string",
			},
			Sort: &SortOptions{
				Type: "alphabetical",
			},
			Bucket: &Bucket{
				Field: &Field{
					Name: "salary",
					Type: "number",
				},
				RangeOptions: &RangeBucketOptions{
					Period: []interface{}{
						20000,
						50000,
						100000,
						150000,
						200000,
						300000,
					},
				},
				Sort: &SortOptions{
					Type: "numerical",
					Desc: false,
				},
			},
		},
	}

As part of this, I've also added a numerical sorter, which helps in returning the custom range results in desired order.

@mattevans mattevans self-assigned this Mar 13, 2017
@mattevans mattevans requested a review from snikch March 13, 2017 02:02
@snikch
Copy link
Owner

snikch commented Mar 13, 2017

Sweet, just an FYI I've got some other contract work that I'm trying to get finished - probably done tonight, then I'll be on this stuff and the worker stuff 👌 .

@mattevans
Copy link
Collaborator Author

Cheers mate! 🍻

@mattevans mattevans closed this Mar 13, 2017
@mattevans mattevans reopened this Mar 13, 2017
@mattevans mattevans merged commit c22d97f into master Mar 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants