Skip to content

Commit 4c3cfe7

Browse files
authored
Add merge custom option to importer command (#187)
* chore: update sdk to v8 * feat: add merge custom option to import cmd * chore: upgrade golangci version
1 parent 54ff051 commit 4c3cfe7

File tree

20 files changed

+45
-38
lines changed

20 files changed

+45
-38
lines changed

.golangci.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
run:
2-
go: '1.19'
3-
deadline: 210s
2+
go: '1.23'
43
timeout: 10m
5-
skip-dirs:
4+
5+
issues:
6+
exclude-dirs:
67
- mocks
78
- '.*_mock'
8-
skip-files:
9+
exclude-files:
910
- '.*_mock.go'
1011
- ".*\\.pb\\.go$"
1112

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
NAME = stream-cli
22

3-
GOLANGCI_VERSION = 1.55.2
3+
GOLANGCI_VERSION = 1.62.2
44
GOLANGCI = .bin/golangci/$(GOLANGCI_VERSION)/golangci-lint
55
$(GOLANGCI):
66
@curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(dir $(GOLANGCI)) v$(GOLANGCI_VERSION)

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
module github.com/GetStream/stream-cli
22

3-
go 1.22
3+
go 1.23
44

55
require (
66
github.com/AlecAivazis/survey/v2 v2.3.4
7-
github.com/GetStream/stream-chat-go/v5 v5.8.1
7+
github.com/GetStream/stream-chat-go/v8 v8.3.0
88
github.com/MakeNowJust/heredoc v1.0.0
99
github.com/cheynewallace/tabby v1.1.1
1010
github.com/gizak/termui/v3 v3.1.0
@@ -18,7 +18,7 @@ require (
1818
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
1919
github.com/davecgh/go-spew v1.1.1 // indirect
2020
github.com/fsnotify/fsnotify v1.5.4 // indirect
21-
github.com/golang-jwt/jwt/v4 v4.4.1 // indirect
21+
github.com/golang-jwt/jwt/v4 v4.5.1 // indirect
2222
github.com/hashicorp/hcl v1.0.0 // indirect
2323
github.com/inconshreveable/mousetrap v1.0.0 // indirect
2424
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect

go.sum

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ github.com/AlecAivazis/survey/v2 v2.3.4 h1:pchTU9rsLUSvWEl2Aq9Pv3k0IE2fkqtGxazsk
4040
github.com/AlecAivazis/survey/v2 v2.3.4/go.mod h1:hrV6Y/kQCLhIZXGcriDCUBtB3wnN7156gMXJ3+b23xM=
4141
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
4242
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
43-
github.com/GetStream/stream-chat-go/v5 v5.8.1 h1:nO3pfa4p4o6KEZOAXaaII3bhdrMrfT2zs6VduchuJws=
44-
github.com/GetStream/stream-chat-go/v5 v5.8.1/go.mod h1:ET7NyUYplNy8+tyliin6Q3kKwbd/+FHQWMAW6zucisY=
43+
github.com/GetStream/stream-chat-go/v8 v8.3.0 h1:mFtQZ0PkcCXMPjCDlnZcex3roOvE+UOaxBcNdq3o62s=
44+
github.com/GetStream/stream-chat-go/v8 v8.3.0/go.mod h1:frj3A1yv9mjyWlGNwaZKnXcX9JYYTPWSDqzyOFeHPac=
4545
github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ4pzQ=
4646
github.com/MakeNowJust/heredoc v1.0.0/go.mod h1:mG5amYoWBHf8vpLOuehzbGGw0EHxpZZ6lCpQ4fNJ8LE=
4747
github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2 h1:+vx7roKuyA63nhn5WAunQHLTznkw5W8b1Xc0dNjp83s=
@@ -79,9 +79,8 @@ github.com/gizak/termui/v3 v3.1.0/go.mod h1:bXQEBkJpzxUAKf0+xq9MSWAvWZlE7c+aidmy
7979
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
8080
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
8181
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
82-
github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg=
83-
github.com/golang-jwt/jwt/v4 v4.4.1 h1:pC5DB52sCeK48Wlb9oPcdhnjkz1TKt1D/P7WKJ0kUcQ=
84-
github.com/golang-jwt/jwt/v4 v4.4.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
82+
github.com/golang-jwt/jwt/v4 v4.5.1 h1:JdqV9zKUdtaa9gdPlywC3aeoEsR681PlKC+4F5gQgeo=
83+
github.com/golang-jwt/jwt/v4 v4.5.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
8584
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
8685
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
8786
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=

pkg/cmd/chat/app/app.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"encoding/json"
55
"time"
66

7-
stream "github.com/GetStream/stream-chat-go/v5"
7+
stream "github.com/GetStream/stream-chat-go/v8"
88
"github.com/MakeNowJust/heredoc"
99
"github.com/spf13/cobra"
1010

@@ -46,7 +46,7 @@ func getCmd() *cobra.Command {
4646
return err
4747
}
4848

49-
r, err := c.GetAppConfig(cmd.Context())
49+
r, err := c.GetAppSettings(cmd.Context())
5050
if err != nil {
5151
return err
5252
}

pkg/cmd/chat/channel/channel.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"errors"
66
"time"
77

8-
stream "github.com/GetStream/stream-chat-go/v5"
8+
stream "github.com/GetStream/stream-chat-go/v8"
99
"github.com/MakeNowJust/heredoc"
1010
"github.com/spf13/cobra"
1111

@@ -551,7 +551,7 @@ func hideCmd() *cobra.Command {
551551
return err
552552
}
553553

554-
cmd.Printf("Successfully hid channel for " + userID + "\n")
554+
cmd.Printf("Successfully hid channel for %s\n", userID)
555555
return nil
556556
},
557557
}

pkg/cmd/chat/channel/channel_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"testing"
77
"time"
88

9-
stream "github.com/GetStream/stream-chat-go/v5"
9+
stream "github.com/GetStream/stream-chat-go/v8"
1010
"github.com/stretchr/testify/require"
1111

1212
"github.com/GetStream/stream-cli/test"

pkg/cmd/chat/channeltype/channeltype.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package channeltype
33
import (
44
"encoding/json"
55

6-
stream "github.com/GetStream/stream-chat-go/v5"
6+
stream "github.com/GetStream/stream-chat-go/v8"
77
"github.com/MakeNowJust/heredoc"
88
"github.com/spf13/cobra"
99

pkg/cmd/chat/device/device.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package device
22

33
import (
4-
stream_chat "github.com/GetStream/stream-chat-go/v5"
4+
stream_chat "github.com/GetStream/stream-chat-go/v8"
55
"github.com/MakeNowJust/heredoc"
66
"github.com/spf13/cobra"
77

pkg/cmd/chat/imports/imports.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"path/filepath"
88
"time"
99

10-
stream "github.com/GetStream/stream-chat-go/v5"
10+
stream "github.com/GetStream/stream-chat-go/v8"
1111
"github.com/MakeNowJust/heredoc"
1212
"github.com/spf13/cobra"
1313

@@ -76,6 +76,12 @@ func uploadCmd() *cobra.Command {
7676
mode = stream.InsertMode
7777
}
7878

79+
var opts []stream.CreateImportOption
80+
if cmd.Flags().Changed("merge-custom") {
81+
mergeCustom, _ := cmd.Flags().GetBool("merge-custom")
82+
opts = append(opts, stream.WithMergeCustom(mergeCustom))
83+
}
84+
7985
createImportURLResp, err := c.CreateImportURL(cmd.Context(), filepath.Base(filename))
8086
if err != nil {
8187
return err
@@ -84,7 +90,7 @@ func uploadCmd() *cobra.Command {
8490
if err := uploadToS3(cmd.Context(), filename, createImportURLResp.UploadURL); err != nil {
8591
return err
8692
}
87-
createImportResp, err := c.CreateImport(cmd.Context(), createImportURLResp.Path, mode)
93+
createImportResp, err := c.CreateImport(cmd.Context(), createImportURLResp.Path, mode, opts...)
8894
if err != nil {
8995
return err
9096
}
@@ -94,7 +100,8 @@ func uploadCmd() *cobra.Command {
94100
}
95101

96102
fl := cmd.Flags()
97-
fl.StringP("mode", "m", "upsert", "[optional] Import mode. Canbe upsert or insert")
103+
fl.StringP("mode", "m", "upsert", "[optional] Import mode. Can be upsert or insert")
104+
fl.Bool("merge-custom", false, "[optional] Merge custom data during import")
98105
fl.StringP("output-format", "o", "json", "[optional] Output format. Can be json or tree")
99106
fl.Bool("lighter-validation-id", false, "[optional] allows to pass ! in channel ID")
100107

0 commit comments

Comments
 (0)