WIP.
This commit is contained in:
parent
098201418b
commit
58a01bff56
5 changed files with 99 additions and 26 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue