Skip to content

Commit fd7f73a

Browse files
authored
fix: update dependencies and improve query duration logging (#30)
Co-authored-by: rick <[email protected]>
1 parent eb34e43 commit fd7f73a

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

go.mod

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.22.4
55
toolchain go1.22.6
66

77
require (
8-
github.com/linuxsuren/api-testing v0.0.19-0.20250226135405-35c828fe2524
8+
github.com/linuxsuren/api-testing v0.0.19-0.20250310093028-dd08c128ca0e
99
github.com/spf13/cobra v1.8.1
1010
github.com/stretchr/testify v1.9.0
1111
github.com/taosdata/driver-go/v3 v3.6.0
@@ -34,6 +34,7 @@ require (
3434
github.com/cucumber/godog v0.12.6 // indirect
3535
github.com/cucumber/messages-go/v16 v16.0.1 // indirect
3636
github.com/davecgh/go-spew v1.1.1 // indirect
37+
github.com/evanphx/json-patch v0.5.2 // indirect
3738
github.com/expr-lang/expr v1.15.6 // indirect
3839
github.com/flopp/go-findfont v0.1.0 // indirect
3940
github.com/ghodss/yaml v1.0.0 // indirect

go.sum

+5
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ github.com/cucumber/messages-go/v16 v16.0.1/go.mod h1:EJcyR5Mm5ZuDsKJnT2N9KRnBK3
3131
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
3232
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
3333
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
34+
github.com/evanphx/json-patch v0.5.2 h1:xVCHIVMUu1wtM/VkR9jVZ45N3FhZfYMMYGorLCR8P3k=
35+
github.com/evanphx/json-patch v0.5.2/go.mod h1:ZWS5hhDbVDyob71nXKNL0+PWn6ToqBHMikGIFbs31qQ=
3436
github.com/expr-lang/expr v1.15.6 h1:dQFgzj5DBu3wnUz8+PGLZdPMpefAvxaCFTNM3iSjkGA=
3537
github.com/expr-lang/expr v1.15.6/go.mod h1:uCkhfG+x7fcZ5A5sXHKuQ07jGZRl6J0FCAaf2k4PtVQ=
3638
github.com/flopp/go-findfont v0.1.0 h1:lPn0BymDUtJo+ZkV01VS3661HL6F4qFlkhcJN55u6mU=
@@ -108,6 +110,7 @@ github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/
108110
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
109111
github.com/jackc/pgx/v5 v5.4.3 h1:cxFyXhxlvAifxnkKKdlxv8XqUf59tDlYjnV5YYfsJJY=
110112
github.com/jackc/pgx/v5 v5.4.3/go.mod h1:Ig06C2Vu0t5qXC60W8sqIthScaEnFvojjj9dSljmHRA=
113+
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
111114
github.com/jhump/protoreflect v1.15.3 h1:6SFRuqU45u9hIZPJAoZ8c28T3nK64BNdp9w6jFonzls=
112115
github.com/jhump/protoreflect v1.15.3/go.mod h1:4ORHmSBmlCW8fh3xHmJMGyul1zNqZK4Elxc8qKP+p1k=
113116
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
@@ -131,6 +134,8 @@ github.com/linuxsuren/api-testing v0.0.19-0.20250220092001-ed58adc30f20 h1:DiT8l
131134
github.com/linuxsuren/api-testing v0.0.19-0.20250220092001-ed58adc30f20/go.mod h1:SA9cvDE/Hg0QUTgbL5g9tY9ye65beYyfK3Y/y6x0B5k=
132135
github.com/linuxsuren/api-testing v0.0.19-0.20250226135405-35c828fe2524 h1:qJfmOpBK/IWEYIoaC1r/CTaYK8k6xmErjhFlduBJOxA=
133136
github.com/linuxsuren/api-testing v0.0.19-0.20250226135405-35c828fe2524/go.mod h1:SA9cvDE/Hg0QUTgbL5g9tY9ye65beYyfK3Y/y6x0B5k=
137+
github.com/linuxsuren/api-testing v0.0.19-0.20250310093028-dd08c128ca0e h1:3dVXBA+OnZAaIbTNSAB5IHlbdYifORDTzkAUp7R/vnc=
138+
github.com/linuxsuren/api-testing v0.0.19-0.20250310093028-dd08c128ca0e/go.mod h1:igcyUJb5Q463tMpdEJxgURLLPR2pTcV7HoRyuvyP/2Y=
134139
github.com/linuxsuren/go-fake-runtime v0.0.4 h1:y+tvBuw6MKTCav8Bo5HWwaXhBx1Z//VAvqI3gpOWqvw=
135140
github.com/linuxsuren/go-fake-runtime v0.0.4/go.mod h1:zmh6J78hSnWZo68faMA2eKOdaEp8eFbERHi3ZB9xHCQ=
136141
github.com/linuxsuren/go-service v0.0.0-20231225060426-efabcd3a5161 h1:dSL/ah6zaRGqH3FW0ogtMjP6xCFXX5NsgWJTaNIofI4=

pkg/data_query.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@ import (
1919
"context"
2020
"database/sql"
2121
"fmt"
22-
"github.com/linuxsuren/api-testing/pkg/server"
23-
"gorm.io/gorm"
2422
"log"
2523
"reflect"
2624
"sort"
2725
"strings"
2826
"time"
27+
28+
"github.com/linuxsuren/api-testing/pkg/server"
29+
"gorm.io/gorm"
2930
)
3031

3132
func (s *dbserver) Query(ctx context.Context, query *server.DataQuery) (result *server.DataQueryResult, err error) {
@@ -64,8 +65,10 @@ func (s *dbserver) Query(ctx context.Context, query *server.DataQuery) (result *
6465
}
6566

6667
var dataResult *server.DataQueryResult
68+
now := time.Now()
6769
if dataResult, err = sqlQuery(ctx, query.Sql, db); err == nil {
6870
result.Items = dataResult.Items
71+
result.Meta.Duration = time.Since(now).String()
6972
}
7073
return
7174
}

0 commit comments

Comments
 (0)