Skip to content

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.

Library ComponentDescription
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.BindJSONMethod to bind the JSON body of the request to a struct.
Context.QueryMethod to get a query parameter from the URL.
Context.CookieMethod to get a cookie value from the request.
Context.ParamMethod to get a path parameter from the URL.
Context.ShouldBindMethod to bind request data to a struct, returning an error if binding fails.
Context.DefaultQueryMethod to get a query parameter with a default value if not present.
Context.PostFormMethod to get a form parameter from the request body.
Context.ShouldBindJSONMethod to bind the JSON body of the request to a struct, returning an error if binding fails.
RouterGroup.GETMethod to handle HTTP GET requests in a route group.
RouterGroup.PUTMethod to handle HTTP PUT requests in a route group.
RouterGroup.DELETEMethod to handle HTTP DELETE requests in a route group.
RouterGroup.HEADMethod to handle HTTP HEAD requests in a route group.
RouterGroup.HandleMethod to handle custom HTTP methods in a route group.
RouterGroup.GroupMethod to create a new router group with a common route prefix.
RouterGroup.POSTMethod to handle HTTP POST requests in a route group.
RouterGroup.ANYMethod to handle all HTTP request method in a route group.
RouterGroup.PATCHMethod to handle HTTP PATCH requests in a route group.
RouterGroup.OPTIONSMethod to handle HTTP OPTIONS requests in a route group.
Library ComponentDescription
NewFunction to create a new HTTP router instance.
Router.PATCHMethod to handle HTTP PATCH requests.
Router.ServeHTTPMethod to serve HTTP requests, implementing the http.Handler interface.
Router.GETMethod to handle HTTP GET requests.
Router.POSTMethod to handle HTTP POST requests.
Router.PUTMethod to handle HTTP PUT requests.
Router.DELETEMethod to handle HTTP DELETE requests.
Router.OPTIONSMethod to handle HTTP OPTIONS requests.
Library ComponentDescription
RequestRepresents an HTTP request, including methods to access form values, cookies, and more.
Request.FormValueMethod to retrieve form values from an HTTP request.
Request.PostFormValueMethod to retrieve POST form values from an HTTP request.
Request.CookieMethod to retrieve a cookie value from an HTTP request.
net/http.ResponseWriterInterface for constructing an HTTP response.
net/http.ServerRepresents an HTTP server, providing methods for starting and stopping the server.
net/http.Server.ListenAndServeMethod to start the server and listen for HTTP requests.
Library ComponentDescription
CommandRepresents a command in the Cobra CLI library.
Command.ExecuteMethod to execute the command.
Command.ExecuteContextMethod to execute the command with a context for cancellation.
Command.AddCommandMethod to add a child command to this command.
Library ComponentDescription
NewAppFunction to create a new CLI application instance.
AppRepresents a CLI application in the Urfave CLI library.
App.RunMethod to run the CLI application.
CommandCommand represents a subcommands and commands for a cli.App