Documentation ¶
Index ¶
- func ConvertProtoToMessageType(protoMsgType protos.MsgType) message.Type
- func CtxWithDefaultLogger(ctx context.Context, route string, userID uint32) context.Context
- func CtxWithPlayerLogger(ctx context.Context, userID uint32) context.Context
- func FileExists(filename string) bool
- func FuncTimeCost() func()
- func GetContextFromRequest(req *protos.Request, serverID string) (context.Context, error)
- func GetErrorFromPayload(serializer serialize.Serializer, payload []byte) error
- func GetErrorPayload(serializer serialize.Serializer, err error) ([]byte, error)
- func GetErrorProtoPayload(serializer serialize.Serializer, err error) ([]byte, message.Type, error)
- func Pcall(method reflect.Method, args []reflect.Value) (rets interface{}, err error)
- func RecoverPanic()
- func SerializeOrRaw(serializer serialize.Serializer, typ message.Type, v interface{}) ([]byte, error)
- func SliceContainsString(slice []string, str string) bool
- func StartSpanFromRequest(ctx context.Context, serverID, route string) context.Context
- type Pool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertProtoToMessageType ¶
ConvertProtoToMessageType converts a protos.MsgType to a message.Type
func CtxWithDefaultLogger ¶
CtxWithDefaultLogger inserts a default logger on ctx to be used on handlers and remotes. If using logrus, userId, route and requestId will be added as fields. Otherwise the pitaya logger will be used as it is.
func CtxWithPlayerLogger ¶
func GetContextFromRequest ¶
GetContextFromRequest gets the context from a request
func GetErrorFromPayload ¶
func GetErrorFromPayload(serializer serialize.Serializer, payload []byte) error
GetErrorFromPayload gets the error from payload
func GetErrorPayload ¶
func GetErrorPayload(serializer serialize.Serializer, err error) ([]byte, error)
GetErrorPayload creates and serializes an error payload
func GetErrorProtoPayload ¶
func Pcall ¶
Pcall calls a method that returns an interface and an error and recovers in case of panic
func RecoverPanic ¶
func RecoverPanic()
func SerializeOrRaw ¶
func SerializeOrRaw(serializer serialize.Serializer, typ message.Type, v interface{}) ([]byte, error)
SerializeOrRaw serializes the interface if its not an array of bytes already
func SliceContainsString ¶
SliceContainsString returns true if a slice contains the string