CheckVersionExists checks if a specific version exists for a server
(ctx context.Context, tx pgx.Tx, serverName, version string)
| 866 | |
| 867 | // CheckVersionExists checks if a specific version exists for a server |
| 868 | func (db *PostgreSQL) CheckVersionExists(ctx context.Context, tx pgx.Tx, serverName, version string) (bool, error) { |
| 869 | if ctx.Err() != nil { |
| 870 | return false, ctx.Err() |
| 871 | } |
| 872 | |
| 873 | executor := db.getExecutor(tx) |
| 874 | |
| 875 | query := `SELECT EXISTS(SELECT 1 FROM servers WHERE server_name = $1 AND version = $2)` |
| 876 | |
| 877 | var exists bool |
| 878 | err := executor.QueryRow(ctx, query, serverName, version).Scan(&exists) |
| 879 | if err != nil { |
| 880 | return false, fmt.Errorf("failed to check version existence: %w", err) |
| 881 | } |
| 882 | |
| 883 | return exists, nil |
| 884 | } |
| 885 | |
| 886 | // UnmarkAsLatest marks the current latest version of a server as no longer latest |
| 887 | func (db *PostgreSQL) UnmarkAsLatest(ctx context.Context, tx pgx.Tx, serverName string) error { |
nothing calls this directly
no test coverage detected