Documentation ¶
Index ¶
- Constants
- Variables
- func BeginningOfTheDay(t time.Time) time.Time
- func CircleRand(commonArrs []CommonRand) (id int, arrIndex int)
- func Date(year int, month time.Month, day, hour, min, sec, nsec int) time.Time
- func DiffDay(t1, t2 time.Time) int32
- func Distance(p0, p1 Vec3f) float64
- func EndingOfTheDay(t time.Time) time.Time
- func Exit(code int)
- func FindMsgByName(msgName string) (protoreflect.MessageType, error)
- func GetNextHour() time.Time
- func GetNextMinute() time.Time
- func GetNextTime(hour, minute int) time.Time
- func GetTimeWithoutHours(t time.Time) time.Time
- func GoEngine(fn func())
- func GoLogic(fn func())
- func HttpGet(url string) ([]byte, error)
- func HttpPost(addr string, body []byte) (result []byte, err error)
- func HttpPostForm(url string, data url.Values) (result []byte, err error)
- func HttpReq(r *http.Request) *http.Response
- func HttpRespCode(w http.ResponseWriter, code int)
- func HttpResponse(w http.ResponseWriter, data interface{}) (ok bool)
- func HttpTransmit(w http.ResponseWriter, r *http.Request, remote string)
- func HttpUnmarshalBody(r *http.Request, data interface{}) (body []byte, ok bool)
- func If(condition bool, trueVal, falseVal interface{}) interface{}
- func Int32Merge(h, l int16) (id int32)
- func Int32Split(id int32) (h, l int16)
- func IsInvalidTime(data time.Time) bool
- func IsSameDay(time1 time.Time, time2 time.Time) bool
- func Magnitude(v Vec3f) float64
- func MidOfTheDay(t time.Time) time.Time
- func Milliseconds() int64
- func ModifyTimeOffset(add int64)
- func MondayBeginWeek() int64
- func MsgName(msg proto.Message) string
- func Nanoseconds() int64
- func NextIntervalTime(t1 time.Time, intervalSeconds int) time.Time
- func NextMondayBeginWeek() int64
- func Now() time.Time
- func PProfInit(port int32)
- func PrintMemUsage()
- func Probability(ratio int) bool
- func Probability10000(ratio int) bool
- func Randx_y(x, y int) int
- func Seconds() int64
- func SqrDistance(p0, p1 Vec3f) float64
- func SqrMagnitude(v Vec3f) float64
- func TimeFormat(data time.Time) string
- func TimeParse(data string) time.Time
- func TimeParseFormat(layout, value string) (time.Time, error)
- func Try(fn func(), catch func(ex interface{}))
- func UUID() string
- func Unix(sec int64, nsec int64) time.Time
- func Valid(v Vec3f) bool
- type CommonRand
- type HostInfo
- type HttpHandler
- type ProtoParser
- type Vec3f
Constants ¶
View Source
const ( SecondsPerDay = 24 * 60 * 60 SecondsForever = SecondsPerDay * 365 * 10 //10年(int32~(2020+17)) )
View Source
const HTTPPrefixPProf = "/debug/pprof"
Variables ¶
View Source
var ( TimeZero = Unix(0, 0) TimeOffset int64 TimeOffsetPath = "./.timeoffset" )
Functions ¶
func CircleRand ¶
func CircleRand(commonArrs []CommonRand) (id int, arrIndex int)
func FindMsgByName ¶
func FindMsgByName(msgName string) (protoreflect.MessageType, error)
func GetNextHour ¶
func GetNextMinute ¶
func GetNextTime ¶
func HttpRespCode ¶
func HttpRespCode(w http.ResponseWriter, code int)
func HttpResponse ¶
func HttpResponse(w http.ResponseWriter, data interface{}) (ok bool)
func HttpTransmit ¶
func HttpTransmit(w http.ResponseWriter, r *http.Request, remote string)
func HttpUnmarshalBody ¶
func Int32Merge ¶
func Int32Split ¶
func IsInvalidTime ¶
func Milliseconds ¶
func Milliseconds() int64
func ModifyTimeOffset ¶ added in v1.1.4
func ModifyTimeOffset(add int64)
func MondayBeginWeek ¶
func MondayBeginWeek() int64
func Nanoseconds ¶ added in v1.1.4
func Nanoseconds() int64
func NextIntervalTime ¶
以当天开始时间为初始值 间隔 intervalSeconds触发一次,返回下次触发的时间
func NextMondayBeginWeek ¶
func NextMondayBeginWeek() int64
func PrintMemUsage ¶ added in v1.0.7
func PrintMemUsage()
PrintMemUsage outputs the current, total and OS memory being used. As well as the number of garage collection cycles completed.
func SqrDistance ¶
func SqrMagnitude ¶
func TimeFormat ¶
Types ¶
type CommonRand ¶
type HostInfo ¶ added in v1.0.7
type HostInfo struct { Total int32 // 总内存MB Used int32 // 已用内存MB Avaliable int32 // 可用内存MB CpuUsage int32 // 使用百分比 CpuCores int32 // CPU线程数 }
func GetHostInfo ¶ added in v1.0.7
type HttpHandler ¶
func (*HttpHandler) ServeHTTP ¶
func (h *HttpHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type ProtoParser ¶
type ProtoParser struct {
// contains filtered or unexported fields
}
func NewProtoParser ¶
func NewProtoParser() *ProtoParser
func (*ProtoParser) Init ¶
func (s *ProtoParser) Init(packageName, msgType string) *ProtoParser
协议enum->message自动解析: 1、不区分大消息 2、过滤下划线
func (*ProtoParser) MsgIdToName ¶
func (s *ProtoParser) MsgIdToName(msgId int32) (msgName string, ok bool)
func (*ProtoParser) MsgNameToId ¶
func (s *ProtoParser) MsgNameToId(msgName string) (msgId int32, ok bool)
func (*ProtoParser) UnmarshalPbMsg ¶
func (s *ProtoParser) UnmarshalPbMsg(msgType int32, data []byte) proto.Message
Source Files ¶
Click to show internal directories.
Click to hide internal directories.