RouterImports returns the framework-specific and strict middleware imports needed based on which server type is selected.
()
| 148 | // RouterImports returns the framework-specific and strict middleware imports |
| 149 | // needed based on which server type is selected. |
| 150 | func (g GenerateOptions) RouterImports() []AdditionalImport { |
| 151 | var imports []AdditionalImport |
| 152 | |
| 153 | switch { |
| 154 | case g.EchoServer: |
| 155 | imports = append(imports, AdditionalImport{Package: "github.com/labstack/echo/v4"}) |
| 156 | case g.Echo5Server: |
| 157 | imports = append(imports, AdditionalImport{Package: "github.com/labstack/echo/v5"}) |
| 158 | case g.ChiServer: |
| 159 | imports = append(imports, AdditionalImport{Package: "github.com/go-chi/chi/v5"}) |
| 160 | case g.GinServer: |
| 161 | imports = append(imports, AdditionalImport{Package: "github.com/gin-gonic/gin"}) |
| 162 | case g.GorillaServer: |
| 163 | imports = append(imports, AdditionalImport{Package: "github.com/gorilla/mux"}) |
| 164 | case g.FiberServer: |
| 165 | imports = append(imports, AdditionalImport{Package: "github.com/gofiber/fiber/v2"}) |
| 166 | case g.IrisServer: |
| 167 | imports = append(imports, AdditionalImport{Package: "github.com/kataras/iris/v12"}) |
| 168 | imports = append(imports, AdditionalImport{Package: "github.com/kataras/iris/v12/core/router"}) |
| 169 | case g.StdHTTPServer: |
| 170 | } |
| 171 | |
| 172 | return imports |
| 173 | } |
| 174 | |
| 175 | func (oo GenerateOptions) Validate() map[string]string { |
| 176 | return nil |