Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Document ¶
type Document struct { ID string `json:"id"` Source string `json:"source"` Title string `json:"title"` URL string `json:"url"` DiscountPercentage *int `json:"discount_percentage"` Price *float64 `json:"price"` Timestamp time.Time `json:"@timestamp"` }
Document wraps an offer item.
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository allows to index and search documents.
func NewRepository ¶
func NewRepository(es *elasticsearch.Client, idx string) (*Repository, error)
NewRepository constructor.
func (*Repository) Create ¶
func (s *Repository) Create(item *Document) error
Create indexes a new document into store.
func (*Repository) CreateIndex ¶
func (s *Repository) CreateIndex(mapping string) error
CreateIndex creates a new index with mapping.
type StoreConfig ¶
type StoreConfig struct { Client *elasticsearch.Client IndexName string }
StoreConfig configures the store.
Click to show internal directories.
Click to hide internal directories.