Help us shape the future of Go! Take the 2026 Go Developer Survey

api

package
v1.16.6 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2025 License: MIT Imports: 3 Imported by: 28

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnonymousField

func AnonymousField()

AnonymousField example

@Summary	use Anonymous field
@Success	200	{object}	web.RevValue	"ok"

func GetStringByInt

func GetStringByInt(w http.ResponseWriter, r *http.Request)

GetStringByInt example

@Summary		Add a new pet to the store
@Description	get string by ID
@ID				get-string-by-int
@Accept			json
@Produce		json
@Param			some_id	path		int				true	"Some ID"
@Param			some_id	body		web.Pet			true	"Some ID"
@Success		200		{string}	string			"ok"
@Failure		400		{object}	web.APIError	"We need ID!!"
@Failure		404		{object}	web.APIError	"Can not find ID"
@Router			/testapi/get-string-by-int/{some_id} [get]

func GetStructArrayByString

func GetStructArrayByString(w http.ResponseWriter, r *http.Request)

GetStructArrayByString example

@Description	get struct array by ID
@ID				get-struct-array-by-string
@Accept			json
@Produce		json
@Param			some_id	path		string			true	"Some ID"
@Param			offset	query		int				true	"Offset"
@Param			limit	query		int				true	"Offset"
@Success		200		{string}	string			"ok"
@Failure		400		{object}	web.APIError	"We need ID!!"
@Failure		404		{object}	web.APIError	"Can not find ID"
@Router			/testapi/get-struct-array-by-string/{some_id} [get]

func Upload

func Upload(w http.ResponseWriter, r *http.Request)

Upload example

@Summary		Upload file
@Description	Upload file
@ID				file.upload
@Accept			multipart/form-data
@Produce		json
@Param			file	formData	file			true	"this is a test file"
@Success		200		{string}	string			"ok"
@Failure		400		{object}	web.APIError	"We need ID!!"
@Failure		404		{object}	web.APIError	"Can not find ID"
@Router			/file/upload [post]

Types

type Pet3

type Pet3 struct {
	ID int `json:"id"`
}

Pet3 example

Jump to

Keyboard shortcuts

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