upper / db

Data Access Layer (DAL) for PostgreSQL, CockroachDB, MySQL, SQLite and MongoDB with ORM-like features.
https://upper.io/
MIT License
3.54k stars 235 forks source link

record save will auto rollback #665

Open wzhsh90 opened 2 years ago

wzhsh90 commented 2 years ago

image type Company struct { Id string db:"id" form:"id" json:"id" ComDesc string db:"com_desc" form:"com_desc" json:"com_desc" ComName string db:"com_name" form:"com_name" json:"com_name" } func (b *Company) Store(sess db.Session) db.Store { return sess.Collection("sys_company_t") }

this is my model , i use .Save(record) method , the log show insert success , but the database is none.

Transaction ID: 00004 Query: INSERT INTO sys_company_t (com_desc, com_name, id) VALUES (?, ?, ?) Arguments: []interface {}{"1", "1", "62dbd5f15320e7a9b0318a9a"} Rows affected: 1 Last insert ID: 0 Time taken: 0.00063s Context: context.Background

the reason is image

InsertReturning throw the error "upper: no more rows in this result set"