Skip to content

Conversation

@yhabteab
Copy link
Member

@yhabteab yhabteab commented May 27, 2024

No description provided.

@cla-bot cla-bot bot added the cla/signed CLA is signed by all contributors of a PR label May 27, 2024
@yhabteab yhabteab force-pushed the query-builder branch 2 times, most recently from 13775df to 9cfb220 Compare May 27, 2024 13:39
@yhabteab yhabteab force-pushed the icinga-notifications branch from cfb45a9 to 7f3095c Compare May 27, 2024 13:40
@yhabteab yhabteab force-pushed the query-builder branch 2 times, most recently from 474ff25 to 3e9722f Compare May 28, 2024 10:16
@yhabteab yhabteab force-pushed the icinga-notifications branch from 7f3095c to 89805fa Compare May 28, 2024 15:09
@yhabteab yhabteab requested a review from Al2Klimov May 28, 2024 15:09
Comment on lines 63 to 68
// TxOrDB is just a helper interface that can represent a *[sqlx.Tx] or *[DB] instance.
type TxOrDB interface {
sqlx.ExtContext
sqlx.PreparerContext

PrepareNamedContext(ctx context.Context, query string) (*sqlx.NamedStmt, error)
}
Copy link
Member

Choose a reason for hiding this comment

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

Also the whole thing seems just a subset of DB&Tx. I personally would unexport and move it...

Copy link
Member Author

Choose a reason for hiding this comment

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

Wouldn't you also want to use this interface type elsewhere where a DB or Tx is required?

Copy link
Member

Choose a reason for hiding this comment

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

First of all: (Where) Do you actually plan to pass a DB into your new function?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't have any (yet), I was just trying to say that it's not that special and one can use it anywhere else if they need to.

Copy link
Member

Choose a reason for hiding this comment

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

For me the last insert ID makes only sense for immediate subsequent processing – which just screams transaction. So I'd just allow Tx as parameter for now unless/until someone finds an actual use case with DB. (But then I'd:

  1. unexport the interface OR
  2. aggregate there all interfaces and non-interface methods both Tx and DB implement.)

}
}

// InsertObtainID executes the given query and fetches the last inserted ID.
Copy link
Member

Choose a reason for hiding this comment

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

... here due to how special it is.

@yhabteab yhabteab force-pushed the icinga-notifications branch from 89805fa to b9e7928 Compare May 28, 2024 16:13
@yhabteab yhabteab force-pushed the icinga-notifications branch from b9e7928 to 7a11e5d Compare May 28, 2024 16:15
@yhabteab yhabteab requested a review from Al2Klimov May 28, 2024 16:15
@lippserd lippserd self-requested a review August 14, 2024 10:47
Copy link
Member

@lippserd lippserd left a comment

Choose a reason for hiding this comment

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

Please split pr the into two.

@yhabteab
Copy link
Member Author

The commits are split into their own PRs so that this is no longer necessary.

@yhabteab yhabteab closed this Aug 14, 2024
@yhabteab yhabteab deleted the icinga-notifications branch August 14, 2024 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla/signed CLA is signed by all contributors of a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants