fol
github.com/zemirco/follow
go get github.com/zemirco/follow
fol

github.com/zemirco/follow

Go client for CouchDB _changes API

go get github.com/zemirco/follow
Readme

follow

Build Status GoDoc

Go client for CouchDB _changes API.

Example

package main

import "fmt"
import "github.com/zemirco/follow"

func main() {

  // set CouchDB url and database name
  follow.Url = "http://127.0.0.1:5984/"
  follow.Database = "_users"

  // set query parameters
  params := follow.QueryParameters{
    Limit: 10,
  }

  // get all changes at once
  changes, err := follow.Changes(params)
  if err != nil {
    panic(err)
  }
  fmt.Println(changes)

  // listen continuously for changes
  changes, errors := follow.Continuous(params)
  for {
    select {
      // something changed
      case change, ok := <-changes:
      fmt.Println(ok, change)
      // an error happenend
      case err := <-errors:
      panic(err)
      // stop after 5 seconds
      case <-time.After(5 * time.Second):
      fmt.Println("done")
    }
  }

}

Test

go test

License

MIT

GitHub Stars

12

LAST COMMIT

8yrs ago

MAINTAINERS

0

CONTRIBUTORS

1

OPEN ISSUES

1

OPEN PRs

1
VersionTagPublished
v0.0.0-20141122151913-8feab68faedb
1yr ago
No alternatives found
No tutorials found
Add a tutorial