SpringUtils

package
v1.0.0-rc Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2020 License: Apache-2.0 Imports: 7 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyBean

func CopyBean(src interface{}, dest interface{}) error

使用反射直接赋值的方式拷贝,不支持匿名字段,不支持类型转换。 TODO 完善该方法,可以参考 json 序列化,需要进行性能测试。

func CopyBeanUseJson

func CopyBeanUseJson(src interface{}, dest interface{}) error

使用 json 序列化框架进行拷贝,支持匿名字段,支持类型转换。

func LoadXmlConfig

func LoadXmlConfig(path string, config interface{}) error

加载 XML 配置文件

func LocalIPv4

func LocalIPv4() string

获取本机的 IPv4 地址

func NewList

func NewList(v ...interface{}) *list.List

func SafeCloseChan

func SafeCloseChan(ch chan struct{})

安全地关闭一个管道

func ToJson

func ToJson(i interface{}) string

func ToString

func ToString(err error) string

获取 error 的字符串

Types

type PanicCond

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

PanicCond 封装触发 panic 的条件

func NewPanicCond

func NewPanicCond(e interface{}) *PanicCond

NewPanicCond PanicCond 的构造函数

func Panic

func Panic(err error) *PanicCond

Panic 返回一个封装的 panic 条件

func (*PanicCond) When

func (p *PanicCond) When(isPanic bool)

When 满足给定条件时抛出一个 panic

Jump to

Keyboard shortcuts

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