Last active
December 29, 2015 07:18
-
-
Save AtnNn/7634640 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
r.table('lexi2').insert([ | |
{net:{lo:{tx:1, rx:2}, eth0:{tx:2, rx:4}}}, | |
{net:{lo:{tx:4, rx:6}, wl0ps4:{tx:7, rx:1}}}, | |
{net:{lo:{tx:14, rx:8}, eth0:{tx:1, rx:5}}}]) | |
r.table('lexi2').reduce( | |
function(left, right){ | |
return { net: | |
left('net').keys().setUnion(right('net').keys()).map( | |
function(iface){ | |
return [iface, | |
{tx: left('net')(iface)('tx').default(0).add(right('net')(iface)('tx').default(0))}]} | |
).coerceTo('object')}}) |
wojons
commented
Nov 25, 2013
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment