tools

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultAllowHeaders = []string{"authorization", "token", "content-type", "x-requested-with"}
	DefaultAllowMethods = []string{http.MethodPost, http.MethodGet, http.MethodPut, http.MethodDelete, http.MethodOptions, http.MethodPatch}
)

Functions

func Cors

func Cors(c *gin.Context, config *CorsConfig)

Cors 自己尝试的cors配置实现

func DefaultCors added in v1.0.6

func DefaultCors(c *gin.Context)

func ParseGlob

func ParseGlob(tpl *template.Template, dir string, pattern string) (t *template.Template, err error)

ParseGlob 自定义模版解析,扫描子目录

func RandStringBytes

func RandStringBytes(n int) string

RandStringBytes 随机字符串

func UUID added in v1.0.5

func UUID() (_uuid string, err error)

UUID UUID

Types

type CorsConfig added in v1.0.6

type CorsConfig struct {
	AllowOrigins     []string
	AllowAnyOrigin   bool
	AllowMethods     []string
	AllowHeaders     []string
	AllowCredentials bool
}

func DefaultCorsConfig added in v1.0.6

func DefaultCorsConfig() *CorsConfig

type TemplateRenderer

type TemplateRenderer struct {
	Templates *template.Template
}

TemplateRenderer is a custom html/template renderer for Echo framework

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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