Skip to content

Commit 32efeba

Browse files
committed
refactor: reorganize package structure for better domain grouping
- telemetry/ → observability/ (with log/ merged as observability/logger/) - jsondiff/, rql/ → data/jsondiff/, data/rql/ - Fix otelhhtpclient typo → otelhttpclient - Inline utils/error_status into observability/otelgrpc/status.go, delete utils/ - Rename log package to logger to match directory - Update all internal imports and README
1 parent 91ffa37 commit 32efeba

28 files changed

Lines changed: 88 additions & 75 deletions

README.md

Lines changed: 38 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,52 +14,65 @@ To use, run the following command:
1414
go get github.com/raystack/salt
1515
```
1616

17-
## Pacakages
17+
## Packages
1818

19-
### Configuration and Environment
20-
- **`config`**
19+
### Configuration
20+
- **`config`**
2121
Utilities for managing application configurations using environment variables, files, or defaults.
2222

2323
### CLI Utilities
24-
- **`cli/cmdx`**
25-
Command execution and management tools.
24+
- **`cli/commander`**
25+
Command execution, completion, help topics, and management tools.
2626

27-
- **`cli/printer`**
27+
- **`cli/printer`**
2828
Utilities for formatting and printing output to the terminal.
2929

30-
- **`cli/prompt`**
30+
- **`cli/prompter`**
3131
Interactive CLI prompts for user input.
3232

33-
- **`cli/terminal`**
34-
Terminal utilities for colors, cursor management, and formatting.
33+
- **`cli/terminator`**
34+
Terminal utilities for browser, pager, and brew helpers.
3535

36-
- **`cli/version`**
36+
- **`cli/releaser`**
3737
Utilities for displaying and managing CLI tool versions.
3838

3939
### Authentication and Security
40-
- **`auth/oidc`**
40+
- **`auth/oidc`**
4141
Helpers for integrating OpenID Connect authentication flows.
4242

43-
- **`auth/audit`**
43+
- **`auth/audit`**
4444
Auditing tools for tracking security events and compliance.
4545

4646
### Server and Infrastructure
47-
- **`server`**
48-
Utilities for setting up and managing HTTP or RPC servers.
47+
- **`server/mux`**
48+
gRPC-gateway multiplexer for serving gRPC and HTTP on a single port.
4949

50-
- **`db`**
50+
- **`server/spa`**
51+
Single-page application static file handler.
52+
53+
- **`db`**
5154
Helpers for database connections, migrations, and query execution.
5255

53-
- **`telemetry`**
54-
Observability tools for capturing application metrics and traces.
56+
### Observability
57+
- **`observability`**
58+
OpenTelemetry initialization, metrics, and tracing setup.
5559

56-
### Development and Testing
57-
- **`dockertestx`**
58-
Tools for creating and managing Docker-based testing environments.
60+
- **`observability/logger`**
61+
Structured logging with Zap and Logrus adapters.
62+
63+
- **`observability/otelgrpc`**
64+
OpenTelemetry gRPC client interceptors for metrics.
5965

60-
### Utilities
61-
- **`log`**
62-
Simplified logging utilities for structured and unstructured log messages.
66+
- **`observability/otelhttpclient`**
67+
OpenTelemetry HTTP client transport for metrics.
6368

64-
- **`utils`**
65-
General-purpose utility functions for common programming tasks.
69+
### Data Utilities
70+
- **`data/rql`**
71+
REST query language parser for filters, pagination, sorting, and search.
72+
73+
- **`data/jsondiff`**
74+
JSON document diffing and reconstruction.
75+
76+
### Development and Testing
77+
- **`testing/dockertestx`**
78+
Docker-based test environment helpers for Postgres, Minio, SpiceDB, and more.

auth/audit/repositories/dockertest_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ import (
1111
_ "github.com/lib/pq"
1212
"github.com/ory/dockertest/v3"
1313
"github.com/ory/dockertest/v3/docker"
14-
"github.com/raystack/salt/log"
14+
"github.com/raystack/salt/observability/logger"
1515
)
1616

17-
func newTestRepository(logger log.Logger) (*repositories.PostgresRepository, *dockertest.Pool, *dockertest.Resource, error) {
17+
func newTestRepository(logger logger.Logger) (*repositories.PostgresRepository, *dockertest.Pool, *dockertest.Resource, error) {
1818
host := "localhost"
1919
port := "5433"
2020
user := "test_user"

auth/audit/repositories/postgres_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"github.com/google/go-cmp/cmp"
1212
"github.com/google/go-cmp/cmp/cmpopts"
1313
"github.com/jmoiron/sqlx/types"
14-
"github.com/raystack/salt/log"
14+
"github.com/raystack/salt/observability/logger"
1515
"github.com/stretchr/testify/suite"
1616
)
1717

@@ -27,7 +27,7 @@ func TestPostgresRepository(t *testing.T) {
2727

2828
func (s *PostgresRepositoryTestSuite) SetupSuite() {
2929
var err error
30-
repository, pool, dockerResource, err := newTestRepository(log.NewLogrus())
30+
repository, pool, dockerResource, err := newTestRepository(logger.NewLogrus())
3131
if err != nil {
3232
s.T().Fatal(err)
3333
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ A Go library for calculating differences between JSON documents and reconstructi
1313
## Installation
1414

1515
```bash
16-
go get github.com/raystack/salt/jsondiff
16+
go get github.com/raystack/salt/data/jsondiff
1717
```
1818

1919
## Usage
@@ -28,7 +28,7 @@ import (
2828
"fmt"
2929
"reflect"
3030
"strings"
31-
"github.com/raystack/salt/jsondiff"
31+
"github.com/raystack/salt/data/jsondiff"
3232
)
3333

3434
func main() {
@@ -105,7 +105,7 @@ import (
105105
"fmt"
106106
"reflect"
107107
"strings"
108-
"github.com/raystack/salt/jsondiff"
108+
"github.com/raystack/salt/data/jsondiff"
109109
)
110110

111111
func main() {
File renamed without changes.

0 commit comments

Comments
 (0)