cloudsearch helper
$ go get github.com/ushios/cloudsearchhelper
when create documents
Cloudsearch date field's format using RFC3339 (see detail).
This Time
return UTC RFC3339 string when MarshalJSON.
example here
now, _ := time.Parse(time.RFC3339, "2006-01-02T15:04:05+07:00")
e := Event{
Name: "This is some event",
StartAt: cloudsearchhelper.Time(now),
}
j, _ := json.Marshal(e)
fmt.Println(string(j))
// Output: {"Name":"This is some event","StartAt":"2006-01-02T08:04:05Z"}
example here
category := &cloudsearchhelper.Prefix{
Field: "category",
Value: "movie",
}
title := &cloudsearchhelper.Phrase{
Field: "title",
Value: "star",
}
and := cloudsearchhelper.And(&[]cloudsearchhelper.Queryer{
category,
title,
})
qs, _ := and.QueryString()
fmt.Println(qs)
// Output: (and (prefix field='category' 'movie' )(phrase field='title' 'star' )))