Last updated

In Supranim you can define your database models and interact with your database using the Ozark ORM. This allows you to work with your database in a more intuitive way, using Nim's type system and syntax.

🔗Defining Models

As specified in the project structure, you can define your database models in the src/model/ directory. All files in this directory are automatically loaded by Supranim at compile time, so you can define your models in any file within this directory. It is recommended to organize your models in separate files for better maintainability.

Here is an example of a simple User model defined in src/model/user.nim:

import supranim/model

newModel User:
  id {.pk.}: Serial
  email {.unique, notnull.}: Varchar(255)
  password {.notnull.}: Text
  created_at: TimestampTz
  updated_at: TimestampTz