utils

package
v0.0.0-...-deb2a74 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildGinHandler

func BuildGinHandler(fn func(ctx *gin.Context) (interface{}, error)) gin.HandlerFunc

BuildGinHandler 统一构造 gin 的路由函数

func Convert

func Convert(from, to interface{}) error

Convert 转换结构体数据

func SafeAsync

func SafeAsync(fn func())

func SafeAsyncFunc

func SafeAsyncFunc(fn func()) func()

Types

type IoC

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

func NewIoC

func NewIoC() *IoC

func (*IoC) InvokeE

func (c *IoC) InvokeE(fn interface{}, opts ...dig.InvokeOption) error

InvokeE 用于运行时获取容器实例 需要处理返回的错误

func (*IoC) MustInvoke

func (c *IoC) MustInvoke(fn interface{}, opts ...dig.InvokeOption)

MustInvoke 用于启动时获取容器实例 错误将会停止进程直接 panic

func (*IoC) MustProvide

func (c *IoC) MustProvide(constructor interface{}, opts ...dig.ProvideOption)

MustProvide 用于启动时注册容器实例 错误将会停止进程直接 panic

func (*IoC) ProvideE

func (c *IoC) ProvideE(constructor interface{}, opts ...dig.ProvideOption) error

ProvideE 用于运行时注册容器实例 需要处理返回的错误

Jump to

Keyboard shortcuts

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