Release v1.20.0
✨ Features
- Support for Solr
Solr can now be used as a datasource, for adding Solr useAddSolr(cfg Solr.Config)method of gofrApp.
Refer documentation for detailed info.
Supported Functionalities are:Search(ctx context.Context, collection string, params map[string]any) (any, error) Create(ctx context.Context, collection string, document *bytes.Buffer, params map[string]any) (any, error) Update(ctx context.Context, collection string, document *bytes.Buffer, params map[string]any) (any, error) Delete(ctx context.Context, collection string, document *bytes.Buffer, params map[string]any) (any, error) Retrieve(ctx context.Context, collection string, params map[string]any) (any, error) ListFields(ctx context.Context, collection string, params map[string]any) (any, error) AddField(ctx context.Context, collection string, document *bytes.Buffer) (any, error) UpdateField(ctx context.Context, collection string, document *bytes.Buffer) (any, error) DeleteField(ctx context.Context, collection string, document *bytes.Buffer) (any, error)
🛠 Enhancements
- Added mocks for HTTP Service
Mocks to test GoFr HTTP client had to be generated manually. Now, mocks for the HTTP service has been added in GoFr'sMockContainer.Usage:
// register HTTP services to be mocked httpservices := []string{"cat-facts", "cat-facts1", "cat-facts2"} // pass the httpservices in NewMockContainer _, mock := NewMockContainer(t, WithMockHTTPService(httpservices...)) // Set mock expectations using the mocks from NewMockContainer mock.HTTPService.EXPECT().Get(context.Background(), "fact",map[string]interface{}{ "max_length": 20, }).Return(result, nil) // Call to your function where HTTPService has to be mocked . . .