Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Sep 8, 2025. It is now read-only.
/couchdb-pythonPublic archive

Wrapper Decorator for Reduce function#323

Open
twheys wants to merge1 commit intodjc:master
base:master
Choose a base branch
Loading
fromtwheys:feature/100_reduce_decorator

Conversation

twheys
Copy link

@twheystwheys commentedJul 16, 2017
edited
Loading

Fixes#105

Added a mutator function for the ViewField decorator which allows a reduce function to be set on a ViewField using a second decorator. This is just some sugar for creation a view with a map and reduce function using an explicit syntax.

Example

class Item(Document):     sku = TextField()     color = IntegerField()     stock = ViewField('people')     @stock.map     def map(doc):         yield doc['sku'], doc     @stock.reduce     def reduce(keys, values, rereduce):         if rereduce:             yield sum(values)         else:             yield len(values)

…ich allows a reduce function to be set on a ViewField using a second decorator.
@twheystwheysforce-pushed thefeature/100_reduce_decorator branch from7dfad08 to91b61d4CompareJuly 16, 2017 21:11
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

@twheys

[8]ページ先頭

©2009-2025 Movatter.jp