Annotations: Improve updating annotation tags queries (#71201)

Annotations: Improve annotation tag updates
This commit is contained in:
Emil Tullstedt
2023-07-31 18:19:59 +03:00
committed by GitHub
parent cdfbcb2ec6
commit ab0a115372
2 changed files with 83 additions and 29 deletions
+17
View File
@@ -12,13 +12,30 @@ import (
)
type DB interface {
// WithTransactionalDbSession creates a new SQL transaction to ensure consistency
// for the database operations done within the [sqlstore.DBTransactionFunc].
// It's better to combine InTransaction and WithDbSession instead, as the context
// variable is not updated when using this method.
WithTransactionalDbSession(ctx context.Context, callback sqlstore.DBTransactionFunc) error
// WithDbSession runs database operations either in an existing transaction available
// through [context.Context] or if that's not present, as non-transactional database
// operations.
WithDbSession(ctx context.Context, callback sqlstore.DBTransactionFunc) error
// WithNewDbSession behaves like [DB.WithDbSession] without picking up a transaction
// from the context.
WithNewDbSession(ctx context.Context, callback sqlstore.DBTransactionFunc) error
// GetDialect returns an object that contains information about the peculiarities of
// the particular database type available to the runtime.
GetDialect() migrator.Dialect
// GetDBType returns the name of the database type available to the runtime.
GetDBType() core.DbType
// GetSqlxSession is an experimental extension to use sqlx instead of xorm to
// communicate with the database.
GetSqlxSession() *session.SessionDB
// InTransaction creates a new SQL transaction that is placed on the context.
// Use together with [DB.WithDbSession] to run database operations.
InTransaction(ctx context.Context, fn func(ctx context.Context) error) error
// Quote wraps an identifier so that it cannot be mistaken for an SQL keyword.
Quote(value string) string
// RecursiveQueriesAreSupported runs a dummy recursive query and it returns true
// if the query runs successfully or false if it fails with mysqlerr.ER_PARSE_ERROR error or any other error