jet
jet copied to clipboard
How to get rowid in sqlite database ?
I need to retrieve row id from sqlite table, my query like so :
SELECT(table.Account.AllColumns).FROM(table.Account)
I can't get the row id from the table, maybe you have a solution?
I think in generating tables and models, we should add:
Rowid int
Hi @ibadi-id. Check raw expression and faq.
stmt := SELECT(
Raw("rowid").AS("row_id"),
Account.AllColumns,
).FROM(Account)
var dest struct {
RowID int64
model.Account
}
err := stmt.Query(db, &dest)