examples

package
v0.0.0-...-9ad72aa Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Logger

func Logger() gin.HandlerFunc

func ShowAsciiJSON

func ShowAsciiJSON() error

func ShowBindDataRequestWithCustomStruct

func ShowBindDataRequestWithCustomStruct() error

func ShowBindHtmlCheckBoxes

func ShowBindHtmlCheckBoxes() error

func ShowBindQueryStringOrPostData

func ShowBindQueryStringOrPostData() error

func ShowBindUri

func ShowBindUri() error

func ShowBuildSingleBinaryWithAssertTemplate

func ShowBuildSingleBinaryWithAssertTemplate() error

func ShowControlLogOutputColor

func ShowControlLogOutputColor() error

ShowControlLogOutputColor By default, logs output on console should be colorized depending on the detected TTY.

func ShowCustomHttpConfiguration

func ShowCustomHttpConfiguration() error

ShowCustomHttpConfiguration Use http.ListenAndServe() directly.

func ShowCustomLogFile

func ShowCustomLogFile() error

func ShowCustomMiddleware

func ShowCustomMiddleware() error

func ShowCustomValidators

func ShowCustomValidators() error

func ShowDefineRoutesLogFormat

func ShowDefineRoutesLogFormat() error

ShowDefineRoutesLogFormat

 The default log of routes is:
	[GIN-debug] POST /foo	--> main.main.func1 (3 handlers)

Use gin.DebugPrintRouteFunc to custom this information in given format.

func ShowGoroutinesInsideAMiddleware

func ShowGoroutinesInsideAMiddleware() error

func ShowGracefulRestartOrStop

func ShowGracefulRestartOrStop() error

func ShowGroupingRoutes

func ShowGroupingRoutes() error

func ShowHowToWriteLogFile

func ShowHowToWriteLogFile() error

func ShowHtmlRendering

func ShowHtmlRendering() error

func ShowJsonPadding

func ShowJsonPadding() error

ShowJsonPadding Solve Ajax not allowed to fetch cross-domain data issue.

func ShowMapAsQueryStringOrPostFormParams

func ShowMapAsQueryStringOrPostFormParams() error

func ShowServingStaticFiles

func ShowServingStaticFiles() error

go run . --static_dir=/Users/litong.deng/Downloads

func ShowUploadFile

func ShowUploadFile() error

go run . --upload_dir=/Users/litong.deng/Downloads

Types

type Booking

type Booking struct {
	// validation: today < checkIn < CheckOut
	CheckIn  time.Time `form:"check_in" binding:"required,bookabledate" time_format:"2006-01-02"`
	CheckOut time.Time `form:"check_out" binding:"required,gtfield=CheckIn,bookabledate" time_format:"2006-01-02"`
	Cost     float64   `form:"cost" binding:"required,costable"`
}

type MyForm

type MyForm struct {
	Name   string   `form:"name"`
	Colors []string `form:"colors[]"`
}

type Person

type Person struct {
	Name     string    `form:"name"`
	Address  string    `form:"address"`
	Birthday time.Time `form:"birthday" time_format:"2006-01-02" time_utc:"1"`
}

type PersonUri

type PersonUri struct {
	ID   string `uri:"id" binding:"required,uuid"`
	Name string `uri:"name" binding:"required"`
}

type StructA

type StructA struct {
	FieldA string `form:"field_a"`
}

type StructB

type StructB struct {
	NestedStruct StructA
	FieldB       string `form:"field_b"`
}

type StructC

type StructC struct {
	NestedStructPointer *StructA
	FieldC              string `form:"field_c"`
}

type StructD

type StructD struct {
	NestedAnonyStruct struct {
		FieldX       string `form:"field_x"`
		NestedStruct StructA
	}
	FieldD string `form:"field_d"`
}

Jump to

Keyboard shortcuts

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