Skip to content

Commit

Permalink
update example output
Browse files Browse the repository at this point in the history
  • Loading branch information
ihadeed committed Oct 11, 2020
1 parent a8b2a4a commit 7b2d14d
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions example/api/nats_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,7 @@ func (client *ImageClient) GetByUserId(ctx context.Context, userId string) ([]*e
return nil, err
}

var data []byte
data, err = jsoniter.Marshal(ctx)
if err != nil {
reqSpan.LogFields(log.Error(err))
return nil, err
}

if _, err = t.Write(data); err != nil {
if _, err = t.Write([]byte(userId)); err != nil {
reqSpan.LogFields(log.Error(err))
return nil, err
}
Expand Down Expand Up @@ -228,14 +221,7 @@ func (client *ImageClient) GetCountByUserId(ctx context.Context, userId string)
return 0, err
}

var data []byte
data, err = jsoniter.Marshal(ctx)
if err != nil {
reqSpan.LogFields(log.Error(err))
return 0, err
}

if _, err = t.Write(data); err != nil {
if _, err = t.Write([]byte(userId)); err != nil {
reqSpan.LogFields(log.Error(err))
return 0, err
}
Expand Down Expand Up @@ -428,7 +414,7 @@ func (client *UserClient) GetById(ctx context.Context, id []byte) (*example.User
}

var data []byte
data, err = jsoniter.Marshal(ctx)
data, err = jsoniter.Marshal(id)
if err != nil {
reqSpan.LogFields(log.Error(err))
return nil, err
Expand Down Expand Up @@ -486,7 +472,7 @@ func (client *UserClient) Create(ctx context.Context, user *example.User) error
}

var data []byte
data, err = jsoniter.Marshal(ctx)
data, err = jsoniter.Marshal(user)
if err != nil {
reqSpan.LogFields(log.Error(err))
return err
Expand Down

0 comments on commit 7b2d14d

Please sign in to comment.