Skip to content

Commit bb5a076

Browse files
authored
style: apply gofmt formatting to all Go files
style: apply gofmt formatting to all Go files
2 parents 8567243 + 2834926 commit bb5a076

15 files changed

+39
-46
lines changed

integration_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,4 +557,4 @@ func BenchmarkIntegration_ExecuteQuery(b *testing.B) {
557557
b.Fatal(err)
558558
}
559559
}
560-
}
560+
}

internal/app/app.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,4 +323,4 @@ func (a *App) ensureConnection() error {
323323
}
324324

325325
return nil
326-
}
326+
}

internal/app/app_test.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,6 @@ func TestApp_SetLogger(t *testing.T) {
127127
assert.Equal(t, newLogger, app.logger)
128128
}
129129

130-
131-
132-
133130
func TestApp_Disconnect(t *testing.T) {
134131
app, _ := New()
135132
mockClient := &MockPostgreSQLClient{}
@@ -534,4 +531,4 @@ func TestApp_ListIndexes(t *testing.T) {
534531
assert.NoError(t, err)
535532
assert.Equal(t, expectedIndexes, indexes)
536533
mockClient.AssertExpectations(t)
537-
}
534+
}

internal/app/client.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ func (c *PostgreSQLClientImpl) Connect(connectionString string) error {
4242
func (c *PostgreSQLClientImpl) Close() error {
4343
if c.db != nil {
4444
if err := c.db.Close(); err != nil {
45-
return fmt.Errorf("failed to close database: %w", err)
46-
}
47-
return nil
45+
return fmt.Errorf("failed to close database: %w", err)
46+
}
47+
return nil
4848
}
4949
return nil
5050
}
@@ -461,4 +461,4 @@ func (c *PostgreSQLClientImpl) ExplainQuery(query string, args ...interface{}) (
461461
Rows: result,
462462
RowCount: len(result),
463463
}, nil
464-
}
464+
}

internal/app/client_mocked_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ func TestPostgreSQLClient_QueryValidationLogic(t *testing.T) {
9696
shouldAllow: true,
9797
},
9898
{
99-
name: "select lowercase",
100-
query: "select * from users",
101-
shouldAllow: false,
99+
name: "select lowercase",
100+
query: "select * from users",
101+
shouldAllow: false,
102102
expectedError: "only SELECT and WITH queries are allowed",
103103
},
104104
{
@@ -256,4 +256,4 @@ func TestPostgreSQLClient_SchemaDefaults(t *testing.T) {
256256
assert.Contains(t, err.Error(), "no database connection")
257257
})
258258
}
259-
}
259+
}

internal/app/client_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -273,10 +273,10 @@ func TestPostgreSQLClient_ExecuteQueryInvalidQueries(t *testing.T) {
273273
if tt.expectError {
274274
assert.Error(t, err)
275275
if tt.errorMsg == "only SELECT and WITH queries are allowed" {
276-
assert.Contains(t, err.Error(), "no database connection")
277-
} else {
278-
assert.Contains(t, err.Error(), tt.errorMsg)
279-
}
276+
assert.Contains(t, err.Error(), "no database connection")
277+
} else {
278+
assert.Contains(t, err.Error(), tt.errorMsg)
279+
}
280280
assert.Nil(t, result)
281281
} else {
282282
assert.NoError(t, err)
@@ -465,4 +465,4 @@ func TestExecuteQueryEmptyResult(t *testing.T) {
465465
assert.Equal(t, 0, result.RowCount)
466466
assert.Len(t, result.Rows, 0)
467467
assert.Len(t, result.Columns, 0)
468-
}
468+
}

internal/app/interfaces.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ var (
1010
ErrConnectionRequired = errors.New(
1111
"database connection failed. Please check POSTGRES_URL or DATABASE_URL environment variable",
1212
)
13-
ErrSchemaRequired = errors.New("schema name is required")
14-
ErrTableRequired = errors.New("table name is required")
15-
ErrQueryRequired = errors.New("query is required")
16-
ErrInvalidQuery = errors.New("only SELECT and WITH queries are allowed")
13+
ErrSchemaRequired = errors.New("schema name is required")
14+
ErrTableRequired = errors.New("table name is required")
15+
ErrQueryRequired = errors.New("query is required")
16+
ErrInvalidQuery = errors.New("only SELECT and WITH queries are allowed")
1717
ErrNoConnectionString = errors.New(
1818
"no database connection string found in POSTGRES_URL or DATABASE_URL environment variables",
1919
)
@@ -58,20 +58,20 @@ type ColumnInfo struct {
5858

5959
// IndexInfo represents index metadata.
6060
type IndexInfo struct {
61-
Name string `json:"name"`
62-
Table string `json:"table"`
63-
Columns []string `json:"columns"`
64-
IsUnique bool `json:"is_unique"`
65-
IsPrimary bool `json:"is_primary"`
66-
IndexType string `json:"index_type"`
67-
Size string `json:"size,omitempty"`
61+
Name string `json:"name"`
62+
Table string `json:"table"`
63+
Columns []string `json:"columns"`
64+
IsUnique bool `json:"is_unique"`
65+
IsPrimary bool `json:"is_primary"`
66+
IndexType string `json:"index_type"`
67+
Size string `json:"size,omitempty"`
6868
}
6969

7070
// QueryResult represents the result of a query execution.
7171
type QueryResult struct {
72-
Columns []string `json:"columns"`
73-
Rows [][]interface{} `json:"rows"`
74-
RowCount int `json:"row_count"`
72+
Columns []string `json:"columns"`
73+
Rows [][]interface{} `json:"rows"`
74+
RowCount int `json:"row_count"`
7575
}
7676

7777
// ConnectionManager handles database connection operations.
@@ -109,4 +109,4 @@ type PostgreSQLClient interface {
109109
DatabaseExplorer
110110
TableExplorer
111111
QueryExecutor
112-
}
112+
}

internal/app/interfaces_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,4 +315,4 @@ func TestQueryResultWithMixedTypes(t *testing.T) {
315315
assert.Equal(t, float64(30), deserializedResult.Rows[0][2])
316316
assert.Equal(t, true, deserializedResult.Rows[0][3])
317317
assert.Equal(t, 95.5, deserializedResult.Rows[0][4])
318-
}
318+
}

internal/logger/logger.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ func NewLogger(level string) *slog.Logger {
2424

2525
handler := slog.NewTextHandler(os.Stderr, opts)
2626
return slog.New(handler)
27-
}
27+
}

internal/logger/logger_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,4 +213,4 @@ func TestLoggerCaseInsensitive(t *testing.T) {
213213
assert.NotNil(t, logger)
214214
})
215215
}
216-
}
216+
}

0 commit comments

Comments
 (0)