Xorm cannot augment itself by using Sqlite3 to drive the primary key.

the environment I use is

go version go1.11.1 windows/amd64
xorm + Sqlite3 

I am using

type User struct {
Id      int       `json:"id" xorm:"pk autoincr unique(UNIQUE) INT(10) notnull"`
Name    string    `json:"name" xorm:"VARCHAR(50) notnull"`
}

user := new(User)
user.Name = "myname"
affected, err := engine.Insert(user)

prompt me when inserting data

NOT NULL constraint failed: user.id

I have a competitive autoincr field written above
I"m stuck here
is there a god who would like to take a look at it for me?
wait online, thank you!

Dec.28,2021

you are not like me. You should not have set that field to self-increasing

.
Menu