common

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DUBBOGO_CTX_KEY = "dubbogo-ctx"
)

Variables

This section is empty.

Functions

func BadRequest

func BadRequest(id, detail string) error

func Contains

func Contains(s []string, e string) bool

func Forbidden

func Forbidden(id, detail string) error

func Future

func Future(sec int, f func())

func GetLocalIP

func GetLocalIP(addr string) (string, error)

如果@addr为空,则获取本机的私有地址

func Goid

func Goid() int

func InternalServerError

func InternalServerError(id, detail string) error

func NewError added in v0.2.0

func NewError(id, detail string, code int32) error

func NotFound

func NotFound(id, detail string) error

func SetNetConnTimeout added in v0.2.0

func SetNetConnTimeout(conn net.Conn, timeout time.Duration)

refer to samuel/go-zookeeper

func TimeSecondDuration

func TimeSecondDuration(sec int) time.Duration

func TrimPrefix

func TrimPrefix(s string, prefix string) string

func TrimSuffix

func TrimSuffix(s string, suffix string) string

func Unauthorized

func Unauthorized(id, detail string) error

Types

type ApplicationConfig

type ApplicationConfig struct {
	// 组织名(BU或部门)
	Organization string
	// 应用名称
	Name string
	// 模块名称
	Module string
	// 模块版本
	Version string
	// 应用负责人
	Owner string
}

func (*ApplicationConfig) ToString

func (c *ApplicationConfig) ToString() string

type Error

type Error struct {
	ID     string `json:"id"`
	Code   int32  `json:"code"`
	Detail string `json:"detail"`
	Status string `json:"status"`
}

Errors provide a way to return detailed information for an RPC request error. The error is normally JSON encoded.

func Parse

func Parse(err string) *Error

func (*Error) Error

func (e *Error) Error() string

Jump to

Keyboard shortcuts

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