From fa693cc60b82d8c9936b00af32568a7c9a2990eb Mon Sep 17 00:00:00 2001 From: Sinh Date: Thu, 24 Nov 2022 09:45:53 +0700 Subject: [PATCH] fix nats --- client/segmnet.go | 41 ----------------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 client/segmnet.go diff --git a/client/segmnet.go b/client/segmnet.go deleted file mode 100644 index bcc7bab..0000000 --- a/client/segmnet.go +++ /dev/null @@ -1,41 +0,0 @@ -package client - -import ( - "encoding/json" - "errors" - "git.selly.red/Selly-Modules/natsio" - "git.selly.red/Selly-Modules/natsio/model" - "git.selly.red/Selly-Modules/natsio/subject" -) - -// Segment ... -type Segment struct{} - -// GetSegment ... -func GetSegment() Segment { - return Segment{} -} - -// GetListSegmentInfoByIds ... -func (s Segment) GetListSegmentInfoByIds(p model.GetListSegmentRequest) (*model.ResponseListSegmentInfo, error) { - msg, err := natsio.GetServer().Request(subject.Segment.GetListSegmentInfo, toBytes(p)) - - if err != nil { - return nil, err - } - - var r struct { - Data *model.ResponseListSegmentInfo `json:"data"` - Error string `json:"error"` - } - - if err := json.Unmarshal(msg.Data, &r); err != nil { - return nil, err - } - - if r.Error != "" { - return nil, errors.New(r.Error) - } - - return r.Data, nil -}