Skip to content

Commit

Permalink
Added new resource into model command
Browse files Browse the repository at this point in the history
Removed undefined sql variable from rep insertparse
  • Loading branch information
grrlopes committed Jul 7, 2023
1 parent 249fb14 commit 0c40006
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
22 changes: 12 additions & 10 deletions entity/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ import (
)

type Command struct {
Content string
Cursor int
Ready bool
Selected string
Viewport viewport.Model
Start int
End int
PageTotal int
Pagination *paginator.Model
Count int
Content string
Cursor int
Ready bool
Selected string
Viewport viewport.Model
Start int
End int
PageTotal int
Pagination *paginator.Model
Count int
ActiveSyncScreen bool
StatusSyncScreen bool
}
8 changes: 0 additions & 8 deletions repositories/sqlite/sqliterepository.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ package sqlite

import (
"database/sql"
"errors"
"log"

"github.com/grrlopes/storydb/repositories"
"github.com/mattn/go-sqlite3"
)

type SQLiteRepository struct {
Expand Down Expand Up @@ -100,12 +98,6 @@ func (sql *SQLiteRepository) Count() (int, error) {
func (sql SQLiteRepository) InsertParsed(data string) (int64, error) {
res, err := sql.db.Exec("INSERT INTO command(title, description) values(?, ?)", data, "--")
if err != nil {
var sqliteErr sqlite3.Error
if errors.As(err, &sqliteErr) {
if errors.Is(sqliteErr.ExtendedCode, sqlite3.ErrConstraintUnique) {
return 0, err
}
}
return 0, err
}

Expand Down

0 comments on commit 0c40006

Please sign in to comment.