Skip to content

Conversation

@GV14982
Copy link
Contributor

@GV14982 GV14982 commented Oct 13, 2025

  • Added another constructor for an in memory sqlite db for previews
  • Some small error handling cleanup
  • A bit of other conditionals to handle preview feeds

Please add the hackoberfest-accepted label before merging :)

- Added another constructor for an in memory sqlite db for previews
- Some small error handling cleanup
- A bit of other conditionals to handle preview feeds
}

func (sls *SQLiteStore) UpsertItem(item Item) error {
func (sls *SQLiteStore) UpsertItem(item Item) (int, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the changes are much less invasive if instead of adding an additional return parameter you instead have this take a pointer-to-Item:

Suggested change
func (sls *SQLiteStore) UpsertItem(item Item) (int, error) {
func (sls *SQLiteStore) UpsertItem(item *Item) error {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's a great idea.

cmd/nom/main.go Outdated
s, err := store.NewSQLiteStore(cfg.ConfigDir, cfg.Database)
var s store.Store
if cfg.IsPreviewMode() {
cfg.Ordering = constants.DescendingOrdering
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does preview mode get a different default ordering? And in particular, one that overrides whatever value the user has explicitly configured?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was just because when you first open the preview mode it always opens in descending order. When you select an item then go back to the list, it would switch which seemed jarring. I can instead get the preview mode to use the users ordering.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@guyfedwards should I keep the existing functionality or update this to use the user's default sort? I can go either way imo

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say use the users default sort 👍

@GV14982 GV14982 requested review from guyfedwards and larsks October 14, 2025 00:46
Copy link
Contributor

@larsks larsks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@guyfedwards guyfedwards merged commit 22c4957 into guyfedwards:master Oct 14, 2025
2 checks passed
@guyfedwards
Copy link
Owner

Thanks for the contribution @GV14982 and thanks for reviewing @larsks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants