request

package
v0.0.0-...-e0bdc34 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package request provides request body model and related components.

Index

Constants

This section is empty.

Variables

View Source
var DefaultLogger *log.Logger = log.New(os.Stdout, "[request] ", log.Ldate|log.Ltime|log.Lshortfile)

Package-level logger.

Functions

This section is empty.

Types

type Binder

type Binder interface {
	Bind(*gin.Context) (*DefaultRequest, error)
}

Converts request body into DefaultRequest structure using gin.Context

type DefaultRequest

type DefaultRequest struct {
	Locale `form:"locale" json:"locale" binding:"required,locale"`
}

Represents base request body of each client request.

func (DefaultRequest) String

func (r DefaultRequest) String() string

Implements fmt.Stringer interface.

type JSONBinder

type JSONBinder struct {
	// contains filtered or unexported fields
}

Converts json from request body into DefaultRequest structure.

func (*JSONBinder) Bind

func (b *JSONBinder) Bind(context *gin.Context) (*DefaultRequest, error)

func (*JSONBinder) SetLogger

func (b *JSONBinder) SetLogger(logger *log.Logger)

type Locale

type Locale string

type QueryBinder

type QueryBinder struct {
	// contains filtered or unexported fields
}

Converts URI query parameters into DefaultRequest structure.

func (*QueryBinder) Bind

func (b *QueryBinder) Bind(context *gin.Context) (*DefaultRequest, error)

func (*QueryBinder) SetLogger

func (b *QueryBinder) SetLogger(logger *log.Logger)

Jump to

Keyboard shortcuts

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