• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

supabase / cli / 8665741536

12 Apr 2024 05:19PM UTC coverage: 57.738% (-0.07%) from 57.812%
8665741536

Pull #2138

github

sweatybridge
fix: add schema column to table sizes query
Pull Request #2138: fix: exclude supabase managed schemas from inspect subcommand

2 of 46 new or added lines in 20 files covered. (4.35%)

5 existing lines in 1 file now uncovered.

6376 of 11043 relevant lines covered (57.74%)

662.93 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/internal/inspect/outliers/outliers.go
1
package outliers
2

3
import (
4
        "context"
5
        "fmt"
6
        "regexp"
7

8
        "github.com/go-errors/errors"
9
        "github.com/jackc/pgconn"
10
        "github.com/jackc/pgx/v4"
11
        "github.com/spf13/afero"
12
        "github.com/supabase/cli/internal/inspect"
13
        "github.com/supabase/cli/internal/migration/list"
14
        "github.com/supabase/cli/internal/utils"
15
        "github.com/supabase/cli/internal/utils/pgxv5"
16
)
17

18
type Result struct {
19
        Total_exec_time string
20
        Prop_exec_time  string
21
        Ncalls          string
22
        Sync_io_time    string
23
        Query           string
24
}
25

26
func Run(ctx context.Context, config pgconn.Config, fsys afero.Fs, options ...func(*pgx.ConnConfig)) error {
×
27
        conn, err := utils.ConnectByConfig(ctx, config, options...)
×
28
        if err != nil {
×
29
                return err
×
30
        }
×
NEW
31
        rows, err := conn.Query(ctx, inspect.OUTLIERS_QUERY)
×
32
        if err != nil {
×
33
                return errors.Errorf("failed to query rows: %w", err)
×
34
        }
×
35
        result, err := pgxv5.CollectRows[Result](rows)
×
36
        if err != nil {
×
37
                return err
×
38
        }
×
39
        // TODO: implement a markdown table marshaller
40
        table := "|Query|Execution Time|Proportion of exec time|Number Calls|Sync IO time|\n|-|-|-|-|-|\n"
×
41
        for _, r := range result {
×
42
                re := regexp.MustCompile(`\s+|\r+|\n+|\t+|\v`)
×
43
                query := re.ReplaceAllString(r.Query, " ")
×
44

×
45
                re = regexp.MustCompile(`\|`)
×
46
                query = re.ReplaceAllString(query, `\|`)
×
47
                table += fmt.Sprintf("|`%s`|`%s`|`%s`|`%s`|`%s`|\n", query, r.Total_exec_time, r.Prop_exec_time, r.Ncalls, r.Sync_io_time)
×
48
        }
×
49
        return list.RenderTable(table)
×
50
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc