api

package
v0.1.15 Latest Latest
Warning

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

Go to latest
Published: May 25, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Api

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

func New

func New(opts ...Option) *Api

func (*Api) Finish

func (api *Api) Finish() error

func (*Api) Options

func (api *Api) Options() Options

func (*Api) PrefixRouter

func (api *Api) PrefixRouter() Router

func (*Api) RootRouter

func (api *Api) RootRouter() Router

func (*Api) Start

func (api *Api) Start() error

type Context

type Context struct {
	*gin.Context
}

func (*Context) GetFileHeaderBytes

func (c *Context) GetFileHeaderBytes(fileHeader *multipart.FileHeader) (string, []byte, error)

GetFileHeaderBytes 获取传递的文件名和文件内容

type Handler

type Handler func(c *Context)

Handler 请求处理函数

type Option

type Option func(options *Options)

func WithPort

func WithPort(port string) Option

func WithUrlPrefix

func WithUrlPrefix(urlPrefix string) Option

type Options

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

func (Options) GetPort

func (options Options) GetPort() string

func (Options) GetUrlPrefix

func (options Options) GetUrlPrefix() string

type PrefixRouter

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

func (*PrefixRouter) AddMiddlewares

func (r *PrefixRouter) AddMiddlewares(middlewares ...Handler) Router

func (*PrefixRouter) AddRoute

func (r *PrefixRouter) AddRoute(method string, relativePath string, middlewares ...Handler) Router

func (*PrefixRouter) BasePath

func (r *PrefixRouter) BasePath() string

func (*PrefixRouter) RegisterVersionedRouter

func (r *PrefixRouter) RegisterVersionedRouter(version string, middlewares ...Handler) Router

func (*PrefixRouter) Static

func (r *PrefixRouter) Static(relativePath string, root string)

func (*PrefixRouter) StaticFile

func (r *PrefixRouter) StaticFile(relativePath string, filepath string)

func (*PrefixRouter) VersionedRouter

func (r *PrefixRouter) VersionedRouter(version string) Router

type RootRouter

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

func (*RootRouter) AddMiddlewares

func (r *RootRouter) AddMiddlewares(middlewares ...Handler) Router

func (*RootRouter) AddRoute

func (r *RootRouter) AddRoute(method string, relativePath string, middlewares ...Handler) Router

func (*RootRouter) BasePath

func (r *RootRouter) BasePath() string

func (*RootRouter) RegisterVersionedRouter

func (r *RootRouter) RegisterVersionedRouter(version string, middlewares ...Handler) Router

func (*RootRouter) ServerHttp added in v0.1.2

func (r *RootRouter) ServerHttp(w http.ResponseWriter, req *http.Request)

func (*RootRouter) Static

func (r *RootRouter) Static(relativePath string, root string)

func (*RootRouter) StaticFile

func (r *RootRouter) StaticFile(relativePath string, filepath string)

func (*RootRouter) VersionedRouter

func (r *RootRouter) VersionedRouter(version string) Router

type Router

type Router interface {
	AddMiddlewares(middlewares ...Handler) Router
	RegisterVersionedRouter(version string, middlewares ...Handler) Router
	VersionedRouter(version string) Router
	AddRoute(method string, relativePath string, middlewares ...Handler) Router
	Static(relativePath string, root string)
	StaticFile(relativePath string, filepath string)
	BasePath() string
}

Jump to

Keyboard shortcuts

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