Sha256: a4f4af170b434fdc23e4524d2d8c01f2ac67ff3bb6b1904e8ce2921ed3516883

Contents?: true

Size: 1.95 KB

Versions: 1

Compression:

Stored size: 1.95 KB

Contents

# JSON ORM ๐Ÿš€

`json-orm` is a Ruby gem providing a lightweight, JSON-based Object-Relational Mapping (ORM) system, primarily designed for simple data analytical applications ๐Ÿ“Š. It includes CRUD operations, transaction support, custom validations, and query chaining, ideal for small-scale projects.

๐Ÿšง **Important Development Notice** ๐Ÿšง

While designed for simplicity and ease of use, `json-orm` hasn't been optimized for file size or fully vetted for reliability as a database storage solution. It's best used in contexts where these factors are not critical.

## Features โœจ

- CRUD operations on JSON files
- Transaction support with commit and rollback
- Custom attribute validation
- Query chaining for advanced data filtering
- Basic logging for debugging
- Thread-safe operations

## Future Plans

- [ ] Refactor logging
- [ ] Add tests to DB class
- [ ] Clean up better after test
- [ ] Improve test to validate reliability
- [ ] Add Validations class

## Installation ๐Ÿ”ง

Clone the repository and include it in your Ruby project:

```bash
git clone https://github.com/your-username/jsonorm.git
```

## Usage ๐Ÿ“˜

### Basic Operations

```ruby
db = JSONORM::JSONDB.new('your_data.json')
orm = JSONORM::ORM.new(db)

orm.create({name: "John Doe", email: "john@example.com"})
found_record = orm.find(1)
orm.update(1, {name: "Jane Doe"})
orm.delete(1)
```

### Transactions

```ruby
orm.begin_transaction
# Operations...
orm.commit_transaction
```

### Custom Validations

```ruby
JSONORM.register_validator(:email) do |value|
  # Validation logic...
end
```

### Query Chaining

```ruby
results = orm.where(age: 30).where(city: "Wonderland").execute
```

## Testing with MiniTest ๐Ÿงช

Tests are located in the `test` directory. Run them using MiniTest to ensure reliability.

## Contributing ๐Ÿค

Contributions are welcome. Please ensure to follow Ruby coding style and best practices, and write tests for new functionalities.

## License

Distributed under the MIT License.

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
json-orm-0.1.0 README.md