Open podhmo opened 2 years ago
e.g.
# query
query package is json builder package for accessing elasticsearch, in internal use.
## SearchQuery
for search query.
```json
{
"size": "${Size:int}",
"query": {
"bool": {
"should": [
{
"match": {
"word.autocomplete": {
"query": "${Word}"
}
}
},
{
"match": {
"word.readingform": {
"query": "${Word}",
"fuzziness": "AUTO",
"operator": "and"
}
}
}
]
}
}
}
generated code like following (this is go doc output)
package query // import "m/00elasticsearch/query"
TYPES
type SearchQueryBuilder struct {
Params struct {
// Word: query
Word string `target:"${Word}"`
// Size: number of limit
Size int `target:"${Size:int}"`
}
// Has unexported fields.
}
SearchQueryBuilder for search query.
func NewSearchQueryBuilder(c *gojsontmpl.Config) *SearchQueryBuilder
func (b *SearchQueryBuilder) Size(v int) *SearchQueryBuilder
func (b *SearchQueryBuilder) ToReader() (*bytes.Buffer, error)
func (b *SearchQueryBuilder) Word(v string) *SearchQueryBuilder
and example test
handling metadata
#
header as package name##
header as builder's struct namesee also