This commit is contained in:
Benjamin A. Shelton 2026-10-20 20:17:29 -06:00
commit 58a01bff56
Signed by: zancarius
GPG key ID: 8BD42DBD6C337E01
5 changed files with 99 additions and 26 deletions

View file

@ -51,13 +51,13 @@ func (cm *ChatModel) ListChats() ([]*Chat, error) {
return cm.chats, nil
}
var chats []*Chat
err := cm.db.GetContext(cm.ctx, chats,
chats := []*Chat{}
err := cm.db.SelectContext(cm.ctx, &chats,
`select id, name from chats where id < 0`)
if err != nil {
if errors.Is(err, sql.ErrNoRows) {
cm.chats = chats
return chats, nil
return nil, ErrNoRows.Do(err)
}
if serr, ok := errors.AsType[sqlite3.Error](err); ok {
switch serr.ExtendedCode {