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

Consider changing start/endkey behavior #975

Closed
flimzy opened this issue May 19, 2024 · 0 comments · Fixed by #976
Closed

Consider changing start/endkey behavior #975

flimzy opened this issue May 19, 2024 · 0 comments · Fixed by #976
Milestone

Comments

@flimzy
Copy link
Member

flimzy commented May 19, 2024

At present, one must pass a valid JSON object value as a endkey or startkey value (same applies to other related keys). Example:

func ExampleDB_Query() {
	rs := db.Query(context.TODO(), "_design/foo", "_view/bar", kivik.Params(map[string]interface{}{
		"startkey": `"foo"`,                           // Quotes are necessary so the
		"endkey":   `"foo` + kivik.EndKeySuffix + `"`, // key is a valid JSON object
	}))

Consider whether to change this behavior, to simply json-encode whatever value is passed, including a string. This would allow passing foo, which would then be encoded to "foo". We already support passing a json.RawMessage() value, or passing complex values, which get marshaled. So it might be more consistent this way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant