From 2c13ea008e0d44887d973c1ffab64cec5786a2c2 Mon Sep 17 00:00:00 2001 From: piyongcai Date: Fri, 13 May 2022 17:35:11 +0800 Subject: [PATCH] =?UTF-8?q?1.Add=20UniqueIndex=20field=20to=20Field's=20st?= =?UTF-8?q?ruct=E3=80=82=202.Resolve=20UniqueIndex=20value=20from=20Struct?= =?UTF-8?q?Field.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- schema/field.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/schema/field.go b/schema/field.go index d6df6596..7d8704f6 100644 --- a/schema/field.go +++ b/schema/field.go @@ -68,6 +68,7 @@ type Field struct { DefaultValue string DefaultValueInterface interface{} NotNull bool + UniqueIndex bool Unique bool Comment string Size int @@ -114,6 +115,7 @@ func (schema *Schema) ParseField(fieldStruct reflect.StructField) *Field { HasDefaultValue: utils.CheckTruth(tagSetting["AUTOINCREMENT"]), NotNull: utils.CheckTruth(tagSetting["NOT NULL"], tagSetting["NOTNULL"]), Unique: utils.CheckTruth(tagSetting["UNIQUE"]), + UniqueIndex: utils.CheckTruth(tagSetting["UNIQUEINDEX"]), Comment: tagSetting["COMMENT"], AutoIncrementIncrement: 1, }