-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
33c903f
commit ecc569f
Showing
6 changed files
with
78 additions
and
15 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
26 changes: 26 additions & 0 deletions
26
jdbc/spring-jooq/src/main/java/ydb/default_schema/Indexes.java
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
jdbc/spring-jooq/src/main/java/ydb/default_schema/tables/Series.java
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
17 changes: 17 additions & 0 deletions
17
jdbc/spring-jooq/src/main/kotlin/tech/ydb/jooq/repository/SeriesRepository.kt
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,17 @@ | ||
package tech.ydb.jooq.repository | ||
|
||
import org.springframework.stereotype.Repository | ||
import tech.ydb.jooq.YdbDSLContext | ||
import ydb.default_schema.Indexes | ||
import ydb.default_schema.Tables.SERIES | ||
|
||
/** | ||
* @author Kirill Kurdyukov | ||
*/ | ||
@Repository | ||
class SeriesRepository(val ydbDSLContext: YdbDSLContext) { | ||
|
||
fun findByTitle(title: String) = ydbDSLContext.selectFrom(SERIES.useIndex(Indexes.TITLE_NAME.name)) | ||
.where(SERIES.TITLE.eq(title)) | ||
.fetchOne() | ||
} |
25 changes: 13 additions & 12 deletions
25
jdbc/spring-jooq/src/main/resources/db/migration/V1__schema.sql
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 |
---|---|---|
@@ -1,28 +1,29 @@ | ||
CREATE TABLE series | ||
( | ||
series_id Int64, | ||
title Utf8, | ||
series_info Utf8, | ||
series_id Int64, | ||
title Text, | ||
series_info Text, | ||
release_date Date, | ||
PRIMARY KEY (series_id) | ||
PRIMARY KEY (series_id), | ||
INDEX title_name GLOBAL ON (title) | ||
); | ||
|
||
CREATE TABLE seasons | ||
( | ||
series_id Int64, | ||
season_id Int64, | ||
title Utf8, | ||
series_id Int64, | ||
season_id Int64, | ||
title Text, | ||
first_aired Date, | ||
last_aired Date, | ||
last_aired Date, | ||
PRIMARY KEY (series_id, season_id) | ||
); | ||
|
||
CREATE TABLE episodes | ||
( | ||
series_id Int64, | ||
season_id Int64, | ||
series_id Int64, | ||
season_id Int64, | ||
episode_id Int64, | ||
title Utf8, | ||
air_date Date, | ||
title Text, | ||
air_date Date, | ||
PRIMARY KEY (series_id, season_id, episode_id) | ||
); |
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