Skip to content
This repository was archived by the owner on Jun 6, 2019. It is now read-only.

Commit f2d9f23

Browse files
authored
Merge pull request #19 from go-xorm/develop
fixes bug: go-xorm/xorm#560
2 parents 09730da + 52b4a02 commit f2d9f23

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

xorm/go.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -201,32 +201,28 @@ func tag(table *core.Table, col *core.Column) string {
201201
isNameId := (mapper.Table2Obj(col.Name) == "Id")
202202
isIdPk := isNameId && typestring(col) == "int64"
203203

204-
res := make([]string, 0)
204+
var res []string
205205
if !col.Nullable {
206206
if !isIdPk {
207207
res = append(res, "not null")
208208
}
209209
}
210210
if col.IsPrimaryKey {
211-
if !isIdPk {
212-
res = append(res, "pk")
213-
}
211+
res = append(res, "pk")
214212
}
215213
if col.Default != "" {
216214
res = append(res, "default "+col.Default)
217215
}
218216
if col.IsAutoIncrement {
219-
if !isIdPk {
220-
res = append(res, "autoincr")
221-
}
217+
res = append(res, "autoincr")
222218
}
223219
if col.IsCreated {
224220
res = append(res, "created")
225221
}
226222
if col.IsUpdated {
227223
res = append(res, "updated")
228224
}
229-
for name, _ := range col.Indexes {
225+
for name := range col.Indexes {
230226
index := table.Indexes[name]
231227
var uistr string
232228
if index.Type == core.UniqueType {

0 commit comments

Comments
 (0)