useRepo()

Usage

import { useRepo } from 'pinia-orm'
import User from './models/User'
import PostRepository from './repositories/Post'
const userRepo = useRepo(User) // Repository<User>
const postRepo = useRepo(PostRepo) // PostRepository

Type Declaration

export function useRepo<M extends Model>(
  model: Constructor<M>,
  pinia?: Pinia,
): Repository<M>
export function useRepo<R extends Repository>(
  repository: Constructor<R>,
  pinia?: Pinia,
): R
Table of Contents