-
Notifications
You must be signed in to change notification settings - Fork 325
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Pawel Leszczynski <leszczynski.pawel@gmail.com>
- Loading branch information
1 parent
07ba426
commit eb67b0f
Showing
23 changed files
with
405 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright 2018-2022 contributors to the Marquez project | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package marquez.db; | ||
|
||
import java.time.Instant; | ||
import java.util.Optional; | ||
import java.util.UUID; | ||
import marquez.db.mappers.DatasetSymlinksRowMapper; | ||
import marquez.db.models.DatasetSymlinkRow; | ||
import org.jdbi.v3.sqlobject.config.RegisterRowMapper; | ||
import org.jdbi.v3.sqlobject.statement.SqlQuery; | ||
import org.jdbi.v3.sqlobject.statement.SqlUpdate; | ||
|
||
@RegisterRowMapper(DatasetSymlinksRowMapper.class) | ||
public interface DatasetSymlinkDao extends BaseDao { | ||
|
||
default DatasetSymlinkRow upsertDatasetSymlinkRow( | ||
UUID uuid, String name, UUID namespaceUuid, boolean isPrimary, Instant now) { | ||
doUpsertDatasetSymlinkRow(uuid, name, namespaceUuid, isPrimary, now); | ||
return findDatasetSymlinkByNamespaceUidAndName(namespaceUuid, name).orElseThrow(); | ||
} | ||
|
||
@SqlQuery("SELECT * FROM dataset_symlinks WHERE namespace_uuid = :namespaceUuid and name = :name") | ||
Optional<DatasetSymlinkRow> findDatasetSymlinkByNamespaceUidAndName( | ||
UUID namespaceUuid, String name); | ||
|
||
@SqlUpdate( | ||
"INSERT INTO dataset_symlinks (" | ||
+ "dataset_uuid, " | ||
+ "name, " | ||
+ "namespace_uuid, " | ||
+ "is_primary, " | ||
+ "created_at, " | ||
+ "updated_at" | ||
+ ") VALUES ( " | ||
+ ":uuid, " | ||
+ ":name, " | ||
+ ":namespaceUuid, " | ||
+ ":isPrimary, " | ||
+ ":now, " | ||
+ ":now) " | ||
+ "ON CONFLICT (name, namespace_uuid) DO NOTHING") | ||
void doUpsertDatasetSymlinkRow( | ||
UUID uuid, String name, UUID namespaceUuid, boolean isPrimary, Instant now); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.