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: 0

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

Jump to

Keyboard shortcuts

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