typeorm/typeorm

Create FindOrCreate metod

Aberta

#7.301 aberto em 20 de jan. de 2021

 (6 comentários) (7 reações) (0 responsável)TypeScript (6.466 forks)batch import
comp: repositoryfeaturegood first issue

Métricas do repositório

Stars
 (36.093 estrelas)
Métricas de merge de PR
 (Mesclagem média 66d 23h) (16 fundiu PRs em 30d)

Description

Feature Description

One method to find or create. Does not create a new record if exists one register. Does create a new record if not exists one register.

The Problem

I'm always frustrated when need to create or search a record, requiring more than one request in the database.

The Solution

Create a method to find one register in case don't find, make a register in table.

Considered Alternatives

Additional Context

Relevant Database Driver(s)

  • aurora-data-api
  • aurora-data-api-pg
  • better-sqlite3
  • cockroachdb
  • cordova
  • expo
  • mongodb
  • mysql
  • nativescript
  • oracle
  • postgres
  • react-native
  • sap
  • sqlite
  • sqlite-abstract
  • sqljs
  • sqlserver

Are you willing to resolve this issue by submitting a Pull Request?

  • Yes, I have the time, and I know how to start.
  • Yes, I have the time, but I don't know how to start. I would need guidance.
  • No, I don't have the time, although I believe I could do it if I had the time...
  • No, I don't have the time and I wouldn't even know how to start.

Guia do colaborador