Documentation ¶
Overview ¶
@Title @Description @Author Wangwengang 2021/6/1 上午11:46 @Update Wangwengang 2021/6/1 上午11:46
@Title @Description @Author Wangwengang 2021/6/5 下午2:53 @Update Wangwengang 2021/6/5 下午2:53
@Title @Description @Author Wangwengang 2021/6/27 下午1:49 @Update Wangwengang 2021/6/27 下午1:49
@Title @Description @Author Wangwengang 2021/6/8 下午3:37 @Update Wangwengang 2021/6/8 下午3:37
@Title @Description @Author Wangwengang 2021/6/27 下午2:48 @Update Wangwengang 2021/6/27 下午2:48
@Title @Description @Author Wangwengang 2021/6/27 下午2:35 @Update Wangwengang 2021/6/27 下午2:35
@Title @Description @Author Wangwengang 2021/6/26 下午4:41 @Update Wangwengang 2021/6/26 下午4:41
@Title @Description @Author Wangwengang 2021/6/8 下午5:50 @Update Wangwengang 2021/6/8 下午5:50
@Title @Description @Author Wangwengang 2021/6/2 上午11:02 @Update Wangwengang 2021/6/2 上午11:02
@Title @Description @Author Wangwengang 2021/6/1 下午12:20 @Update Wangwengang 2021/6/1 下午12:20
@Title @Description @Author Wangwengang 2021/6/1 下午12:21 @Update Wangwengang 2021/6/1 下午12:21
Index ¶
- Constants
- Variables
- func BytesToPrivateKey(priv []byte) (*rsa.PrivateKey, error)
- func CNYFen2Yuan(fen int64) float64
- func CNYYuan2Fen(yuan float64) int64
- func CreateDir(dirs ...string) (err error)
- func CustomTimeEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder)
- func DateEqual(date1, date2 time.Time) bool
- func ExistInIds(id int64, ids []int64) bool
- func GetDatePart(t time.Time) string
- func GetDateTime(t time.Time) string
- func GetDayDateRange(t time.Time) (dayStart, dayEnd time.Time)
- func GetEightHourTimeRange(timeObj time.Time) (start time.Time, end time.Time)
- func GetMonthDateRange(t time.Time) (monthStart, monthEnd time.Time)
- func GetNowTimeUTC() string
- func GetTimePart(t time.Time) string
- func GetTodayAndTomorrowString(t1 time.Time) (string, string)
- func GetWeekDateRange(t time.Time) (weekStart, weekEnd time.Time)
- func GetWriteSyncer() (zapcore.WriteSyncer, error)
- func GetYesterdayDateRange() (dayStart, dayEnd time.Time)
- func GormMysql(cfg config.Mysql) *gorm.DB
- func MD5(text string) string
- func NewConsumer(topic string, channel string, maxInFlight int) (*nsq.Consumer, error)
- func NewIMServer(cfg config.TencentIM) *tencentIM.IMServer
- func NewMongoConn(cfg config.Mongo) *mongo.Client
- func NewProducer() *nsq.Producer
- func ParseDate(str string) (time.Time, error)
- func ParseStingDateTimeToTimeObj(str string) time.Time
- func ParseStingDateToTimeObj(str string) time.Time
- func PathExists(path string) (bool, error)
- func RandInt64(min, max int64) int64
- func Redis(cfg config.Redis) *redis.Client
- func Viper(path ...string) *viper.Viper
- func Zap() (logger *zap.Logger)
- type ConsumerT
- type RoomDataReciver
- type RoomDataSender
Constants ¶
const ( ConfigFile = "./config.yaml" ConfigEnv = "YFCONFIGPATH" )
const ( HourMinuteOnlyFormat string = "15:04" TimeOnlyFormat string = "15:04:05" TimeFormat string = "2006-01-02 15:04:05" DateTimeFormat string = "20060102150405" MonthFormat string = "2006-01" DateFormat string = "2006-01-02" ShortDateFormat string = "20060102" DateHourFormat string = "2006010215" InnerToken string = "hk-90ce5980e4a2d5a94ae72e2d9cadc910" ShortTimeFormat string = "01-02 15:04:05" )
const (
SEND_TIMEOUT_SECOND = 5
)
Variables ¶
var ( ErrConnSendTimeout = errors.New("Connection send timeout") ErrDataIsNil = errors.New("Send data is nil") )
var RR = &RoomDataReciver{ RecvMsgQueue: make(chan *pb.RoomPushData, 200), }
var RS = &RoomDataSender{ producer: nil, sendMsgQueue: make(chan *pb.RoomPushData, 4096), }
Functions ¶
func BytesToPrivateKey ¶
func BytesToPrivateKey(priv []byte) (*rsa.PrivateKey, error)
BytesToPrivateKey bytes to private key
func CustomTimeEncoder ¶
func CustomTimeEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder)
自定义日志输出时间格式
func GetDayDateRange ¶
根据当前时间,获取一天开始结束日期
func GetEightHourTimeRange ¶
计算8小时区间
func GetMonthDateRange ¶
根据当前时间,获取一个月开始结束日期
func GetTodayAndTomorrowString ¶
返回 今天 和 明天
func GetWeekDateRange ¶
根据当前时间,获取一周开始结束日期
func GetWriteSyncer ¶
func GetWriteSyncer() (zapcore.WriteSyncer, error)
func GetYesterdayDateRange ¶
根据当前时间,获取前一天开始结束日期
func NewConsumer ¶
初始化消费者(maxInFlight默认赋值100吧)
func NewMongoConn ¶ added in v0.0.7
NewMongoConn 创建链接
Types ¶
type ConsumerT ¶
type ConsumerT struct { RoomDataReciverPtr *RoomDataReciver Func func(*pb.RoomPushData) }
消费者
type RoomDataReciver ¶
type RoomDataReciver struct {
RecvMsgQueue chan *pb.RoomPushData
}
func (*RoomDataReciver) NewRoomDataReciver ¶
func (r *RoomDataReciver) NewRoomDataReciver(channel string, maxInFlight, concurrency int, f func(data *pb.RoomPushData)) (*nsq.Consumer, error)
type RoomDataSender ¶
type RoomDataSender struct {
// contains filtered or unexported fields
}
func (*RoomDataSender) Publish ¶
func (r *RoomDataSender) Publish(roomId int64, msgType int32, data []byte) error
func (*RoomDataSender) PublishDirect ¶
func (r *RoomDataSender) PublishDirect(topic string, data []byte) error
发布消息
func (*RoomDataSender) Run ¶
func (p *RoomDataSender) Run()
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
@Title @Description @Author Wangwengang 2021/6/13 下午5:06 @Update Wangwengang 2021/6/13 下午5:06
|
@Title @Description @Author Wangwengang 2021/6/13 下午5:06 @Update Wangwengang 2021/6/13 下午5:06 |
@Title @Description @Author Wangwengang 2021/6/27 下午2:06 @Update Wangwengang 2021/6/27 下午2:06
|
@Title @Description @Author Wangwengang 2021/6/27 下午2:06 @Update Wangwengang 2021/6/27 下午2:06 |