make()

Creates a new model instance


This method will not save the model to the store. It's pretty much the alternative to new Model(), but it injects the store instance to support model instance methods in SSR environment.

Usage

import { useRepo } from 'pinia-orm'import User from './models/User'const userRepo = useRepo(User)// Make a model with default valuesuserRepo.make()// Make a model with valuesuserRepo.make({  id: 1,  name: 'Jane Doe',})// Make many models with valuesuserRepo.make([  {    id: 1,    name: 'Jane Doe',  },  {    id: 2,    name: 'John Doe',  },])

Typescript Declarations

function make(records?: Element | Element[]): M | M[]