use `exists` instead of `put`

main
Ziyang Hu 2 years ago
parent 0085511063
commit cad908edbc

@ -255,8 +255,7 @@ impl<'a> SessionTx<'a> {
.try_collect()?, .try_collect()?,
); );
let key = relation_store.adhoc_encode_key(&extracted, *span)?; let key = relation_store.adhoc_encode_key(&extracted, *span)?;
let existing = self.tx.get(&key, true)?; if self.tx.exists(&key, true)? {
if existing.is_some() {
bail!(TransactAssertionFailure { bail!(TransactAssertionFailure {
relation: relation_store.name.to_string(), relation: relation_store.name.to_string(),
key: extracted.0, key: extracted.0,

@ -1,8 +1,4 @@
// Copyright 2022, The Cozo Project Authors. /* Copyright 2022, The Cozo Project Authors. Licensed under MIT/Apache-2.0/BSD-3-Clause. */
//
// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
// If a copy of the MPL was not distributed with this file,
// You can obtain one at https://mozilla.org/MPL/2.0/.
#ifndef COZO_C_H #ifndef COZO_C_H
#define COZO_C_H #define COZO_C_H

Loading…
Cancel
Save