<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                [TOC] ## 概述 ## 安裝 ``` go install go-micro.dev/v4/cmd/micro@master ``` ## 命令 ``` auth Manage authentication, accounts and rules call Call a service e.g micro call greeter Say.Hello '{"name": "John"}' cli Run the interactive CLI config Manage configuration values env Get/set micro cli environment gen Generate a micro related dependencies e.g protobuf init Generate a profile for micro plugins kill Kill a service: micro kill [source] login Interactive login flow. logout Logout. logs Get logs for a service e.g. micro logs helloworld network Manage the micro service network new Create a service template run Run a service: micro run [source] server Run the micro server service Run a micro service services List services in the registry signup Signup to the Micro Platform stats Query the stats of specified service(s), e.g micro stats srv1 srv2 srv3 status Get the status of services store Commands for accessing the store stream Create a service stream e.g. micro stream foo Bar.Baz '{"key": "value"}' update Update a service: micro update [source] user Print the current logged in user ``` ## 場景 ### micro new 創建微服務 運行 ``` micro new service helloworld cd helloworld make proto tidy micro run ``` 測試 call 這個 服務 ``` micro call helloworld Helloworld.Call '{"name": "John"}' ``` ### 添加鏈路追蹤 Jaeger ``` micro new service --jaeger helloworld ``` <details> <summary> handler/helloworld.go</summary> ``` package helloworld import ( "context" log "go-micro.dev/v4/logger" "helloworld/greeter" pb "helloworld/proto" ) type Helloworld struct{} func (e *Helloworld) Call(ctx context.Context, req pb.CallRequest, rsp *pb.CallResponse) error { log.Infof("Received Helloworld.Call request: %v", req) rsp.Msg = greeter.Greet(ctx, req.Name) return nil } ``` </details> <br /> <details> <summary> greeter/greeter.go </summary> ``` package greeter import ( "context" "fmt" "go-micro.dev/v4/cmd/micro/debug/trace" ) func Greet(ctx context.Context, name string) string { defer trace.NewSpan(ctx).Finish() return fmt.Sprint("Hello " + name) } ``` </details> <br /> ### micro new client 構建一個 client ``` micro new client helloworld creating client helloworld cd helloworld-client make tidy micro run ``` ### micro generate 生成項目模版 ``` micro generate skaffold ``` ### micro describe 查看服務 ``` micro describe service helloworld { “名稱”:“ helloworld ”, “版本”:“最新”, “元數據”:null, “端點”:[ { “名稱”:“ Helloworld.Call ”, “請求”:{ “名稱“:”呼叫請求“, "類型 " : " CallRequest " , " values " : [ { " name " : " name " , " type " : " string " , " values " : null } ] }, " response " : { " name " : " CallResponse " , “類型” :“ CallResponse ”, “ values ”:[ { “ name ”:“ msg ”, “ type ”:“ string ”, “ values ”:null } ] } } ],“ nodes ”:[ { “ id ”:“helloworld-9660f06a-d608-43d9-9f44-e264ff63c554 " , “地址”:“ 172.26.165.161:45059 ”, “元數據”:{ “代理”:“ http ”, “協議”:“ mucp ”, “注冊表”:“ mdns ”, “服務器”:“ mucp ”, "傳輸“:” http" } } ] } ``` ### micro call 調用服務 ``` micro call helloworld Helloworld.Call ' {"name": "John"} ' ``` 調用流(一次觸發,多次返回) ``` micro stream server helloworld Helloworld.ServerStream '{"count": 10}' {"count":0} {"count":1} {"count":2} {"count":3} {"count":4} {"count":5} {"count":6} {"count":7} {"count":8} {"count":9} ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看