response

package
v1.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 10, 2024 License: MIT Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CustomResponse

type CustomResponse struct {
	Model any
	// contains filtered or unexported fields
}

CustomResponse represents a custom implementation of Response.

func New

func New(model any, returnCode string, description string) CustomResponse

New creates a new instance of Response with the provided model return code, and description.

func (CustomResponse) Description

func (c CustomResponse) Description() string

func (CustomResponse) ReturnCode

func (c CustomResponse) ReturnCode() string

type Response

type Response interface {
	Description() string
	ReturnCode() string
}

Response is an interface for response information.

type ResponseGenerator

type ResponseGenerator struct{}

ResponseGenerator is a struct that provides functionality to generate response schemas.

func NewResponseGenerator

func NewResponseGenerator() *ResponseGenerator

NewResponseGenerator creates a new instance of ResponseGenerator.

func (ResponseGenerator) Generate

Generate generates a JSON response schema based on the provided model. It uses reflection to determine the type of the model and constructs the appropriate JSON schema. This function handles different types such as slices, maps, and structures to create a detailed and accurate schema.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL