<commit_before># FileDb

FileDb is a small type of database. It stores all data for a model into CSV files and create accessor for you.

## Installation

hm, yeah. just add this to your Gemfile:

```ruby
gem 'file_db', '~> 1.0.0'
```

And then execute:
```
  $ bundle
```
Or install it yourself as:
```
  $ gem install file_db
```

Huh, ready to use!

## Differences to Version 0.7.0

Fieldnames are now in the first line of the table file.

And:

### Performance

#### 0.7.0 with 1000 Entries

| Action | Time in Milliseconds |
|---|---|
|getting the first|29.194|
|update record|39.226|
|create record|74.994|
|using where with 1 parameter|8.700|
|using where with 2 parameter|9.775|
|find |9.507|

#### 1.0.0 with 1000 Entries

| Action | Time in Milliseconds |
|---|---|
|getting the first|8.184|
|update record|4.629|
|create record|3.673|
|using where with 1 parameter|0.535|
|using where with 2 parameter|0.337|
|find |0.030|

#### 0.7.0 with 5000 Entries

| Action | Time in Milliseconds |
|---|---|
|getting the first|88.852|
|update record|122.662|
|create record|284.086|
|using where with 1 parameter|35.795|
|using where with 2 parameter|35.125|
|find |35.881|

#### 1.0.0 with 5000 Entries

| Action | Time in Milliseconds |
|---|---|
|getting the first|27.343|
|update record|14.405|
|create record|9.705|
|using where with 1 parameter|1.846|
|using where with 2 parameter|2.027|
|find |0.019|



## Usage

### Configuration

First configure the storage directory:

```ruby
FileDb::Configuration.configure data_directory: 'data'
```
Subdirectory is the default for storing the tables. If you change the configuration, the `FileDb` will be automaticly create a new database directory and table files if needed.


Let's start with creating a model called `User`.

```ruby
class User < FileDb::Model

end<commit_msg>changed time for getting the first entry<commit_after># FileDb

FileDb is a small type of database. It stores all data for a model into CSV files and create accessor for you.

## Installation

hm, yeah. just add this to your Gemfile:

```ruby
gem 'file_db', '~> 1.0.0'
```

And then execute:
```
  $ bundle
```
Or install it yourself as:
```
  $ gem install file_db
```

Huh, ready to use!

## Differences to Version 0.7.0

Fieldnames are now in the first line of the table file.

And:

### Performance

#### 0.7.0 with 1000 Entries

| Action | Time in Milliseconds |
|---|---|
|getting the first|29.194|
|update record|39.226|
|create record|74.994|
|using where with 1 parameter|8.700|
|using where with 2 parameter|9.775|
|find |9.507|

#### 1.0.0 with 1000 Entries

| Action | Time in Milliseconds |
|---|---|
|getting the first|0.031|
|update record|4.629|
|create record|3.673|
|using where with 1 parameter|0.535|
|using where with 2 parameter|0.337|
|find |0.030|

#### 0.7.0 with 5000 Entries

| Action | Time in Milliseconds |
|---|---|
|getting the first|88.852|
|update record|122.662|
|create record|284.086|
|using where with 1 parameter|35.795|
|using where with 2 parameter|35.125|
|find |35.881|

#### 1.0.0 with 5000 Entries

| Action | Time in Milliseconds |
|---|---|
|getting the first|0.037|
|update record|14.405|
|create record|9.705|
|using where with 1 parameter|1.846|
|using where with 2 parameter|2.027|
|find |0.019|



## Usage

### Configuration

First configure the storage directory:

```ruby
FileDb::Configuration.configure data_directory: 'data'
```
Subdirectory is the default for storing the tables. If you change the configuration, the `FileDb` will be automaticly create a new database directory and table files if needed.


Let's start with creating a model called `User`.

```ruby
class User < FileDb::Model

end
{'fraction_non_alphanumeric': 0.13796849538294406, 'fraction_numerical': 0.0817490494296578, 'mean_word_length': 4.010884353741496, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '3764330', 'n_tokens_mistral': 1440, 'n_tokens_neox': 1210, 'n_words': 465}