maze
  • Introduction
  • Getting Started
    • Quick Start
  • Guides
    • Overview
    • Installation
    • Create New App
    • Directory Structure
    • Configuration
    • Docker
    • Controllers
      • Sessions
      • Request & Response Objects
      • Halt!
      • Respond With
      • Params Validation
      • Cookies
      • Filters
      • Flash
      • Redirection
    • Views
      • View Helpers
    • Models
      • Granite
        • Granite's README
        • Migrations
        • Validations
        • Callbacks
        • Associations
        • Querying
        • Bulk Insertions
      • Crecto
        • Crecto's README
      • Jennifer
        • Jennifer Docs
        • Migrations
        • Models
    • Routing
      • Pipelines
      • Routes
    • Websockets
      • Channels
      • Sockets
      • JavaScript Client
    • Mailers
      • Deliver a new Email
  • Testing
    • System Tests
  • Deployment
    • Digital Ocean
    • Heroku
  • CLI
    • New
    • Recipes
    • Generate
    • Database
    • Watch
    • Routes
    • Exec
    • Encrypt
    • Deploy
  • Examples
    • Maze Auth
    • Crystal Debug
    • Minimal Configuration
  • Troubleshooting
  • Contributing
  • Code of Conduct
  • HAVE A QUESTION?
    • Ask on Gitter
    • Ask on StackOverflow
    • Follow on Twitter
    • Submit an issue
Powered by GitBook
On this page
  • Granite
  • Crecto
  • Jennifer
  1. Guides

Models

PreviousView HelpersNextGranite

Last updated 7 years ago

Maze is independent of your choice of model architectures. We (Core members) have built two ORM models: Granite and Crecto. We also think Jennifer built by is a good option.

When you generate a new maze project, you can specify which model you prefer.

maze new blog -m crecto --deps

We currently support granite and crecto and default to granite.

Granite

Granite provides a light weight ORM that is focused on taking the results of your query and mapping them to your model. It does not try to shield you from the SQL that lies underneath the mapping. It provides a couple conveniences like save and destroy for simple INSERT, UPDATE and DELETE statements. It provides find, find_by and all to query the database. It also has basic one-to-many relationships with belong_to and has_many.

Crecto

Crecto is based on Phoenix's ecto and follows the repository pattern. Your data objects are data structures to hold the data and then you use a Repo to Repo.insert, Repo.update, or Repo.delete your object in the db. You can use Repo.all to query the db, or Repo.get to grab a single row.

Jennifer

Jennifer provides an more full featured ORM with a full featured DSL for queries and follows the ActiveRecord pattern found in Rails. If you are looking looking for a full featured ORM, Jennifer may be your choice of ORM.

Of course you are not limited to only these options. You may have a need for a high throughput, large dataset, dynamic structured db like MongoDB or you need to connect to a microservice or a legacy mainframe. By not being tied to a specific model, we don't limit the possible integrations you may need.

Roman Kalnytskyi
Granite
Crecto
Jennifer