github gofr-dev/gofr v1.38.0

latest releases: v1.46.3, v1.46.2, v1.46.1...
6 months ago

Release - v1.38.0

🚀 Features

Elasticsearch Integration Support

  • GoFr now supports Elasticsearch as a pluggable data source with a standard interface for document indexing, searching, and cluster management.

  • Developers can inject any compatible Elasticsearch client that implements the following interface:

    type Elasticsearch interface {
        Connect()
        CreateIndex(ctx context.Context, index string, settings map[string]any) error 
        DeleteIndex(ctx context.Context, index string) error 
        IndexDocument(ctx context.Context, index, id string, document any) error 
        GetDocument(ctx context.Context, index, id string) (map[string]any, error)
        UpdateDocument(ctx context.Context, index, id string, update map[string]any) error 
        DeleteDocument(ctx context.Context, index, id string) error 
        Search(ctx context.Context, indices []string, query map[string]any) (map[string]any, error)
        Bulk(ctx context.Context, operations []map[string]any) (map[string]any, error)
        HealthChecker
    }
  • Official GoFr-compatible driver is available via:

    go get gofr.dev/pkg/gofr/datasource/elasticsearch@latest
    
  • Example usage in your main.go:

    func main (){
    	    app := gofr.New()
    	    
    		es := elasticsearch.New(elasticsearch.Config{
    	        Addresses: []string{"http://localhost:9200"},
    	        Username: "elastic",
    	        Password: "changeme",
    	    })
    
    	    app.AddElasticsearch(es)
    	    
    		app.Run ()
    }
  • Checkout our official documentation for more details.

Don't miss a new gofr release

NewReleases is sending notifications on new releases.