Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/FUNDING.yaml

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAP_GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }}
MICKAMY_GITHUB_TOKEN: ${{ secrets.MICKAMY_GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ formatters:
settings:
goimports:
local-prefixes:
- github.com/mickamy/sql-tap
- github.com/proto-tap/sql-tap

linters:
default: all
Expand Down
44 changes: 27 additions & 17 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,33 +36,43 @@ archives:
- tar.gz
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"

brews:
homebrew_casks:
- name: sql-tap
homepage: https://github.com/mickamy/sql-tap
homepage: https://github.com/proto-tap/sql-tap
description: Watch SQL traffic in real-time with a TUI
directory: Formula
install: |
bin.install "sql-tap"
bin.install "sql-tapd"
binaries:
- sql-tap
- sql-tapd
hooks:
post:
install_steps: |
on_macos do
run "/usr/bin/xattr", args: ["-dr", "com.apple.quarantine", "{{ .StagedPath }}"]
end
repository:
owner: mickamy
owner: proto-tap
name: homebrew-tap
token: "{{ .Env.TAP_GITHUB_TOKEN }}"

nix:
# Publishes a Nix derivation that installs pre-built binaries to
# the mickamy/nur-packages repository on each release.
# Prerequisites:
# 1. Create the mickamy/nur-packages repository (NUR-compatible layout).
# 2. Add "install nix" step to the release workflow so nix-hash is available.
# Points existing mickamy/tap users to the cask. Remove after the migration release.
brews:
- name: sql-tap
homepage: https://github.com/mickamy/sql-tap
homepage: https://github.com/proto-tap/sql-tap
description: Watch SQL traffic in real-time with a TUI
license: mit
directory: Formula
install: |
bin.install "sql-tap"
bin.install "sql-tapd"
custom_block: |
disable! date: "2027-04-27", because: "has moved to the proto-tap/tap cask", replacement_cask: "proto-tap/tap/sql-tap"
caveats: |
sql-tap has moved to the proto-tap/tap cask. Switch with:
brew uninstall sql-tap
brew install --cask proto-tap/tap/sql-tap
repository:
owner: mickamy
name: nur-packages
token: "{{ .Env.TAP_GITHUB_TOKEN }}"
name: homebrew-tap
token: "{{ .Env.MICKAMY_GITHUB_TOKEN }}"

changelog:
sort: asc
25 changes: 17 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,29 @@ your application code.
### Homebrew

```bash
brew install mickamy/tap/sql-tap
brew install --cask proto-tap/tap/sql-tap
```

> [!NOTE]
> sql-tap has moved from the `mickamy/tap` formula to the `proto-tap/tap` cask. If you installed it from `mickamy/tap`,
> switch with:
>
> ```bash
> brew uninstall sql-tap
> brew install --cask proto-tap/tap/sql-tap
> ```

### Go

```bash
go install github.com/mickamy/sql-tap@latest
go install github.com/mickamy/sql-tap/cmd/sql-tapd@latest
go install github.com/proto-tap/sql-tap@latest
go install github.com/proto-tap/sql-tap/cmd/sql-tapd@latest
```

### Build from source

```bash
git clone https://github.com/mickamy/sql-tap.git
git clone https://github.com/proto-tap/sql-tap.git
cd sql-tap
make install
```
Expand All @@ -39,7 +48,7 @@ make install
**Using the flake directly**

```bash
nix profile install github:mickamy/sql-tap
nix profile install github:proto-tap/sql-tap
```

**In a `devenv.sh` project**
Expand All @@ -49,7 +58,7 @@ Add `sql-tap` as a flake input in `devenv.yaml`:
```yaml
inputs:
sql-tap:
url: github:mickamy/sql-tap
url: github:proto-tap/sql-tap
```

Then reference it in `devenv.nix`:
Expand All @@ -69,7 +78,7 @@ Then reference it in `devenv.nix`:
FROM alpine:3
ARG SQL_TAP_VERSION=0.0.1
ARG TARGETARCH
ADD https://github.com/mickamy/sql-tap/releases/download/v${SQL_TAP_VERSION}/sql-tap_${SQL_TAP_VERSION}_linux_${TARGETARCH}.tar.gz /tmp/sql-tap.tar.gz
ADD https://github.com/proto-tap/sql-tap/releases/download/v${SQL_TAP_VERSION}/sql-tap_${SQL_TAP_VERSION}_linux_${TARGETARCH}.tar.gz /tmp/sql-tap.tar.gz
RUN tar -xzf /tmp/sql-tap.tar.gz -C /usr/local/bin sql-tapd && rm /tmp/sql-tap.tar.gz
ENTRYPOINT ["sql-tapd"]
```
Expand Down Expand Up @@ -399,7 +408,7 @@ sql-tapd parses the database wire protocol (PostgreSQL, MySQL, or TiDB) to inter

## See also

- **[grpc-tap](https://github.com/mickamy/grpc-tap)** — Same concept for gRPC. Transparent HTTP/2 reverse proxy that
- **[grpc-tap](https://github.com/proto-tap/grpc-tap)** — Same concept for gRPC. Transparent HTTP/2 reverse proxy that
captures every gRPC / gRPC-Web / Connect call with TUI + Web UI.

## License
Expand Down
2 changes: 1 addition & 1 deletion broker/broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import (
"sync"

"github.com/mickamy/sql-tap/proxy"
"github.com/proto-tap/sql-tap/proxy"
)

// Broker implements a non-blocking fan-out pub/sub for proxy events.
Expand All @@ -16,7 +16,7 @@
}

func New(bufSize int) *Broker {
return &Broker{

Check failure on line 19 in broker/broker.go

View workflow job for this annotation

GitHub Actions / lint

broker.Broker is missing fields mu, nextID (exhaustruct_v5)

Check failure on line 19 in broker/broker.go

View workflow job for this annotation

GitHub Actions / lint

broker.Broker is missing fields mu, nextID (exhaustruct_v5)
subscribers: make(map[int]chan proxy.Event),
bufSize: bufSize,
}
Expand Down
4 changes: 2 additions & 2 deletions broker/broker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"testing"
"time"

"github.com/mickamy/sql-tap/broker"
"github.com/mickamy/sql-tap/proxy"
"github.com/proto-tap/sql-tap/broker"
"github.com/proto-tap/sql-tap/proxy"
)

func TestBroker_PublishSubscribe(t *testing.T) {
Expand All @@ -16,7 +16,7 @@
ch, unsub := b.Subscribe()
defer unsub()

ev := proxy.Event{ID: "1", Op: proxy.OpQuery, Query: "SELECT 1"}

Check failure on line 19 in broker/broker_test.go

View workflow job for this annotation

GitHub Actions / lint

proxy.Event is missing fields Args, StartTime, Duration, RowsAffected, Error, TxID, NPlus1, SlowQuery, NormalizedQuery (exhaustruct_v5)

Check failure on line 19 in broker/broker_test.go

View workflow job for this annotation

GitHub Actions / lint

proxy.Event is missing fields Args, StartTime, Duration, RowsAffected, Error, TxID, NPlus1, SlowQuery, NormalizedQuery (exhaustruct_v5)
b.Publish(ev)

select {
Expand All @@ -43,7 +43,7 @@
t.Fatalf("expected 2 subscribers, got %d", b.SubscriberCount())
}

ev := proxy.Event{ID: "1"}

Check failure on line 46 in broker/broker_test.go

View workflow job for this annotation

GitHub Actions / lint

proxy.Event is missing fields Op, Query, Args, StartTime, Duration, RowsAffected, Error, TxID, NPlus1, SlowQuery, NormalizedQuery (exhaustruct_v5)

Check failure on line 46 in broker/broker_test.go

View workflow job for this annotation

GitHub Actions / lint

proxy.Event is missing fields Op, Query, Args, StartTime, Duration, RowsAffected, Error, TxID, NPlus1, SlowQuery, NormalizedQuery (exhaustruct_v5)
b.Publish(ev)

for _, ch := range []<-chan proxy.Event{ch1, ch2} {
Expand Down Expand Up @@ -89,9 +89,9 @@
defer unsub()

// Fill the buffer.
b.Publish(proxy.Event{ID: "1"})

Check failure on line 92 in broker/broker_test.go

View workflow job for this annotation

GitHub Actions / lint

proxy.Event is missing fields Op, Query, Args, StartTime, Duration, RowsAffected, Error, TxID, NPlus1, SlowQuery, NormalizedQuery (exhaustruct_v5)

Check failure on line 92 in broker/broker_test.go

View workflow job for this annotation

GitHub Actions / lint

proxy.Event is missing fields Op, Query, Args, StartTime, Duration, RowsAffected, Error, TxID, NPlus1, SlowQuery, NormalizedQuery (exhaustruct_v5)
// This should be dropped, not block.
b.Publish(proxy.Event{ID: "2"})

Check failure on line 94 in broker/broker_test.go

View workflow job for this annotation

GitHub Actions / lint

proxy.Event is missing fields Op, Query, Args, StartTime, Duration, RowsAffected, Error, TxID, NPlus1, SlowQuery, NormalizedQuery (exhaustruct_v5)

Check failure on line 94 in broker/broker_test.go

View workflow job for this annotation

GitHub Actions / lint

proxy.Event is missing fields Op, Query, Args, StartTime, Duration, RowsAffected, Error, TxID, NPlus1, SlowQuery, NormalizedQuery (exhaustruct_v5)

select {
case got := <-ch:
Expand Down Expand Up @@ -122,7 +122,7 @@
for i := range n {
go func() {
defer wg.Done()
b.Publish(proxy.Event{ID: string(rune('A' + i%26))})

Check failure on line 125 in broker/broker_test.go

View workflow job for this annotation

GitHub Actions / lint

proxy.Event is missing fields Op, Query, Args, StartTime, Duration, RowsAffected, Error, TxID, NPlus1, SlowQuery, NormalizedQuery (exhaustruct_v5)

Check failure on line 125 in broker/broker_test.go

View workflow job for this annotation

GitHub Actions / lint

proxy.Event is missing fields Op, Query, Args, StartTime, Duration, RowsAffected, Error, TxID, NPlus1, SlowQuery, NormalizedQuery (exhaustruct_v5)
}()
}
wg.Wait()
Expand Down
2 changes: 1 addition & 1 deletion buf.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ managed:
enabled: true
override:
- file_option: go_package_prefix
value: github.com/mickamy/sql-tap/gen
value: github.com/proto-tap/sql-tap/gen
plugins:
- remote: buf.build/protocolbuffers/go
out: gen
Expand Down
2 changes: 1 addition & 1 deletion ci/ci.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/status"

tapv1 "github.com/mickamy/sql-tap/gen/tap/v1"
tapv1 "github.com/proto-tap/sql-tap/gen/tap/v1"
)

// Result holds the CI run outcome.
Expand Down Expand Up @@ -132,7 +132,7 @@
}

func newAggregator() *aggregator {
return &aggregator{grouped: make(map[string]*queryStats)}

Check failure on line 135 in ci/ci.go

View workflow job for this annotation

GitHub Actions / lint

ci.aggregator is missing field total (exhaustruct_v5)

Check failure on line 135 in ci/ci.go

View workflow job for this annotation

GitHub Actions / lint

ci.aggregator is missing field total (exhaustruct_v5)
}

func (a *aggregator) add(e *tapv1.QueryEvent) {
Expand All @@ -143,7 +143,7 @@
q := normalizedOrRaw(e)
s, ok := a.grouped[q]
if !ok {
s = &queryStats{}

Check failure on line 146 in ci/ci.go

View workflow job for this annotation

GitHub Actions / lint

ci.queryStats is missing fields nplus1Count, slowCount, totalDur (exhaustruct_v5)

Check failure on line 146 in ci/ci.go

View workflow job for this annotation

GitHub Actions / lint

ci.queryStats is missing fields nplus1Count, slowCount, totalDur (exhaustruct_v5)
a.grouped[q] = s
}
if e.GetNPlus_1() {
Expand Down
10 changes: 5 additions & 5 deletions ci/ci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (

"google.golang.org/protobuf/types/known/durationpb"

"github.com/mickamy/sql-tap/broker"
"github.com/mickamy/sql-tap/ci"
tapv1 "github.com/mickamy/sql-tap/gen/tap/v1"
"github.com/mickamy/sql-tap/proxy"
"github.com/mickamy/sql-tap/server"
"github.com/proto-tap/sql-tap/broker"
"github.com/proto-tap/sql-tap/ci"
tapv1 "github.com/proto-tap/sql-tap/gen/tap/v1"
"github.com/proto-tap/sql-tap/proxy"
"github.com/proto-tap/sql-tap/server"
)

func TestResult_HasProblems(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion clipboard/clipboard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"runtime"
"testing"

"github.com/mickamy/sql-tap/clipboard"
"github.com/proto-tap/sql-tap/clipboard"
)

func TestCopy(t *testing.T) {
Expand Down
22 changes: 11 additions & 11 deletions cmd/sql-tapd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ import (
_ "github.com/go-sql-driver/mysql"
_ "github.com/jackc/pgx/v5/stdlib"

"github.com/mickamy/sql-tap/broker"
"github.com/mickamy/sql-tap/config"
"github.com/mickamy/sql-tap/detect"
"github.com/mickamy/sql-tap/dsn"
"github.com/mickamy/sql-tap/explain"
"github.com/mickamy/sql-tap/proxy"
"github.com/mickamy/sql-tap/proxy/mysql"
"github.com/mickamy/sql-tap/proxy/postgres"
"github.com/mickamy/sql-tap/query"
"github.com/mickamy/sql-tap/server"
"github.com/mickamy/sql-tap/web"
"github.com/proto-tap/sql-tap/broker"
"github.com/proto-tap/sql-tap/config"
"github.com/proto-tap/sql-tap/detect"
"github.com/proto-tap/sql-tap/dsn"
"github.com/proto-tap/sql-tap/explain"
"github.com/proto-tap/sql-tap/proxy"
"github.com/proto-tap/sql-tap/proxy/mysql"
"github.com/proto-tap/sql-tap/proxy/postgres"
"github.com/proto-tap/sql-tap/query"
"github.com/proto-tap/sql-tap/server"
"github.com/proto-tap/sql-tap/web"
)

var version = "dev"
Expand Down
2 changes: 1 addition & 1 deletion cmd/sql-tapd/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"testing"

"github.com/mickamy/sql-tap/proxy"
"github.com/proto-tap/sql-tap/proxy"
)

func TestIsSelectQuery(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"testing"
"time"

"github.com/mickamy/sql-tap/config"
"github.com/proto-tap/sql-tap/config"
)

func TestDefault(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion detect/detect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"testing"
"time"

"github.com/mickamy/sql-tap/detect"
"github.com/proto-tap/sql-tap/detect"
)

func TestBelowThreshold(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion dsn/dsn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package dsn_test
import (
"testing"

"github.com/mickamy/sql-tap/dsn"
"github.com/proto-tap/sql-tap/dsn"
)

func TestDetectDriver(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion explain/build_args_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"testing"
"time"

"github.com/mickamy/sql-tap/explain"
"github.com/proto-tap/sql-tap/explain"
)

func TestParseTimestampParams(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion explain/explain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package explain_test
import (
"testing"

"github.com/mickamy/sql-tap/explain"
"github.com/proto-tap/sql-tap/explain"
)

func TestMode_String(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
view transactions, and run EXPLAIN — all without changing your
application code.
'';
homepage = "https://github.com/mickamy/sql-tap";
homepage = "https://github.com/proto-tap/sql-tap";
license = licenses.mit;
maintainers = [ ];
mainProgram = "sql-tap";
Expand Down
4 changes: 2 additions & 2 deletions gen/tap/v1/tap.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/mickamy/sql-tap
module github.com/proto-tap/sql-tap

go 1.26.1

Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (

tea "github.com/charmbracelet/bubbletea"

"github.com/mickamy/sql-tap/ci"
"github.com/mickamy/sql-tap/tui"
"github.com/proto-tap/sql-tap/ci"
"github.com/proto-tap/sql-tap/tui"
)

var version = "dev"
Expand Down
2 changes: 1 addition & 1 deletion proxy/mysql/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

"github.com/google/uuid"

"github.com/mickamy/sql-tap/proxy"
"github.com/proto-tap/sql-tap/proxy"
)

// MySQL binary protocol field types.
Expand Down Expand Up @@ -314,7 +314,7 @@
err := <-errCh
_ = c.clientConn.Close()
_ = c.upstreamConn.Close()
<-errCh

Check failure on line 317 in proxy/mysql/conn.go

View workflow job for this annotation

GitHub Actions / lint

Error return value is not checked (errcheck)

Check failure on line 317 in proxy/mysql/conn.go

View workflow job for this annotation

GitHub Actions / lint

Error return value is not checked (errcheck)

return err
}
Expand Down
2 changes: 1 addition & 1 deletion proxy/mysql/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net"
"sync"

"github.com/mickamy/sql-tap/proxy"
"github.com/proto-tap/sql-tap/proxy"
)

var _ proxy.Proxy = (*Proxy)(nil)
Expand Down
4 changes: 2 additions & 2 deletions proxy/mysql/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
_ "github.com/go-sql-driver/mysql"
"github.com/testcontainers/testcontainers-go/modules/mysql"

"github.com/mickamy/sql-tap/proxy"
mproxy "github.com/mickamy/sql-tap/proxy/mysql"
"github.com/proto-tap/sql-tap/proxy"
mproxy "github.com/proto-tap/sql-tap/proxy/mysql"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion proxy/postgres/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"github.com/google/uuid"
pgproto "github.com/jackc/pgproto3/v2"

"github.com/mickamy/sql-tap/proxy"
"github.com/proto-tap/sql-tap/proxy"
)

// encoder is satisfied by both FrontendMessage and BackendMessage.
Expand Down Expand Up @@ -111,7 +111,7 @@
_ = c.clientConn.Close()
_ = c.upstreamConn.Close()
// Wait for the second goroutine.
<-errCh

Check failure on line 114 in proxy/postgres/conn.go

View workflow job for this annotation

GitHub Actions / lint

Error return value is not checked (errcheck)

Check failure on line 114 in proxy/postgres/conn.go

View workflow job for this annotation

GitHub Actions / lint

Error return value is not checked (errcheck)

return err
}
Expand Down
2 changes: 1 addition & 1 deletion proxy/postgres/conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"
"time"

pgproxy "github.com/mickamy/sql-tap/proxy/postgres"
pgproxy "github.com/proto-tap/sql-tap/proxy/postgres"
)

// encodeMicros encodes microseconds as big-endian 8 bytes (PostgreSQL binary timestamp format).
Expand Down
2 changes: 1 addition & 1 deletion proxy/postgres/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package postgres
import (
pgproto "github.com/jackc/pgproto3/v2"

"github.com/mickamy/sql-tap/proxy"
"github.com/proto-tap/sql-tap/proxy"
)

// Exported wrappers for internal symbols used in package-external tests.
Expand Down
2 changes: 1 addition & 1 deletion proxy/postgres/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net"
"sync"

"github.com/mickamy/sql-tap/proxy"
"github.com/proto-tap/sql-tap/proxy"
)

var _ proxy.Proxy = (*Proxy)(nil)
Expand Down
Loading
Loading