Comments (4)
Hi @arjunadeltoso,
Thanks for reporting this. The foreach is implemented using opApply with the following signature :
int opApply(int delegate(ulong k, Response value) dg)
The key is required. For now, you'll need to implement your foreach loops as foreach(k, v; redis_vals)
to get it to run. I'll move to a range based implementation in a future release.
And yes, the doc should say foreach
from tiny-redis.
Thanks for the reply, yeah wasn't sure if
foreach(_, fruit; fruits)
writeln(fruit)
was the correct approach or if I needed to overload opApply
in response.d
to take care of the values only iteration case (I've quickly tried it but with no success, just starting with D).
from tiny-redis.
That's correct. I've overloaded opApply in master to allow foreach without key declarations. I need to mull over making it into range before my next release. This one's a quick patch, but it closes the issue. I will close this ticket in my next release.
And the docs are fixed.
from tiny-redis.
https://github.com/adilbaig/Tiny-Redis/releases/tag/v2.0.2
from tiny-redis.
Related Issues (20)
- Dub package HOT 1
- Op cast failure for EXISTS HOT 2
- Hangs on empty string responses HOT 1
- Add SUBSCRIBE command support HOT 5
- New version for pubsub support HOT 2
- Push new version to code.dlang.org
- Test cases fail on older gdc versions (4.9.0, dmdfe 2.065) HOT 5
- Is there any way to close a redis connection? HOT 4
- PubSub example on https://github.com/adilbaig/Tiny-Redis has some bugs
- Please provide an example how to pub sub in a non busy loop way
- Do not work with SCAN HOT 1
- `SCAN` very strange issue HOT 1
- Dub release HOT 2
- build on Windows package tinyredis-2.1.1 Error: undefined identifier `EWOULDBLOCK` dmd failed with exit code 1 HOT 1
- Error on template instance HOT 3
- Error and semver consideration HOT 1
- TLS support missing HOT 1
- Typos in web page example html (not in repo itself) HOT 3
- binary strings HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tiny-redis.