Go (Experimental)
The following section covers the components of Go frameworks and their library components that NightVision’s API Discovery capability can detect and use to generate OpenAPI documentation. If a component that you use is not supported, please get in touch with our support team at support@nightvision.net, and we can add this as a new feature.
Go github.com/gin-gonic/gin
Section titled “Go github.com/gin-gonic/gin”| Library Component | Description |
|---|---|
| New() | Function to create a new Engine instance in Gin. |
| Default() | Function to create a new Engine instance with default middleware (logging and recovery). |
| Engine.ServeHTTP() | Method to serve HTTP requests. |
| Engine.Run() | Method to run the Gin server. |
| Context.MustBindWith() | Method to bind the request body to a struct, halting if binding fails. |
| Context.BindJSON | Method to bind the JSON body of the request to a struct. |
| Context.Query | Method to get a query parameter from the URL. |
| Context.Cookie | Method to get a cookie value from the request. |
| Context.Param | Method to get a path parameter from the URL. |
| Context.ShouldBind | Method to bind request data to a struct, returning an error if binding fails. |
| Context.DefaultQuery | Method to get a query parameter with a default value if not present. |
| Context.PostForm | Method to get a form parameter from the request body. |
| Context.ShouldBindJSON | Method to bind the JSON body of the request to a struct, returning an error if binding fails. |
| RouterGroup.GET | Method to handle HTTP GET requests in a route group. |
| RouterGroup.PUT | Method to handle HTTP PUT requests in a route group. |
| RouterGroup.DELETE | Method to handle HTTP DELETE requests in a route group. |
| RouterGroup.HEAD | Method to handle HTTP HEAD requests in a route group. |
| RouterGroup.Handle | Method to handle custom HTTP methods in a route group. |
| RouterGroup.Group | Method to create a new router group with a common route prefix. |
| RouterGroup.POST | Method to handle HTTP POST requests in a route group. |
| RouterGroup.ANY | Method to handle all HTTP request method in a route group. |
| RouterGroup.PATCH | Method to handle HTTP PATCH requests in a route group. |
| RouterGroup.OPTIONS | Method to handle HTTP OPTIONS requests in a route group. |
Go github.com/julienschmidt/httprouter
Section titled “Go github.com/julienschmidt/httprouter”| Library Component | Description |
|---|---|
| New | Function to create a new HTTP router instance. |
| Router.PATCH | Method to handle HTTP PATCH requests. |
| Router.ServeHTTP | Method to serve HTTP requests, implementing the http.Handler interface. |
| Router.GET | Method to handle HTTP GET requests. |
| Router.POST | Method to handle HTTP POST requests. |
| Router.PUT | Method to handle HTTP PUT requests. |
| Router.DELETE | Method to handle HTTP DELETE requests. |
| Router.OPTIONS | Method to handle HTTP OPTIONS requests. |
Go net/HTTP
Section titled “Go net/HTTP”| Library Component | Description |
|---|---|
| Request | Represents an HTTP request, including methods to access form values, cookies, and more. |
| Request.FormValue | Method to retrieve form values from an HTTP request. |
| Request.PostFormValue | Method to retrieve POST form values from an HTTP request. |
| Request.Cookie | Method to retrieve a cookie value from an HTTP request. |
| net/http.ResponseWriter | Interface for constructing an HTTP response. |
| net/http.Server | Represents an HTTP server, providing methods for starting and stopping the server. |
| net/http.Server.ListenAndServe | Method to start the server and listen for HTTP requests. |
Go github.com/spf13/cobra
Section titled “Go github.com/spf13/cobra”| Library Component | Description |
|---|---|
| Command | Represents a command in the Cobra CLI library. |
| Command.Execute | Method to execute the command. |
| Command.ExecuteContext | Method to execute the command with a context for cancellation. |
| Command.AddCommand | Method to add a child command to this command. |
Go github.com/urfave/cli
Section titled “Go github.com/urfave/cli”| Library Component | Description |
|---|---|
NewApp | Function to create a new CLI application instance. |
App | Represents a CLI application in the Urfave CLI library. |
App.Run | Method to run the CLI application. |
Command | Command represents a subcommands and commands for a cli.App |