lib

package
v1.19.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2022 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//DefaultWriter default json writer
	DefaultWriter = func(resp *restful.Response, event *operator.Event) bool {
		if err := codec.EncJsonWriter(event, resp.ResponseWriter); err != nil {
			blog.Errorf("defaultWriter error: %v", err)
			return false
		}
		return true
	}
)

Functions

func CopyMap

func CopyMap(s operator.M) (r operator.M)

CopyMap return a new operator.M copy from provided by depth=1

func GetMongodbTank

func GetMongodbTank(name string) func() operator.Tank

func GetZookeeperTank

func GetZookeeperTank(name string) func() operator.Tank

func MarkProcess

MarkProcess does the following things: 1. print log when a request comes in and returns. 2. print request body to log. 3. flow control.

func NewWatchServer

func NewWatchServer(req *restful.Request, resp *restful.Response, tank operator.Tank) (*watchServer, error)

NewWatchServer create default json formate watchServer

func ReturnRest

func ReturnRest(resp *RestResponse)

ReturnRest common restfult response

Types

type ExtraField

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

func NewExtra

func NewExtra(raw string) *ExtraField

func (*ExtraField) GetStr

func (ef *ExtraField) GetStr() (string, error)

func (*ExtraField) Unmarshal

func (ef *ExtraField) Unmarshal(r interface{}) (err error)

type Manager

type Manager struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewManager

func NewManager(sep int64, title string) *Manager

func (*Manager) Add

func (m *Manager) Add(t time.Duration)

func (*Manager) Flush

func (m *Manager) Flush()

func (*Manager) Start

func (m *Manager) Start()

type RestResponse

type RestResponse struct {
	Resp     *restful.Response
	HTTPCode int

	Data    interface{}
	ErrCode int
	Message string
	Extra   map[string]interface{}

	WrapFunc func([]byte) []byte
}

RestResponse wrapper for restful Response

Jump to

Keyboard shortcuts

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