<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>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                [TOC] > [參考](https://goframe.org/toolchain/cli) ## 概述 ## 安裝 ### Linux `wget https://goframe.org/cli/linux_amd64/gf && chmod +x gf && sudo ./gf `install ### Mac `wget https://goframe.org/cli/darwin_amd64/gf && chmod +x gf && ./gf install` ### Windows 下載 `https://goframe.org/cli/windows_amd64/gf.exe` ## 語法 ``` gf tool chain install 工具安裝 version 工具版本查看 init 項目初始化 build 交叉編譯 gen 代碼生成命令 run 熱編譯(自動編譯) get 依賴包下載 docker 鏡像編譯 update 工具更新 pack 二進制打包 help 命令行幫助 ``` ### `gf init `初始化項目 `gf init gf-demo` ### `gf build` 交叉編譯 語法: `gf build FILE [OPTION]` eg: `gf build main.go` 默認讀取`config.toml` ``` [compiler] name = "my-app" #應用名 version = "1.0.0" arch = "386,amd64" system = "linux,windows,darwin" # 選擇編譯平臺 output = "" path = "./bin/" # 導出目錄 extra = "-ldflags \"-s -w\"" # 自定義編譯時內置變量 [compiler.VarMap] author = "john" email = "john@goframe.org" ``` <details> <summary>項目導出到 ./bin/ </summary> ``` bin └── 1.0.0 ├── windows_amd64 │ └── my-app.exe ├── windows_386 │ └── my-app.exe ├── linux_amd64 │ └── my-app ├── linux_386 │ └── my-app ├── darwin_amd64 │ └── my-app └── darwin_386 └── my-app ``` </details> <br /> ### `gf gen` 代碼生成命令 注意配置 `config.toml` 的數據庫 語法:`gf gen model [PATH] [OPTION]` 例子 : `gf gen model ./app/model_demo` 不添加 path 則默認為 `./app/model` 每個表一個目錄,目錄下生成三個文件 1. `數據表名.go` 自定義文件,開發者可以自由定義填充的代碼文件,僅會生成一次,每一次模型生成不會覆蓋。 2. `數據表名_entity.go` 表結構文件,根據數據表結構生成的結構體定義文件,包含字段注釋。數據表在外部變更后,可使用gen命令重復生成更新該文件。 3. `數據表名_model.go` 表模型文件,為數據表提供了許多便捷的CURD操作方法,并可直接查詢返回該表的結構體對象。數據表在外部變更后,可使用gen命令重復生成更新該文件。 > 數據表模型生成支持的數據庫類型為:`MySQL/MariaDB`、`PostgreSQL`、`SQLite`、`SQLServer`。目前暫不支持`Oracle` ### `run`熱編譯(自動編譯) 使用方式:`gf get PACKAGE` `gf get`命令和`go get`命令類似,內部自動提供了代理設置功能,并智能識別并設置最快的下載代理地址 ## `update`工具更新 使用方式:`gf update` 該命令用以檢測`gf`命令行工具的版本,并自動執行版本更新。 > 部分系統需要管理員權限支持。如果更新失敗,請手動重新下載更新
                  <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>

                              哎呀哎呀视频在线观看