working notely

This commit is contained in:
wagslane
2023-05-30 21:42:09 -06:00
parent 80ec635705
commit e2c8b1bcd9
5 changed files with 63 additions and 132 deletions

View File

@@ -34,16 +34,6 @@ func (q *Queries) CreateNote(ctx context.Context, arg CreateNoteParams) error {
return err
}
const deleteNote = `-- name: DeleteNote :exec
DELETE FROM notes WHERE id = ?
`
func (q *Queries) DeleteNote(ctx context.Context, id string) error {
_, err := q.db.ExecContext(ctx, deleteNote, id)
return err
}
const getNote = `-- name: GetNote :one
SELECT id, created_at, updated_at, note, user_id FROM notes WHERE id = ?
@@ -95,19 +85,3 @@ func (q *Queries) GetNotesForUser(ctx context.Context, userID string) ([]Note, e
}
return items, nil
}
const updateNote = `-- name: UpdateNote :exec
UPDATE notes SET updated_at = ?, note = ? WHERE id = ?
`
type UpdateNoteParams struct {
UpdatedAt time.Time
Note string
ID string
}
func (q *Queries) UpdateNote(ctx context.Context, arg UpdateNoteParams) error {
_, err := q.db.ExecContext(ctx, updateNote, arg.UpdatedAt, arg.Note, arg.ID)
return err
}