common

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2016 License: Apache-2.0 Imports: 9 Imported by: 4

Documentation

Index

Constants

View Source
const (
	VERSION string = "0.0.1"
	NAME    string = "dubbogo"
	DUBBO   string = "dubbo"
)
View Source
const (
	DUBBOGO_CTX_KEY string = "dubbogo-ctx"
)

Variables

This section is empty.

Functions

func ArrayRemoveAt

func ArrayRemoveAt(a interface{}, i int)

code example:

data := []string{"one", "two", "three"} ArrayRemoveAt(&data, 2) fmt.Println("data len:", len(data), ", data:", data)

data2 := []int32{1, 2, 3} ArrayRemoveAt(&data2, 2) fmt.Println("data2 len:", len(data2), ", data2:", data2)

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 New

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

func NotFound

func NotFound(id, detail string) error

func RandStringBytesMaskImprSrc

func RandStringBytesMaskImprSrc(n int) string

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 (this *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