generated from cloudwego/.github
-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: rogerogers <rogers@rogerogers.com>
- Loading branch information
1 parent
b93889a
commit 60fe273
Showing
14 changed files
with
241 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright 2024 CloudWeGo Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package service | ||
|
||
import ( | ||
"context" | ||
|
||
product "github.com/cloudwego/biz-demo/gomall/app/frontend/hertz_gen/frontend/product" | ||
"github.com/cloudwego/biz-demo/gomall/app/frontend/infra/rpc" | ||
rpcproduct "github.com/cloudwego/biz-demo/gomall/rpc_gen/kitex_gen/product" | ||
"github.com/cloudwego/hertz/pkg/app" | ||
"github.com/cloudwego/hertz/pkg/common/utils" | ||
) | ||
|
||
type SearchProducsService struct { | ||
RequestContext *app.RequestContext | ||
Context context.Context | ||
} | ||
|
||
func NewSearchProducsService(Context context.Context, RequestContext *app.RequestContext) *SearchProducsService { | ||
return &SearchProducsService{RequestContext: RequestContext, Context: Context} | ||
} | ||
|
||
func (h *SearchProducsService) Run(req *product.SearchProductsReq) (resp map[string]any, err error) { | ||
p, err := rpc.ProductClient.SearchProducts(h.Context, &rpcproduct.SearchProductsReq{Query: req.Q}) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return utils.H{ | ||
"items": p.Results, | ||
"q": req.Q, | ||
}, nil | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
41 changes: 21 additions & 20 deletions
41
gomall/app/frontend/hertz_gen/frontend/category/category_page.pb.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.