diff --git a/repository-ydb-common/src/main/java/tech/ydb/yoj/repository/ydb/DbType.java b/databind/src/main/java/tech/ydb/yoj/databind/DbType.java similarity index 62% rename from repository-ydb-common/src/main/java/tech/ydb/yoj/repository/ydb/DbType.java rename to databind/src/main/java/tech/ydb/yoj/databind/DbType.java index 9036bcde..bf970979 100644 --- a/repository-ydb-common/src/main/java/tech/ydb/yoj/repository/ydb/DbType.java +++ b/databind/src/main/java/tech/ydb/yoj/databind/DbType.java @@ -1,87 +1,98 @@ -package tech.ydb.yoj.repository.ydb; +package tech.ydb.yoj.databind; /** * Database column types supported by YDB. */ -public interface DbType { +public enum DbType { + DEFAULT(""), /** * Boolean value. */ - String BOOL = "BOOL"; + BOOL("BOOL"), /** * Byte value. */ - String UINT8 = "UINT8"; + UINT8("UINT8"), /** * Integer value. */ - String INT32 = "INT32"; + INT32("INT32"), /** * Integer value stored in the db as Uint32. */ - String UINT32 = "UINT32"; + UINT32("UINT32"), /** * Long value. */ - String INT64 = "INT64"; + INT64("INT64"), /** * Long value stored in the db as Uint64. */ - String UINT64 = "UINT64"; + UINT64("UINT64"), /** * Float value. */ - String FLOAT = "FLOAT"; + FLOAT("FLOAT"), /** * Double value. */ - String DOUBLE = "DOUBLE"; + DOUBLE("DOUBLE"), /** * Date value, accurate to the day. */ - String DATE = "DATE"; + DATE("DATE"), /** * Timestamp value, accurate to second. */ - String DATETIME = "DATETIME"; + DATETIME("DATETIME"), /** * Timestamp value, accurate to microsecond. */ - String TIMESTAMP = "TIMESTAMP"; + TIMESTAMP("TIMESTAMP"), /** * Interval value, accurate to microsecond. */ - String INTERVAL = "INTERVAL"; + INTERVAL("INTERVAL"), /** * Binary data. */ - String STRING = "STRING"; + STRING("STRING"), /** * UTF-8 encoded string. */ - String UTF8 = "UTF8"; + UTF8("UTF8"), /** * JSON value, stored as a UTF-8 encoded string. */ - String JSON = "JSON"; + JSON("JSON"), /** * JSON value, stored in an indexed representation permitting efficient query operations of the values inside the * JSON value itself. */ - String JSON_DOCUMENT = "JSON_DOCUMENT"; + JSON_DOCUMENT("JSON_DOCUMENT"); + + private final String dbType; + + DbType(String dbType) { + this.dbType = dbType; + } + + public String getDbType() { + return dbType; + } } diff --git a/databind/src/main/java/tech/ydb/yoj/databind/schema/Column.java b/databind/src/main/java/tech/ydb/yoj/databind/schema/Column.java index 4d1b25b4..d9dd6165 100644 --- a/databind/src/main/java/tech/ydb/yoj/databind/schema/Column.java +++ b/databind/src/main/java/tech/ydb/yoj/databind/schema/Column.java @@ -1,5 +1,6 @@ package tech.ydb.yoj.databind.schema; +import tech.ydb.yoj.databind.DbType; import tech.ydb.yoj.databind.FieldValueType; import java.lang.annotation.Retention; @@ -15,7 +16,7 @@ *

Usage Example: *

  * // DB column will have name 'DESC' and DB-specific type 'UTF8'
- * @Column(name = "DESC", dbType = "UTF8")
+ * @Column(name = "DESC", dbType = DbType.UTF8)
  * String description;
  *
  * // Subobject's serialized representation will be written to a single BIG_SUBOBJ column
@@ -42,7 +43,7 @@
      * The type of the DB column.
* Defaults to automatically inferred from the field type. */ - String dbType() default ""; + DbType dbType() default DbType.DEFAULT; /** * Qualifier for refining type representation of the DB column.
diff --git a/databind/src/main/java/tech/ydb/yoj/databind/schema/Schema.java b/databind/src/main/java/tech/ydb/yoj/databind/schema/Schema.java index d8a39dc8..46530de9 100644 --- a/databind/src/main/java/tech/ydb/yoj/databind/schema/Schema.java +++ b/databind/src/main/java/tech/ydb/yoj/databind/schema/Schema.java @@ -8,6 +8,7 @@ import lombok.SneakyThrows; import lombok.Value; import lombok.With; +import tech.ydb.yoj.databind.DbType; import tech.ydb.yoj.databind.FieldValueType; import tech.ydb.yoj.databind.schema.configuration.SchemaRegistry.SchemaKey; import tech.ydb.yoj.databind.schema.naming.NamingStrategy; @@ -423,8 +424,8 @@ private JavaField(JavaField javaField, JavaField parent) { */ public String getDbType() { Column annotation = field.getColumn(); - if (annotation != null && !annotation.dbType().isEmpty()) { - return annotation.dbType(); + if (annotation != null && annotation.dbType() != DbType.DEFAULT) { + return annotation.dbType().getDbType(); } return null; } diff --git a/databind/src/test/java/tech/ydb/yoj/databind/schema/naming/ColumnTest.java b/databind/src/test/java/tech/ydb/yoj/databind/schema/naming/ColumnTest.java index 02072d3f..9a62bcbf 100644 --- a/databind/src/test/java/tech/ydb/yoj/databind/schema/naming/ColumnTest.java +++ b/databind/src/test/java/tech/ydb/yoj/databind/schema/naming/ColumnTest.java @@ -4,6 +4,7 @@ import lombok.Value; import org.junit.Before; import org.junit.Test; +import tech.ydb.yoj.databind.DbType; import tech.ydb.yoj.databind.schema.Column; import tech.ydb.yoj.databind.schema.ObjectSchema; import tech.ydb.yoj.databind.schema.Schema; @@ -112,7 +113,7 @@ private static class ColumnNameClashes { @Column Id id; - @Column(name = "id", dbType = "UTF8") + @Column(name = "id", dbType = DbType.UTF8) String value; @Value @@ -127,7 +128,7 @@ private static class JavaFieldClashes { @Column Id id; - @Column(name = "value", dbType = "UTF8") + @Column(name = "value", dbType = DbType.UTF8) String value; @Value @@ -171,7 +172,7 @@ private static final class Id { @Value private static final class UInt32 { - @Column(dbType = "UInt32", dbTypeQualifier = "Days") + @Column(dbType = DbType.UINT32, dbTypeQualifier = "Days") int value; } } diff --git a/repository-test/src/main/java/tech/ydb/yoj/repository/test/sample/model/ChangefeedEntity.java b/repository-test/src/main/java/tech/ydb/yoj/repository/test/sample/model/ChangefeedEntity.java index ab668cab..8c520abb 100644 --- a/repository-test/src/main/java/tech/ydb/yoj/repository/test/sample/model/ChangefeedEntity.java +++ b/repository-test/src/main/java/tech/ydb/yoj/repository/test/sample/model/ChangefeedEntity.java @@ -1,6 +1,7 @@ package tech.ydb.yoj.repository.test.sample.model; import lombok.Value; +import tech.ydb.yoj.databind.DbType; import tech.ydb.yoj.databind.schema.Changefeed; import tech.ydb.yoj.databind.schema.Column; import tech.ydb.yoj.repository.db.Entity; @@ -14,7 +15,7 @@ public class ChangefeedEntity implements Entity { Id id; - @Column(dbType = "UTF8") + @Column(dbType = DbType.UTF8) String stringField; @Value diff --git a/repository-test/src/main/java/tech/ydb/yoj/repository/test/sample/model/TtlEntity.java b/repository-test/src/main/java/tech/ydb/yoj/repository/test/sample/model/TtlEntity.java index 3d56a20e..dff37c6a 100644 --- a/repository-test/src/main/java/tech/ydb/yoj/repository/test/sample/model/TtlEntity.java +++ b/repository-test/src/main/java/tech/ydb/yoj/repository/test/sample/model/TtlEntity.java @@ -1,6 +1,7 @@ package tech.ydb.yoj.repository.test.sample.model; import lombok.Value; +import tech.ydb.yoj.databind.DbType; import tech.ydb.yoj.databind.schema.Column; import tech.ydb.yoj.databind.schema.TTL; import tech.ydb.yoj.repository.db.Entity; @@ -12,7 +13,7 @@ public class TtlEntity implements Entity { Id id; - @Column(dbType = "TIMESTAMP") + @Column(dbType = DbType.TIMESTAMP) Instant createdAt; @Value diff --git a/repository-test/src/main/java/tech/ydb/yoj/repository/test/sample/model/TypeFreak.java b/repository-test/src/main/java/tech/ydb/yoj/repository/test/sample/model/TypeFreak.java index 7bf93cb8..70474b5b 100644 --- a/repository-test/src/main/java/tech/ydb/yoj/repository/test/sample/model/TypeFreak.java +++ b/repository-test/src/main/java/tech/ydb/yoj/repository/test/sample/model/TypeFreak.java @@ -4,6 +4,7 @@ import lombok.NonNull; import lombok.Value; import lombok.With; +import tech.ydb.yoj.databind.DbType; import tech.ydb.yoj.databind.schema.Column; import tech.ydb.yoj.repository.db.Entity; import tech.ydb.yoj.repository.db.Table; @@ -19,7 +20,7 @@ public class TypeFreak implements Entity { boolean primitiveBoolean; byte primitiveByte; - @Column(dbType = "UINT8") + @Column(dbType = DbType.UINT8) byte primitiveByteUint8; short primitiveShort; int primitiveInt; @@ -28,7 +29,7 @@ public class TypeFreak implements Entity { double primitiveDouble; Boolean boxedBoolean; Byte boxedByte; - @Column(dbType = "UINT8") + @Column(dbType = DbType.UINT8) Byte boxedByteUint8; Short boxedShort; Integer boxedInteger; @@ -36,20 +37,20 @@ public class TypeFreak implements Entity { Float boxedFloat; Double boxedDouble; - @Column(dbType = "UTF8") + @Column(dbType = DbType.UTF8) String utf8String; String string; byte[] bytes; Status status; - @Column(dbType = "UTF8") + @Column(dbType = DbType.UTF8) Status utf8Status; @With Embedded embedded; - @Column(flatten = false, dbType = "UTF8") + @Column(flatten = false, dbType = DbType.UTF8) Embedded utf8embedded; - @Column(flatten = false, dbType = "STRING") + @Column(flatten = false, dbType = DbType.STRING) Embedded stringEmbedded; - @Column(flatten = false, dbType = "JSON_DOCUMENT") + @Column(flatten = false, dbType = DbType.JSON_DOCUMENT) Embedded jsonDocumentEmbedded; @Column(flatten = false) Embedded jsonEmbedded; @@ -60,11 +61,11 @@ public class TypeFreak implements Entity { List list2; Set list3; Map map1; - @Column(dbType = "UTF8") + @Column(dbType = DbType.UTF8) Map utf8map; - @Column(dbType = "STRING") + @Column(dbType = DbType.STRING) Map stringMap; - @Column(dbType = "JSON_DOCUMENT") + @Column(dbType = DbType.JSON_DOCUMENT) Map jsonDocumentMap; @Column(name = "custom_named_column") diff --git a/repository-ydb-v1/src/main/java/tech/ydb/yoj/repository/ydb/compatibility/YdbSchemaCompatibilityChecker.java b/repository-ydb-v1/src/main/java/tech/ydb/yoj/repository/ydb/compatibility/YdbSchemaCompatibilityChecker.java index c1400244..9970137b 100644 --- a/repository-ydb-v1/src/main/java/tech/ydb/yoj/repository/ydb/compatibility/YdbSchemaCompatibilityChecker.java +++ b/repository-ydb-v1/src/main/java/tech/ydb/yoj/repository/ydb/compatibility/YdbSchemaCompatibilityChecker.java @@ -13,7 +13,6 @@ import org.slf4j.LoggerFactory; import tech.ydb.yoj.repository.db.Entity; import tech.ydb.yoj.repository.db.EntitySchema; -import tech.ydb.yoj.repository.ydb.DbType; import tech.ydb.yoj.repository.ydb.YdbConfig; import tech.ydb.yoj.repository.ydb.YdbRepository; import tech.ydb.yoj.repository.ydb.client.YdbPaths; @@ -274,20 +273,20 @@ private static String builderDDLColumns(YdbSchemaOperations.Table table) { private static String typeToDDL(String type) { return switch (type) { - case DbType.BOOL -> "PrimitiveType.bool()"; - case DbType.UINT8 -> "PrimitiveType.uint8()"; - case DbType.INT32 -> "PrimitiveType.int32()"; - case DbType.UINT32 -> "PrimitiveType.uint32()"; - case DbType.INT64 -> "PrimitiveType.int64()"; - case DbType.UINT64 -> "PrimitiveType.uint64()"; - case DbType.FLOAT -> "PrimitiveType.float32()"; - case DbType.DOUBLE -> "PrimitiveType.float64()"; - case DbType.DATE -> "PrimitiveType.date()"; - case DbType.DATETIME -> "PrimitiveType.datetime()"; - case DbType.TIMESTAMP -> "PrimitiveType.timestamp()"; - case DbType.STRING -> "PrimitiveType.string()"; - case DbType.UTF8 -> "PrimitiveType.utf8()"; - case DbType.JSON -> "PrimitiveType.json()"; + case "BOOL" -> "PrimitiveType.bool()"; + case "UINT8" -> "PrimitiveType.uint8()"; + case "INT32" -> "PrimitiveType.int32()"; + case "UINT32" -> "PrimitiveType.uint32()"; + case "INT64" -> "PrimitiveType.int64()"; + case "UINT64" -> "PrimitiveType.uint64()"; + case "FLOAT" -> "PrimitiveType.float32()"; + case "DOUBLE" -> "PrimitiveType.float64()"; + case "DATE" -> "PrimitiveType.date()"; + case "DATETIME" -> "PrimitiveType.datetime()"; + case "TIMESTAMP" -> "PrimitiveType.timestamp()"; + case "STRING" -> "PrimitiveType.string()"; + case "UTF8" -> "PrimitiveType.utf8()"; + case "JSON" -> "PrimitiveType.json()"; default -> throw new IllegalArgumentException("Unknown db type: " + type); }; } diff --git a/repository-ydb-v1/src/main/java/tech/ydb/yoj/repository/ydb/statement/Count.java b/repository-ydb-v1/src/main/java/tech/ydb/yoj/repository/ydb/statement/Count.java index c4c6ec6c..4088303f 100644 --- a/repository-ydb-v1/src/main/java/tech/ydb/yoj/repository/ydb/statement/Count.java +++ b/repository-ydb-v1/src/main/java/tech/ydb/yoj/repository/ydb/statement/Count.java @@ -1,10 +1,11 @@ package tech.ydb.yoj.repository.ydb.statement; import lombok.Value; +import tech.ydb.yoj.databind.DbType; import tech.ydb.yoj.databind.schema.Column; @Value public class Count { - @Column(dbType = "UINT64") + @Column(dbType = DbType.UINT64) long count; } diff --git a/repository-ydb-v1/src/test/java/tech/ydb/yoj/repository/ydb/YqlTypeTest.java b/repository-ydb-v1/src/test/java/tech/ydb/yoj/repository/ydb/YqlTypeTest.java index bae302a9..ad564a67 100644 --- a/repository-ydb-v1/src/test/java/tech/ydb/yoj/repository/ydb/YqlTypeTest.java +++ b/repository-ydb-v1/src/test/java/tech/ydb/yoj/repository/ydb/YqlTypeTest.java @@ -7,6 +7,7 @@ import lombok.Value; import org.junit.Assert; import org.junit.Test; +import tech.ydb.yoj.databind.DbType; import tech.ydb.yoj.databind.FieldValueType; import tech.ydb.yoj.databind.schema.Column; import tech.ydb.yoj.databind.schema.GlobalIndex; diff --git a/repository-ydb-v1/src/test/java/tech/ydb/yoj/repository/ydb/sample/model/HintUniform.java b/repository-ydb-v1/src/test/java/tech/ydb/yoj/repository/ydb/sample/model/HintUniform.java index e72cb639..f6bd9687 100644 --- a/repository-ydb-v1/src/test/java/tech/ydb/yoj/repository/ydb/sample/model/HintUniform.java +++ b/repository-ydb-v1/src/test/java/tech/ydb/yoj/repository/ydb/sample/model/HintUniform.java @@ -2,6 +2,7 @@ import lombok.Value; import lombok.With; +import tech.ydb.yoj.databind.DbType; import tech.ydb.yoj.databind.schema.Column; import tech.ydb.yoj.repository.db.Entity; import tech.ydb.yoj.repository.ydb.client.YdbTableHint; @@ -17,7 +18,7 @@ public class HintUniform implements Entity { @Value public static class Id implements Entity.Id { - @Column(dbType = "UINT32") + @Column(dbType = DbType.UINT32) long value; } } diff --git a/repository-ydb-v1/src/test/java/tech/ydb/yoj/repository/ydb/statement/AbstractMultipleVarsYqlStatementTest.java b/repository-ydb-v1/src/test/java/tech/ydb/yoj/repository/ydb/statement/AbstractMultipleVarsYqlStatementTest.java index 3e7b0923..9fe7bade 100644 --- a/repository-ydb-v1/src/test/java/tech/ydb/yoj/repository/ydb/statement/AbstractMultipleVarsYqlStatementTest.java +++ b/repository-ydb-v1/src/test/java/tech/ydb/yoj/repository/ydb/statement/AbstractMultipleVarsYqlStatementTest.java @@ -5,6 +5,7 @@ import lombok.Builder; import lombok.NonNull; import lombok.Value; +import tech.ydb.yoj.databind.DbType; import tech.ydb.yoj.databind.schema.Column; import tech.ydb.yoj.databind.schema.Table; import tech.ydb.yoj.repository.BaseDb; @@ -15,7 +16,6 @@ import tech.ydb.yoj.repository.db.TxManager; import tech.ydb.yoj.repository.db.TxOptions; import tech.ydb.yoj.repository.test.RepositoryTestSupport; -import tech.ydb.yoj.repository.ydb.DbType; import tech.ydb.yoj.repository.ydb.TestYdbConfig; import tech.ydb.yoj.repository.ydb.YdbRepository; import tech.ydb.yoj.repository.ydb.YdbRepositoryTransaction; diff --git a/repository-ydb-v1/src/test/java/tech/ydb/yoj/repository/ydb/statement/FindInStatementIntegrationTest.java b/repository-ydb-v1/src/test/java/tech/ydb/yoj/repository/ydb/statement/FindInStatementIntegrationTest.java index e063734f..ab916bbb 100644 --- a/repository-ydb-v1/src/test/java/tech/ydb/yoj/repository/ydb/statement/FindInStatementIntegrationTest.java +++ b/repository-ydb-v1/src/test/java/tech/ydb/yoj/repository/ydb/statement/FindInStatementIntegrationTest.java @@ -4,6 +4,7 @@ import lombok.NonNull; import lombok.Value; import org.junit.Test; +import tech.ydb.yoj.databind.DbType; import tech.ydb.yoj.databind.expression.OrderExpression; import tech.ydb.yoj.databind.schema.Column; import tech.ydb.yoj.databind.schema.GlobalIndex; @@ -12,7 +13,6 @@ import tech.ydb.yoj.repository.db.EntitySchema; import tech.ydb.yoj.repository.db.Table; import tech.ydb.yoj.repository.db.ViewSchema; -import tech.ydb.yoj.repository.ydb.DbType; import java.util.List; import java.util.Map; diff --git a/repository-ydb-v1/src/test/java/tech/ydb/yoj/repository/ydb/yql/YqlTypeAllTypesTest.java b/repository-ydb-v1/src/test/java/tech/ydb/yoj/repository/ydb/yql/YqlTypeAllTypesTest.java index a7779191..5d6aefa6 100644 --- a/repository-ydb-v1/src/test/java/tech/ydb/yoj/repository/ydb/yql/YqlTypeAllTypesTest.java +++ b/repository-ydb-v1/src/test/java/tech/ydb/yoj/repository/ydb/yql/YqlTypeAllTypesTest.java @@ -10,13 +10,13 @@ import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameter; import org.junit.runners.Parameterized.Parameters; +import tech.ydb.yoj.databind.DbType; import tech.ydb.yoj.databind.FieldValueType; import tech.ydb.yoj.databind.schema.Column; import tech.ydb.yoj.databind.schema.Schema; import tech.ydb.yoj.repository.DbTypeQualifier; import tech.ydb.yoj.repository.db.common.CommonConverters; import tech.ydb.yoj.repository.db.json.JacksonJsonConverter; -import tech.ydb.yoj.repository.ydb.DbType; import java.lang.reflect.Type; import java.time.Duration; diff --git a/repository-ydb-v2/src/main/java/tech/ydb/yoj/repository/ydb/compatibility/YdbSchemaCompatibilityChecker.java b/repository-ydb-v2/src/main/java/tech/ydb/yoj/repository/ydb/compatibility/YdbSchemaCompatibilityChecker.java index 05b2510c..2541855e 100644 --- a/repository-ydb-v2/src/main/java/tech/ydb/yoj/repository/ydb/compatibility/YdbSchemaCompatibilityChecker.java +++ b/repository-ydb-v2/src/main/java/tech/ydb/yoj/repository/ydb/compatibility/YdbSchemaCompatibilityChecker.java @@ -13,7 +13,6 @@ import org.slf4j.LoggerFactory; import tech.ydb.yoj.repository.db.Entity; import tech.ydb.yoj.repository.db.EntitySchema; -import tech.ydb.yoj.repository.ydb.DbType; import tech.ydb.yoj.repository.ydb.YdbConfig; import tech.ydb.yoj.repository.ydb.YdbRepository; import tech.ydb.yoj.repository.ydb.client.YdbPaths; @@ -287,20 +286,20 @@ private static String builderDDLColumns(YdbSchemaOperations.Table table) { private static String typeToDDL(String type) { return switch (type) { - case DbType.BOOL -> "PrimitiveType.bool()"; - case DbType.UINT8 -> "PrimitiveType.uint8()"; - case DbType.INT32 -> "PrimitiveType.int32()"; - case DbType.UINT32 -> "PrimitiveType.uint32()"; - case DbType.INT64 -> "PrimitiveType.int64()"; - case DbType.UINT64 -> "PrimitiveType.uint64()"; - case DbType.FLOAT -> "PrimitiveType.float32()"; - case DbType.DOUBLE -> "PrimitiveType.float64()"; - case DbType.DATE -> "PrimitiveType.date()"; - case DbType.DATETIME -> "PrimitiveType.datetime()"; - case DbType.TIMESTAMP -> "PrimitiveType.timestamp()"; - case DbType.STRING -> "PrimitiveType.string()"; - case DbType.UTF8 -> "PrimitiveType.utf8()"; - case DbType.JSON -> "PrimitiveType.json()"; + case "BOOL" -> "PrimitiveType.bool()"; + case "UINT8" -> "PrimitiveType.uint8()"; + case "INT32" -> "PrimitiveType.int32()"; + case "UINT32" -> "PrimitiveType.uint32()"; + case "INT64" -> "PrimitiveType.int64()"; + case "UINT64" -> "PrimitiveType.uint64()"; + case "FLOAT" -> "PrimitiveType.float32()"; + case "DOUBLE" -> "PrimitiveType.float64()"; + case "DATE" -> "PrimitiveType.date()"; + case "DATETIME" -> "PrimitiveType.datetime()"; + case "TIMESTAMP" -> "PrimitiveType.timestamp()"; + case "STRING" -> "PrimitiveType.string()"; + case "UTF8" -> "PrimitiveType.utf8()"; + case "JSON" -> "PrimitiveType.json()"; default -> throw new IllegalArgumentException("Unknown db type: " + type); }; } diff --git a/repository-ydb-v2/src/main/java/tech/ydb/yoj/repository/ydb/statement/Count.java b/repository-ydb-v2/src/main/java/tech/ydb/yoj/repository/ydb/statement/Count.java index c4c6ec6c..4088303f 100644 --- a/repository-ydb-v2/src/main/java/tech/ydb/yoj/repository/ydb/statement/Count.java +++ b/repository-ydb-v2/src/main/java/tech/ydb/yoj/repository/ydb/statement/Count.java @@ -1,10 +1,11 @@ package tech.ydb.yoj.repository.ydb.statement; import lombok.Value; +import tech.ydb.yoj.databind.DbType; import tech.ydb.yoj.databind.schema.Column; @Value public class Count { - @Column(dbType = "UINT64") + @Column(dbType = DbType.UINT64) long count; } diff --git a/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/YqlTypeTest.java b/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/YqlTypeTest.java index d89ae35d..1b434c61 100644 --- a/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/YqlTypeTest.java +++ b/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/YqlTypeTest.java @@ -6,6 +6,7 @@ import org.junit.Assert; import org.junit.Test; import tech.ydb.proto.ValueProtos; +import tech.ydb.yoj.databind.DbType; import tech.ydb.yoj.databind.FieldValueType; import tech.ydb.yoj.databind.schema.Column; import tech.ydb.yoj.databind.schema.GlobalIndex; diff --git a/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/model/EntityChangeTtl.java b/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/model/EntityChangeTtl.java index d1ab293a..63c3cf6c 100644 --- a/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/model/EntityChangeTtl.java +++ b/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/model/EntityChangeTtl.java @@ -1,6 +1,7 @@ package tech.ydb.yoj.repository.ydb.model; import lombok.Value; +import tech.ydb.yoj.databind.DbType; import tech.ydb.yoj.databind.schema.Column; import tech.ydb.yoj.databind.schema.TTL; import tech.ydb.yoj.databind.schema.Table; @@ -14,7 +15,7 @@ public class EntityChangeTtl implements Entity { EntityChangeTtl.Id id; - @Column(dbType = "TIMESTAMP") + @Column(dbType = DbType.TIMESTAMP) Instant createdAt; @Value diff --git a/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/model/EntityDropTtl.java b/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/model/EntityDropTtl.java index ddc9c41b..f024b385 100644 --- a/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/model/EntityDropTtl.java +++ b/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/model/EntityDropTtl.java @@ -1,6 +1,7 @@ package tech.ydb.yoj.repository.ydb.model; import lombok.Value; +import tech.ydb.yoj.databind.DbType; import tech.ydb.yoj.databind.schema.Column; import tech.ydb.yoj.databind.schema.Table; import tech.ydb.yoj.repository.db.Entity; @@ -12,7 +13,7 @@ public class EntityDropTtl implements Entity { Id id; - @Column(dbType = "TIMESTAMP") + @Column(dbType = DbType.TIMESTAMP) Instant createdAt; @Value diff --git a/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/sample/model/HintUniform.java b/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/sample/model/HintUniform.java index e72cb639..f6bd9687 100644 --- a/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/sample/model/HintUniform.java +++ b/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/sample/model/HintUniform.java @@ -2,6 +2,7 @@ import lombok.Value; import lombok.With; +import tech.ydb.yoj.databind.DbType; import tech.ydb.yoj.databind.schema.Column; import tech.ydb.yoj.repository.db.Entity; import tech.ydb.yoj.repository.ydb.client.YdbTableHint; @@ -17,7 +18,7 @@ public class HintUniform implements Entity { @Value public static class Id implements Entity.Id { - @Column(dbType = "UINT32") + @Column(dbType = DbType.UINT32) long value; } } diff --git a/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/statement/AbstractMultipleVarsYqlStatementTest.java b/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/statement/AbstractMultipleVarsYqlStatementTest.java index a8af1cf9..16ce9ee7 100644 --- a/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/statement/AbstractMultipleVarsYqlStatementTest.java +++ b/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/statement/AbstractMultipleVarsYqlStatementTest.java @@ -7,6 +7,7 @@ import lombok.Value; import org.junit.ClassRule; import tech.ydb.test.junit4.GrpcTransportRule; +import tech.ydb.yoj.databind.DbType; import tech.ydb.yoj.databind.schema.Column; import tech.ydb.yoj.databind.schema.Table; import tech.ydb.yoj.repository.BaseDb; @@ -17,7 +18,6 @@ import tech.ydb.yoj.repository.db.TxManager; import tech.ydb.yoj.repository.db.TxOptions; import tech.ydb.yoj.repository.test.RepositoryTestSupport; -import tech.ydb.yoj.repository.ydb.DbType; import tech.ydb.yoj.repository.ydb.YdbConfig; import tech.ydb.yoj.repository.ydb.YdbRepository; import tech.ydb.yoj.repository.ydb.YdbRepositoryTransaction; diff --git a/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/statement/FindInStatementIntegrationTest.java b/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/statement/FindInStatementIntegrationTest.java index 15d7aed6..a1c1437f 100644 --- a/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/statement/FindInStatementIntegrationTest.java +++ b/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/statement/FindInStatementIntegrationTest.java @@ -5,6 +5,7 @@ import org.junit.Test; import tech.ydb.proto.ValueProtos; import tech.ydb.yoj.databind.expression.OrderExpression; +import tech.ydb.yoj.databind.DbType; import tech.ydb.yoj.databind.schema.Column; import tech.ydb.yoj.databind.schema.GlobalIndex; import tech.ydb.yoj.databind.schema.Schema; @@ -12,7 +13,6 @@ import tech.ydb.yoj.repository.db.EntitySchema; import tech.ydb.yoj.repository.db.Table; import tech.ydb.yoj.repository.db.ViewSchema; -import tech.ydb.yoj.repository.ydb.DbType; import java.util.List; import java.util.Map; diff --git a/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/yql/YqlTypeAllTypesTest.java b/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/yql/YqlTypeAllTypesTest.java index d7708ebe..e32c41fa 100644 --- a/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/yql/YqlTypeAllTypesTest.java +++ b/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/yql/YqlTypeAllTypesTest.java @@ -10,13 +10,13 @@ import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameter; import org.junit.runners.Parameterized.Parameters; +import tech.ydb.yoj.databind.DbType; import tech.ydb.yoj.databind.FieldValueType; import tech.ydb.yoj.databind.schema.Column; import tech.ydb.yoj.databind.schema.Schema; import tech.ydb.yoj.repository.DbTypeQualifier; import tech.ydb.yoj.repository.db.common.CommonConverters; import tech.ydb.yoj.repository.db.json.JacksonJsonConverter; -import tech.ydb.yoj.repository.ydb.DbType; import java.lang.reflect.Type; import java.time.Duration; diff --git a/repository/src/test/java/tech/ydb/yoj/repository/db/PojoEntitySchemaTest.java b/repository/src/test/java/tech/ydb/yoj/repository/db/PojoEntitySchemaTest.java index c4075518..6fdd44ea 100644 --- a/repository/src/test/java/tech/ydb/yoj/repository/db/PojoEntitySchemaTest.java +++ b/repository/src/test/java/tech/ydb/yoj/repository/db/PojoEntitySchemaTest.java @@ -2,6 +2,7 @@ import lombok.Value; import org.junit.Test; +import tech.ydb.yoj.databind.DbType; import tech.ydb.yoj.databind.schema.Column; import static org.assertj.core.api.Assertions.assertThat; @@ -101,7 +102,7 @@ private static final class ColumnNameClashes implements Entity id() { record EntityIncorrectSpecifyInterface(CorrectEntity.Id id) implements RecordEntity { } - record ColumnNameClashes(@Column Id id, @Column(name = "id", dbType = "UTF8") String value) implements RecordEntity { + record ColumnNameClashes(@Column Id id, @Column(name = "id", dbType = DbType.UTF8) String value) implements RecordEntity { record Id(@Column long uid) implements Entity.Id { } }