MCPcopy Index your code
hub / github.com/apache/devlake / CreateIfNotExist

Method CreateIfNotExist

backend/impls/dalgorm/dalgorm.go:269–272  ·  view source on GitHub ↗

CreateIfNotExist tries to create the record if not exist

(entity interface{}, clauses ...dal.Clause)

Source from the content-addressed store, hash-verified

267
268// CreateIfNotExist tries to create the record if not exist
269func (d *Dalgorm) CreateIfNotExist(entity interface{}, clauses ...dal.Clause) errors.Error {
270 d.unwrapDynamic(&entity, &clauses)
271 return d.convertGormError(buildTx(d.db, clauses).Clauses(clause.OnConflict{DoNothing: true}).Create(entity).Error)
272}
273
274// Delete records from database
275func (d *Dalgorm) Delete(entity interface{}, clauses ...dal.Clause) errors.Error {

Callers

nothing calls this directly

Calls 4

unwrapDynamicMethod · 0.95
convertGormErrorMethod · 0.95
buildTxFunction · 0.85
CreateMethod · 0.65

Tested by

no test coverage detected