Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for NATS-KV (key-value) store #1452

Open
wants to merge 9 commits into
base: development
Choose a base branch
from

Conversation

vaidehiadhi
Copy link
Contributor

@vaidehiadhi vaidehiadhi commented Jan 28, 2025

Pull Request Template

Description:

  • Support for NATS Key-Value store as a new storage option in GoFr. The implementation provides a simple yet robust key-value storage solution using NATS JetStream.
  • Closes issue Add support for NATS-KV (key-value) store Add support for NATS-KV (key-value) store #1038

Breaking Changes (if applicable):

None.

Additional Information:

  • Dependencies Added:

github.com/nats-io/nats.go: Core NATS client library

Usage Example

// Initialize NATS KV client
natsClient := nats.New(nats.Configs{
    Server: "nats://localhost:4222",
    Bucket: "my-bucket",
})

// Add to GoFr app
app.AddKVStore(natsClient)

// Use in handlers
value, err := ctx.KVStore.Get(ctx, "my-key")

To Start NATS server with JetStream:
docker run -d --name nats-server -p 4222:4222 nats:latest --js

Checklist:

  • I have formatted my code using goimport and golangci-lint.
  • All new code is covered by unit tests.
  • This PR does not decrease the overall code coverage.
  • I have reviewed the code comments and documentation for clarity.

Thank you for your contribution!

@vaidehiadhi vaidehiadhi changed the title Add Add support for NATS-KV (key-value) store Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant