ginman

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2023 License: MIT Imports: 18 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Ginman

Godoc Release Build

A Golang library that provides wrapper for Gin Web Framework.

Usage

See _examples/basic/main.go.

Test

# Run tests
make test

# Continuous testing
make test-ui

Contributing

See CONTRIBUTING.md

License

Licensed under The MIT License (MIT)
For the full copyright and license information, please view the LICENSE.txt file.

Documentation

Overview

Package ginman provides a simple wrapper for Gin Web Framework.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWithOptions

func NewWithOptions(o Options) (*gin.Engine, error)

NewWithOptions returns a new gin.Engine instance by the given options.

Types

type Options

type Options struct {
	ContextMetadata   map[string]any
	CORSConfig        cors.Config
	EnableCompression bool
	EnableLocation    bool
	EnableRecovery    bool
	EnableRequestID   bool
	Mode              string
	ValidationFuncs   map[string]validator.Func
	Validations       []string
}

Options represents the options which can be set when creating a new engine.

type Response

type Response struct {
	Code             int           `json:"code,omitempty"`
	Status           string        `json:"status,omitempty"`
	Error            interface{}   `json:"error,omitempty"`
	Redirect         string        `json:"-"`
	RedirectResponse bool          `json:"-"`
	Sleep            time.Duration `json:"-"`
}

Response represents an HTTP response.

func (*Response) Reply

func (resp *Response) Reply(c *gin.Context, responses ...interface{})

Reply replies an HTTP request by the Response instance and the given trailing arguments.

Directories

Path Synopsis
_examples
basic command

Jump to

Keyboard shortcuts

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