Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvinmwinuka authored Jul 17, 2024
1 parent 44606ea commit a5a75ab
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,26 +93,25 @@ much more powerful. Features in the roadmap include:
# Usage (Embedded)

Install EchoVault with: `go get github.com/echovault/echovault`.
Run `go mod tidy` to pull all of EchoVault's dependencies.

Here's an example of using EchoVault as an embedded library.
You can access all of EchoVault's commands using an ergonomic API.

```go
func main() {
server, err := echovault.NewEchoVault()
server, err := echovault.NewEchoVault()

if err != nil {
log.Fatal(err)
}
if err != nil {
log.Fatal(err)
}

_, _ = server.Set("key", "Hello, world!", echovault.SETOptions{})

v, _ := server.Get("key")
fmt.Println(v) // Hello, world!
_, _, _ = server.Set("key", "Hello, world!", echovault.SETOptions{})

// (Optional): Listen for TCP connections on this EchoVault instance.
server.Start()
v, _ := server.Get("key")
fmt.Println(v) // Hello, world!

// (Optional): Listen for TCP connections on this EchoVault instance.
server.Start()
}
```

Expand Down

0 comments on commit a5a75ab

Please sign in to comment.