fix(note_repo): pass ctx
This commit is contained in:
parent
2537140053
commit
f8e9b3902d
1 changed files with 3 additions and 3 deletions
|
|
@ -10,7 +10,7 @@ import (
|
||||||
|
|
||||||
type ITagRepository interface {
|
type ITagRepository interface {
|
||||||
Upsert(ctx context.Context, tags []*models.Tag) error
|
Upsert(ctx context.Context, tags []*models.Tag) error
|
||||||
UpsertNoteTags(noteID string, tagIDs []string) error
|
UpsertNoteTags(ctx context.Context, noteID string, tagIDs []string) error
|
||||||
}
|
}
|
||||||
|
|
||||||
type tagRepository struct {
|
type tagRepository struct {
|
||||||
|
|
@ -40,7 +40,7 @@ func (r *tagRepository) Upsert(ctx context.Context, tags []*models.Tag) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *tagRepository) UpsertNoteTags(noteID string, tagIDs []string) error {
|
func (r *tagRepository) UpsertNoteTags(ctx context.Context ,noteID string, tagIDs []string) error {
|
||||||
if len(tagIDs) == 0 {
|
if len(tagIDs) == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
@ -55,7 +55,7 @@ func (r *tagRepository) UpsertNoteTags(noteID string, tagIDs []string) error {
|
||||||
|
|
||||||
query := "INSERT OR IGNORE INTO note_tags(note_id, tag_id) VALUES " + strings.Join(placeholders, ",")
|
query := "INSERT OR IGNORE INTO note_tags(note_id, tag_id) VALUES " + strings.Join(placeholders, ",")
|
||||||
|
|
||||||
_, err := r.Transaction.ExecContext(context.Background(), query, args...)
|
_, err := r.Transaction.ExecContext(ctx, query, args...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue