This file contains hidden or 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
    
  
  
    
  | -module(example_hook). | |
| -export([postcommit/1]). | |
| postcommit(RObj) -> | |
| {ok, Client} = riak:local_client(), | |
| ThisNode = atom_to_binary(node(), latin1), | |
| UserKey = riak_object:key(RObj), | |
| % The Users value from a riak_dt_map (Map) | 
  
    
      This file contains hidden or 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
    
  
  
    
  | user = riak_client.bucket_type('app_objects').bucket('users').get("some_user") | |
| user.registers['email'].assign("[email protected]") | |
| user.store() | |
| user.registers['email'].assign("[email protected]") | |
| user.store() | 
  
    
      This file contains hidden or 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
    
  
  
    
  | % Update Counter | |
| increment | |
| decrement | |
| {increment, 4} | |
| {decrement, 9} | |
| % Update Set | |
| {add, <<"Value">>} | |
| {add_all, [<<"Value">>]} | |
| {remove, <<"Value">>} | |
| {remove_all, <<"Value">>} | 
  
    
      This file contains hidden or 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
    
  
  
    
  | Updating History for <<”some_user”>> | |
| Users value: [{{<<”email”>>,riak_dt_lwwreg},<<”[email protected]”>>}] | |
| Users history before update: [] | |
| Updating History for <<”some_user”>> | |
| Users value: [{{<<”email”>>,riak_dt_lwwreg},<<”[email protected]”>>}] | |
| Users history before update: [{{<<”num_commits”>>,riak_dt_emcntr},1},{{<<”all_emails”>>,riak_dt_orswot},[<<”[email protected]”>>]}] | 
  
    
      This file contains hidden or 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
    
  
  
    
  | class Obj(object): | |
| def method1(self): | |
| return do_stuff(self) | |
| def method2(self): | |
| return do_other_stuff(self) | |
| def method3(self): | |
| return do_more_stuff(self) | 
  
    
      This file contains hidden or 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
    
  
  
    
  | def func1(obj): | |
| return do_stuff(obj) | |
| def func2(self): | |
| return do_other_stuff(obj) | |
| def func3(self): | |
| return do_more_stuff(obj) | |
| composed = compose( | 
  
    
      This file contains hidden or 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
    
  
  
    
  | all_securities = Security.objects.filter(company=company).for_report().iterator() | |
| class FlatData(object): | |
| pass | |
| def add_issue_date((flat, mdl)): | |
| flat.issue_date = mdl.get_issue_date() | |
| return (flat, mdl) | |
| def add_label((flat, mdl)): | 
  
    
      This file contains hidden or 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
    
  
  
    
  | all_securities = Security.objects.filter(company=company).for_report().iterator() | |
| def flatten(*args): | |
| def transform_pipeline(mdl): | |
| data = FlatData() | |
| for fn in args: | |
| fn(data, mdl) | |
| return data | |
| return transform_pipeline |