Documentation ¶
Index ¶
- type Action
- type Api
- type Contact
- type DescriptionGetter
- type ExternalDocs
- type File
- type FileHeader
- type FileMultiaprt
- type HTTPMethod
- type Info
- type Module
- type Multipart
- type MultipartDefinition
- type MultipartFileDefinition
- type MultipartValueDefinition
- type NameGetter
- type Request
- type RequestDefinition
- type ResponseDefinition
- type SeekerFile
- type Server
- type Tag
- type Verifier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Api ¶
type Api interface { Run(ip string, port uint, mode string) error AppendModule(mod Module) AppendMiddleware(string, Action) // TODO: add middleware base on order. study it! GetRoute(url, method string) *RequestDefinition SetCors(cors []string) // For testing TestHandle(*httptest.ResponseRecorder, *http.Request) error // OpenAPI SetExternalDocs(ExternalDocs) SetInfo(Info) SetContact(Contact) SetServers([]Server) EnableOpenApi(route string) error SetErrors([]string) }
The Api interface defines the methods required to run an HTTP server and handle incoming requests.
type DescriptionGetter ¶
type DescriptionGetter interface {
GetDescription() string
}
type ExternalDocs ¶
The name is plural by open api definition
type FileHeader ¶
type FileMultiaprt ¶
type HTTPMethod ¶
type HTTPMethod string
HTTPMethod is a string representing an HTTP method (GET, POST, DELETE, etc.).
type Module ¶
type Module interface { GetRequestHandlers() []*RequestDefinition GetBaseURL() string GetTag() Tag }
The Module interface defines the methods required to handle a group of related request handlers.
type Multipart ¶
type Multipart interface { io.ReadCloser GetPartName() string GetMimeType() string }
type MultipartDefinition ¶
type MultipartFileDefinition ¶
type MultipartFileDefinition interface { MultipartDefinition Verify(FileHeader) error }
type MultipartValueDefinition ¶
type MultipartValueDefinition interface { MultipartDefinition Verify() error }
type NameGetter ¶
type NameGetter interface {
GetName() string
}
type Request ¶
type Request interface { // GetJson and other stuff SetServerError(msg string) SetForbidden() SetBadRequest(msg string, code string) SetNotFound(msg string, code string) ReturnStatus(int, error) Set(key string, value interface{}) Get(key string) (interface{}, bool) MustGet(key string) interface{} GetDto() (interface{}, bool) MustGetDto() interface{} Negotiate(stausCode int, err error, Dto interface{}) RangeFile(status int, err error, file SeekerFile) WriteFile(status int, err error, file File) ReturnMultpartMixed(status int, err error, out ...Multipart) }
The Request interface defines the methods available to an HTTP request handler.
type RequestDefinition ¶
type RequestDefinition struct { Route string Dto Verifier Handler Action Method HTTPMethod // For open api Summary string Description string OperationID string // Tools use this UNIQUE id to idenitfy the action example: GetUserByID,GetUsers, .... Deprecated bool // Set true if this definition is deprecated ResponseDefinitions []ResponseDefinition }
A RequestDefinition contains information about an HTTP route, including the URL pattern, expected data types, and HTTP method.
type ResponseDefinition ¶
type SeekerFile ¶
type Tag ¶
type Tag struct { Name string Description string ExternalDocs *ExternalDocs }
Click to show internal directories.
Click to hide internal directories.