<commit_before>MMPCoreDataHelper
=================

A lightweight helper library for common CoreData tasks providing data access pattern inspired by [Active Record](http://en.wikipedia.org/wiki/Active_record_pattern), [LINQ](http://en.wikipedia.org/wiki/Language_Integrated_Query), and functional programming. Even if the library doesn't have the function you need, you can always fallback to the standard CoreData, but with thread-safe context bonus.

Features:
* Thread-safe singleton instance easily accessible from anywhere. No more worrying whether a MOC (NSManagedObjectContext) belongs to the thread or not. The library makes sure that the MOC is local to the whichever thread you're calling the function from.
* Functional [Active Record](http://en.wikipedia.org/wiki/Active_record_pattern) + [LINQ](http://en.wikipedia.org/wiki/Language_Integrated_Query)-inspired wrapper for common tasks.
* Import data directly from CSV file.
* Automatic configuration and initialization (by convention over configuration) by default but manual configuration is still possible.
* Get notified on errors and other CoreData events using NSNotificationCenter.

## Installation

The recommended way to install is by using [CocoaPods](http://cocoapods.org/). Once you have CocoaPods installed, add the following line to your project's Podfile:
```
pod "MMPCoreDataHelper"
```

## Usage

Include the header file in your code:
```objectivec
#import <MMPCoreDataHelper/MMPCoreDataHelper.h>
```
In general, there is no need for database initialization and you can go right ahead directly using your model object to create and query records. See below for cases that requires you to explicitly set names before you start using the library.

### Create, Update, Delete, Save

Start directly with your CoreData model object (extended from NSManagedObject) and simply use `create`, `update`, and  `save` to create records:
```objectivec
// Create record
MMPArtist *artist = [[[MMPArtist create] 
                       update:@{@"id" : @"1", @"name" : @"<NAME>"}] 
                       save];

// delete record<commit_msg>more typo<commit_after>MMPCoreDataHelper
=================

A lightweight helper library for common CoreData tasks providing data access pattern inspired by [Active Record](http://en.wikipedia.org/wiki/Active_record_pattern), [LINQ](http://en.wikipedia.org/wiki/Language_Integrated_Query), and functional programming. Even if the library doesn't have the function you need, you can always fallback to the standard CoreData, but with thread-safe context bonus.

Features:
* Thread-safe singleton instance easily accessible from anywhere. No more worrying whether a MOC (NSManagedObjectContext) belongs to the thread or not. The library makes sure that the MOC is local to the whichever thread you're calling the function from.
* Functional [Active Record](http://en.wikipedia.org/wiki/Active_record_pattern) + [LINQ](http://en.wikipedia.org/wiki/Language_Integrated_Query)-inspired wrapper for common tasks.
* Import data directly from CSV file.
* Automatic configuration and initialization (by convention over configuration) by default but manual configuration is still possible.
* Get notified on errors and other CoreData events using NSNotificationCenter.

## Installation

The recommended way to install is by using [CocoaPods](http://cocoapods.org/). Once you have CocoaPods installed, add the following line to your project's Podfile:
```
pod "MMPCoreDataHelper"
```

## Usage

Include the header file in your code:
```objectivec
#import <MMPCoreDataHelper/MMPCoreDataHelper.h>
```
In general, there is no need for database initialization and you can go right ahead directly using your model object to create and query records. See below for cases that require you to explicitly set names before you start using the library.

### Create, Update, Delete, Save

Start directly with your CoreData model object (extended from NSManagedObject) and simply use `create`, `update`, and  `save` to create records:
```objectivec
// Create record
MMPArtist *artist = [[[MMPArtist create] 
                       update:@{@"id" : @"1", @"name" : @"<NAME>"}] 
                       save];

// delete record
{'fraction_non_alphanumeric': 0.08894173602853746, 'fraction_numerical': 0.0004756242568370987, 'mean_word_length': 4.777472527472527, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4749334', 'n_tokens_mistral': 1091, 'n_tokens_neox': 1030, 'n_words': 478}