Skip to content

Commit 7b2d14d

Browse files
committed
update example output
1 parent a8b2a4a commit 7b2d14d

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

example/api/nats_client.go

+4-18
Original file line numberDiff line numberDiff line change
@@ -170,14 +170,7 @@ func (client *ImageClient) GetByUserId(ctx context.Context, userId string) ([]*e
170170
return nil, err
171171
}
172172

173-
var data []byte
174-
data, err = jsoniter.Marshal(ctx)
175-
if err != nil {
176-
reqSpan.LogFields(log.Error(err))
177-
return nil, err
178-
}
179-
180-
if _, err = t.Write(data); err != nil {
173+
if _, err = t.Write([]byte(userId)); err != nil {
181174
reqSpan.LogFields(log.Error(err))
182175
return nil, err
183176
}
@@ -228,14 +221,7 @@ func (client *ImageClient) GetCountByUserId(ctx context.Context, userId string)
228221
return 0, err
229222
}
230223

231-
var data []byte
232-
data, err = jsoniter.Marshal(ctx)
233-
if err != nil {
234-
reqSpan.LogFields(log.Error(err))
235-
return 0, err
236-
}
237-
238-
if _, err = t.Write(data); err != nil {
224+
if _, err = t.Write([]byte(userId)); err != nil {
239225
reqSpan.LogFields(log.Error(err))
240226
return 0, err
241227
}
@@ -428,7 +414,7 @@ func (client *UserClient) GetById(ctx context.Context, id []byte) (*example.User
428414
}
429415

430416
var data []byte
431-
data, err = jsoniter.Marshal(ctx)
417+
data, err = jsoniter.Marshal(id)
432418
if err != nil {
433419
reqSpan.LogFields(log.Error(err))
434420
return nil, err
@@ -486,7 +472,7 @@ func (client *UserClient) Create(ctx context.Context, user *example.User) error
486472
}
487473

488474
var data []byte
489-
data, err = jsoniter.Marshal(ctx)
475+
data, err = jsoniter.Marshal(user)
490476
if err != nil {
491477
reqSpan.LogFields(log.Error(err))
492478
return err

0 commit comments

Comments
 (0)