|
1 | 1 | <p align="center"><a href="https://resgate.io" target="_blank" rel="noopener noreferrer"><img width="100" src="https://resgate.io/img/resgate-logo.png" alt="Resgate logo"></a></p>
|
2 | 2 | <h2 align="center"><b>RES Service for Go</b><br/>Synchronize Your Clients</h2>
|
3 | 3 | <p align="center">
|
4 |
| -<a href="http://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License"></a> |
| 4 | +<a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License"></a> |
5 | 5 | <a href="http://goreportcard.com/report/jirenius/go-res"><img src="http://goreportcard.com/badge/github.com/jirenius/go-res" alt="Report Card"></a>
|
6 | 6 | <a href="https://travis-ci.com/jirenius/go-res"><img src="https://travis-ci.com/jirenius/go-res.svg?branch=master" alt="Build Status"></a>
|
7 | 7 | <a href="https://coveralls.io/github/jirenius/go-res?branch=master"><img src="https://coveralls.io/repos/github/jirenius/go-res/badge.svg?branch=master" alt="Coverage"></a>
|
8 |
| -<a href="http://godoc.org/github.com/jirenius/go-res"><img src="https://godoc.org/github.com/jirenius/go-res?status.svg" alt="GoDoc"></a> |
| 8 | +<a href="https://pkg.go.dev/github.com/jirenius/go-res"><img src="https://img.shields.io/static/v1?label=reference&message=go.dev&color=5673ae" alt="Reference"></a> |
9 | 9 | </p>
|
10 | 10 |
|
11 | 11 | ---
|
@@ -40,31 +40,42 @@ func main() {
|
40 | 40 | s.ListenAndServe("nats://localhost:4222")
|
41 | 41 | }
|
42 | 42 | ```
|
| 43 | +> **Prerequisite** |
| 44 | +> |
| 45 | +> [Install](https://resgate.io/docs/get-started/installation/) *NATS Server* and *Resgate*. Can be done with 3 docker commands: |
| 46 | +> ```text |
| 47 | +> docker network create res |
| 48 | +> docker run -d --name nats -p 4222:4222 --net res nats |
| 49 | +> docker run --name resgate -p 8080:8080 --net res resgateio/resgate --nats nats://nats:4222 |
| 50 | +> ``` |
| 51 | +
|
43 | 52 |
|
44 | 53 | ## Examples
|
45 | 54 |
|
46 | 55 | | Example | Description
|
47 | 56 | | --- | ---
|
48 |
| -| [Edit Text](examples/edit-text/) | Text field that can be edited by multiple clients concurrently. |
49 |
| -| [Edit Text BadgerDB](examples/edit-text-badgerdb/) | Edit Text example using BadgerDB middleware to persist all changes. |
50 |
| -| [Book Collection](examples/book-collection/) | List of book titles & authors that can be edited by many. |
51 |
| -| [Book Collection BadgerDB](examples/book-collection-badgerdb/) | Book Collection example using BadgerBD middleware to persist all changes. |
| 57 | +| [Hello World](examples/01-hello-world/) | Smallest of services serving a static message. |
| 58 | +| [Edit Text](examples/02-edit-text/) | Single text field that is updated in real time. |
| 59 | +| [Edit Text Persisted](examples/03-edit-text-persisted/) | Edit Text example persisting changes using BadgerDB middleware. |
| 60 | +| [Book Collection](examples/04-book-collection/) | List of book titles & authors that can be edited by many. |
| 61 | +| [Book Collection Persisted](examples/05-book-collection-persisted/) | Book Collection example persisting changes using BadgerBD middleware. |
| 62 | +| [Search Query](examples/06-search-query/) | Make live queries against a large customer database. |
52 | 63 |
|
53 | 64 | > **Note**
|
54 | 65 | >
|
55 | 66 | > Above examples are complete with both service and client.
|
56 | 67 |
|
57 |
| -## Middleware <a href="http://godoc.org/github.com/jirenius/go-res/middleware"><img src="https://godoc.org/github.com/jirenius/go-res/middleware?status.svg" alt="GoDoc"></a> |
| 68 | +## Middleware |
58 | 69 |
|
59 |
| -The `middleware` sub-package contains middleware that adds handler functions to a `res.Handler`, to perform tasks such as: |
| 70 | +The *middleware* subfolder contains packages that adds handler functions to a `res.Handler`, to perform tasks such as: |
60 | 71 |
|
61 |
| -* storing, loading and updating persisted data |
| 72 | +* store, load and update persisted data |
62 | 73 | * synchronize changes between multiple service instances
|
63 |
| -* provide helpers for complex live queries |
| 74 | +* perform live queries with indexed searches |
64 | 75 |
|
65 |
| -| Name | Description |
66 |
| -| --- | --- |
67 |
| -| `middleware.BadgerDB` | Stores and updates resources in a BadgerDB using the events. |
| 76 | +| Name | Description | Documentation |
| 77 | +| --- | --- | --- |
| 78 | +| [resbadger](middleware/resbadger) | BadgerDB storage middleware. | <a href="https://pkg.go.dev/github.com/jirenius/go-res/middleware/resbadger"><img src="https://img.shields.io/static/v1?label=reference&message=go.dev&color=5673ae" alt="Reference"></a> |
68 | 79 |
|
69 | 80 | ## Usage
|
70 | 81 |
|
|
0 commit comments