module DBX::ORM::ModelMixin(Model, ModelQuery)

Overview

Mixin for Model class.

Automatically injected into the models.

Defined in:

orm/model_mixin.cr

Instance Method Summary

Instance Method Detail

def create!(data : Hash | NamedTuple, returning : DBX::QueryBuilder::OneOrMoreFieldsType = "*") : Model::Schema #

Creates a new resource and returns.


def delete(pk_value) : ModelQuery #

Deletes one resource by its primary key.


def delete : ModelQuery #

Deletes one or more resources.


def find(pk_value) : ModelQuery #

Find one resource by its primary key.


def find : ModelQuery #

Find one or more resources.


def insert(data : Hash | NamedTuple) : ModelQuery #

Inserts a new resource.


def query : ModelQuery #

Creates a new ModelQuery instance.


def update(pk_value, data : Hash | NamedTuple) : ModelQuery #

Updates one resource by its primary key.


def update(data : Hash | NamedTuple) : ModelQuery #

Update one or more resources.