• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

yarpc / yarpc-go / 1881 / 3
81%
master: %

Build:
Build:
LAST BUILD BRANCH: nooptrace
DEFAULT BRANCH: master
Ran 06 Oct 2016 05:24PM UTC
Files 95
Run time 12s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

06 Oct 2016 05:19PM UTC coverage: 92.686% (+0.07%) from 92.612%
TYPE=test

push

travis-ci

web-flow
yarpc.InjectClients: automatic client injection (#371)

This implements `yarpc.InjectClients` which provides a mechanism to
automatically fill clients into structs from a Dispatcher.

```go
type myHandler struct {
    Cache cacheclient.Interface `service:"memcached"`
}

var handler myHandler
yarpc.InjectClients(dispatcher, &handler)

// Is equivalent to

handler = myHandler{
    Cache: cacheclient.New(dispatcher.Channel("memcached")),
}
```

A global map of types and their constructors is maintained and reflection is
used to fill the target struct with clients. `{json, raw}.Client`s are
registered into that map by default and generated Thrift clients register
themselves into the map in `init()`.

Note that as suggested in the original issue, this DOES NOT recursively walk
the object tree, and only updates the fields in the top-level object. This
makes this feature less surprising and drops any concerns around
instantiating/modifying user-owned objects.

Resolves #330

4321 of 4662 relevant lines covered (92.69%)

0.98 hits per line

Source Files on job 1881.3 (TYPE=test)
  • Tree
  • List 0
  • Changed 3
  • Source Changed 2
  • Coverage Changed 3
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 1881
  • Travis Job 1881.3
  • 3a201e8b on github
  • Prev Job for TYPE=test on dev (#1860.4)
  • Next Job for TYPE=test on dev (#1892.4)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc