config

package
v1.0.16 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 47 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolEnv

func BoolEnv(b *bool, key string)

BoolEnv 环境bool值

func GetEnv

func GetEnv(key string, defaultValue string) string

GetEnv 成环境变量里获取

func GetEnvBool

func GetEnvBool(key string, defaultValue bool) bool

GetEnvBool 成环境变量里获取

func GetEnvFloat64

func GetEnvFloat64(key string, defaultValue float64) float64

GetEnvFloat64 环境变量获取

func GetEnvInt

func GetEnvInt(key string, defaultValue int) int

GetEnvInt 环境变量获取

func GetEnvInt64

func GetEnvInt64(key string, defaultValue int64) int64

GetEnvInt64 环境变量获取

func StringEnv

func StringEnv(v *string, key string)

StringEnv StringEnv

Types

type APNSPush

type APNSPush struct {
	Dev      bool
	Topic    string
	Password string
	Cert     string
}

苹果推送

type AliyunInternationalSMSConfig

type AliyunInternationalSMSConfig struct {
	AccessKeyID  string // aliyun的AccessKeyID
	AccessSecret string // aliyun的AccessSecret
	SignName     string // 签名
}

AliyunInternationalSMSConfig 阿里云短信

type AliyunSMSConfig

type AliyunSMSConfig struct {
	AccessKeyID  string // aliyun的AccessKeyID
	AccessSecret string // aliyun的AccessSecret
	TemplateCode string // aliyun的短信模版
	SignName     string // 签名
}

AliyunSMSConfig 阿里云短信

type AsyncTask

type AsyncTask struct {
	log.Log
	// contains filtered or unexported fields
}

AsyncTask 异步任务

func NewAsyncTask

func NewAsyncTask(cfg *Config) *AsyncTask

NewAsyncTask 创建一个异步任务

func (*AsyncTask) LaunchWorker

func (a *AsyncTask) LaunchWorker(consumerTag string, concurrency int) error

LaunchWorker 启动消费worker [concurrency]并发数

func (*AsyncTask) RegisterTask

func (a *AsyncTask) RegisterTask(name string, taskFunc interface{}) error

RegisterTask 注册任务

func (*AsyncTask) RegisterTasks

func (a *AsyncTask) RegisterTasks(namedTaskFuncs map[string]interface{}) error

RegisterTasks 注册任务

func (*AsyncTask) SendTask

func (a *AsyncTask) SendTask(task *tasks.Signature) (*result.AsyncResult, error)

SendTask 发送任务

func (*AsyncTask) SendTaskWithContext

func (a *AsyncTask) SendTaskWithContext(ctx context.Context, task *tasks.Signature) (*result.AsyncResult, error)

SendTaskWithContext 发送任务

type CMDGroupAvatarUpdateReq

type CMDGroupAvatarUpdateReq struct {
	GroupNo string   `json:"group_no"` // 群编号
	Members []string `json:"members"`  // 成员uids
}

CMDGroupAvatarUpdateReq 群头像更新请求

type CMDResp

type CMDResp struct {
	CMD   string      `json:"cmd"`
	Param interface{} `json:"param"`
}

CMDResp CMDResp

type Channel

type Channel struct {
	ChannelID   string
	ChannelType uint8
}

type ChannelBlacklistReq

type ChannelBlacklistReq struct {
	ChannelReq
	UIDs []string `json:"uids"` // 黑名单用户
}

ChannelBlacklistReq 黑名单

type ChannelCreateReq

type ChannelCreateReq struct {
	ChannelID   string   `json:"channel_id"`   // 频道ID
	ChannelType uint8    `json:"channel_type"` // 频道类型
	Ban         int      `json:"ban"`          // 是否被封禁(被封后 任何人都不能发消息,包括创建者)
	Large       int      `json:"large"`        // 是否是超大群(一般建议500或1000成员以上设置为超大群,超大群,注意:超大群不会维护最近会话数据)
	Subscribers []string `json:"subscribers"`  // 订阅者
}

ChannelCreateReq 频道创建请求

type ChannelInfoCreateReq

type ChannelInfoCreateReq struct {
	ChannelID   string `json:"channel_id"`   // 频道ID
	ChannelType uint8  `json:"channel_type"` // 频道类型
	Ban         int    `json:"ban"`          // 是否封禁
	Large       int    `json:"large"`        // 是否大群
}

ChannelInfoCreateReq

type ChannelReq

type ChannelReq struct {
	ChannelID   string `json:"channel_id"`   // 频道ID
	ChannelType uint8  `json:"channel_type"` // 频道类型
}

ChannelReq ChannelReq

type ChannelWhitelistReq

type ChannelWhitelistReq struct {
	ChannelReq
	UIDs []string `json:"uids"` // 白名单用户
}

ChannelWhitelistReq 白名单

type ClearConversationUnreadReq

type ClearConversationUnreadReq struct {
	UID         string `json:"uid"`
	ChannelID   string `json:"channel_id"`
	ChannelType uint8  `json:"channel_type"`
	Unread      int    `json:"unread"`
	MessageSeq  uint32 `json:"message_seq"`
}

ClearConversationUnreadReq 清除用户某个频道未读数请求

type Config

type Config struct {

	// ---------- 基础配置 ----------
	Mode                        Mode   // 模式 debug 测试 release 正式 bench 压力测试
	AppID                       string // APP ID
	AppName                     string // APP名称
	Version                     string // 版本
	RootDir                     string // 数据根目录
	Addr                        string // 服务监听地址 x.x.x.x:8080
	GRPCAddr                    string // grpc的通信地址 (建议内网通信)
	SSLAddr                     string // ssl 监听地址
	MessageSaveAcrossDevice     bool   // 消息是否跨设备保存(换设备登录消息是否还能同步到老消息)
	WelcomeMessage              string // 登录注册欢迎语
	PhoneSearchOff              bool   // 是否关闭手机号搜索
	OnlineStatusOn              bool   // 是否开启在线状态显示
	GroupUpgradeWhenMemberCount int    // 当成员数量大于此配置时 自动升级为超级群 默认为 1000
	EventPoolSize               int64  // 事件任务池大小
	AdminPwd                    string // 后台管理默认密码
	// ---------- 外网配置 ----------
	External struct {
		IP          string // 外网IP
		BaseURL     string // 本服务的对外的基础地址
		H5BaseURL   string // h5页面的基地址 如果没有配置默认未 BaseURL + /web
		APIBaseURL  string // api的基地址 如果没有配置默认未 BaseURL + /v1
		WebLoginURL string // web登录地址
	}
	// ---------- 日志配置 ----------
	Logger struct {
		Dir     string // 日志存储目录
		Level   zapcore.Level
		LineNum bool // 是否显示代码行数
	}
	// ---------- db相关配置 ----------
	DB struct {
		InitDb               bool          //是否需要初始化数据库
		MySQLAddr            string        // mysql的连接信息
		MySQLMaxOpenConns    int           // 最大连接数
		MySQLMaxIdleConns    int           // 最大空闲连接数
		MySQLConnMaxLifetime time.Duration // 连接最大生命周期
		Migration            bool          // 是否合并数据库
		RedisAddr            string        // redis地址
		RedisPass            string        // redis密码
		AsynctaskRedisAddr   string        // 异步任务的redis地址 不写默认为RedisAddr的地址
	}
	// ---------- 分布式配置 ----------
	Cluster struct {
		NodeID int //  节点ID 节点ID需要小于1024
	}

	// ---------- 缓存配置 ----------
	Cache struct {
		TokenCachePrefix            string        // token缓存前缀
		LoginDeviceCachePrefix      string        // 登录设备缓存前缀
		LoginDeviceCacheExpire      time.Duration // 登录设备缓存过期时间
		UIDTokenCachePrefix         string        // uidtoken缓存前缀
		FriendApplyTokenCachePrefix string        // 申请好友的token的前缀
		FriendApplyExpire           time.Duration // 好友申请过期时间
		TokenExpire                 time.Duration // token失效时间
		NameCacheExpire             time.Duration // 名字缓存过期时间
	}
	// ---------- 系统账户设置 ----------
	Account struct {
		SystemUID       string //系统账号uid
		FileHelperUID   string // 文件助手uid
		SystemGroupID   string //系统群ID 需求在app_config表里设置new_user_join_system_group为1才有效
		SystemGroupName string // 系统群的名字
		AdminUID        string //系统管理员账号
	}

	FileService FileService   // 文件服务
	OSS         OSSConfig     // 阿里云oss配置
	Minio       MinioConfig   // minio配置
	Seaweed     SeaweedConfig // seaweedfs配置

	// ---------- 短信运营商 ----------
	SMSCode                string // 模拟的短信验证码
	SMSProvider            SMSProvider
	UniSMS                 UnismsConfig                 // unisms https://unisms.apistd.com/
	AliyunSMS              AliyunSMSConfig              // aliyun sms
	AliyunInternationalSMS AliyunInternationalSMSConfig // 阿里云国际短信

	// ---------- 悟空IM ----------
	WuKongIM struct {
		APIURL       string // im基地址
		ManagerToken string // im的管理者token wukongim配置了就需要填写,没配置就不需要
	}
	// ---------- 头像 ----------
	Avatar struct {
		Default        string // 默认头像
		DefaultCount   int    // 默认头像数量
		Partition      int    // 头像分区数量
		DefaultBaseURL string // 默认头像的基地址
	}
	// ---------- 短编号 ----------
	ShortNo struct {
		NumOn   bool // 是否开启数字短编号
		NumLen  int  // 数字短编号长度
		EditOff bool // 是否关闭短编号编辑
	}
	// ---------- robot ----------
	Robot struct {
		MessageExpire      time.Duration // 消息过期时间
		InlineQueryTimeout time.Duration // inlineQuery事件过期时间
		EventPoolSize      int64         // 机器人事件池大小
	}

	// ---------- gitee ----------
	Gitee struct {
		OAuthURL     string // gitee oauth url
		ClientID     string // gitee client id
		ClientSecret string // gitee client secret
	}
	// ---------- github ----------
	Github struct {
		OAuthURL     string // github oauth url
		ClientID     string // github client id
		ClientSecret string // github client secret
	}
	// ---------- owt ----------
	OWT struct {
		URL          string // owt api地址 例如: https://xx.xx.xx.xx:3000/v1
		ServiceID    string // owt的服务ID
		ServiceKey   string // owt的服务key (用户访问后台的api)
		RoomMaxCount int    // 房间最大参与人数
	}
	Register struct {
		Off           bool // 是否关闭注册
		OnlyChina     bool // 是否仅仅中国手机号可以注册
		StickerAddOff bool // 是否关闭注册添加表情
		UsernameOn    bool // 是否开启用户名注册
	}
	Organization struct {
		ImportOn bool // 是否开启导入组织信息
	}
	// ---------- push ----------
	Push struct {
		ContentDetailOn bool         //  推送是否显示正文详情(如果为false,则只显示“您有一条新的消息” 默认为true)
		PushPoolSize    int64        // 推送任务池大小
		APNS            APNSPush     // 苹果推送
		MI              MIPush       // 小米推送
		HMS             HMSPush      // 华为推送
		VIVO            VIVOPush     // vivo推送
		OPPO            OPPOPush     // oppo推送
		FIREBASE        FIREBASEPush // FIREBASE推送
	}
	// ---------- message ----------
	Message struct {
		SendMessageOn bool // 是否开启接口发送发送消息
	}
	// ---------- wechat ----------
	Wechat struct {
		AppID     string // 微信appid 在开放平台内
		AppSecret string
	}

	// ---------- tracing ----------
	Tracing struct {
		On   bool   // 是否开启tracing
		Addr string // tracer的地址
	}

	// ---------- support ----------
	Support struct {
		Email     string // 技术支持的邮箱地址
		EmailSmtp string // 技术支持的邮箱的smtp
		EmailPwd  string // 邮箱密码
	}

	Test bool // 是否是测试模式

	QRCodeInfoURL    string   // 获取二维码信息的URL
	VisitorUIDPrefix string   // 访客uid的前缀
	TimingWheelTick  duration // The time-round training interval must be 1ms or more
	TimingWheelSize  int64    // Time wheel size

	ElasticsearchURL string // elasticsearch 地址

	TablePartitionConfig TablePartitionConfig

	// ---------- 系统配置  由系统生成,无需用户配置 ----------
	AppRSAPrivateKey string
	AppRSAPubKey     string
	// contains filtered or unexported fields
}

Config 配置信息

func New

func New() *Config

New New

func (*Config) ComposeCustomerServiceChannelID

func (c *Config) ComposeCustomerServiceChannelID(vid string, channelID string) string

组合客服ID

func (*Config) ConfigFileUsed

func (c *Config) ConfigFileUsed() string

func (*Config) ConfigureWithViper

func (c *Config) ConfigureWithViper(vp *viper.Viper)

func (*Config) GetAvatarPath

func (c *Config) GetAvatarPath(uid string) string

GetAvatarPath 获取用户头像path

func (*Config) GetCommunityAvatarFilePath

func (c *Config) GetCommunityAvatarFilePath(communityNo string) string

GetCommunityAvatarFilePath 获取社区头像上传路径

func (*Config) GetCommunityCoverFilePath

func (c *Config) GetCommunityCoverFilePath(communityNo string) string

GetCommunityCoverFilePath 获取社区封面上传路径

func (*Config) GetCustomerServiceChannelID

func (c *Config) GetCustomerServiceChannelID(channelID string) (string, bool)

获取客服频道真实ID

func (*Config) GetCustomerServiceVisitorUID

func (c *Config) GetCustomerServiceVisitorUID(channelID string) (string, bool)

获取客服频道的访客id

func (*Config) GetGroupAvatarFilePath

func (c *Config) GetGroupAvatarFilePath(groupNo string) string

GetGroupAvatarFilePath 获取群头像上传路径

func (*Config) GetOrganizationLogoFilePath

func (c *Config) GetOrganizationLogoFilePath(orgId string) string

GetOrganizationLogoFilePath 获取组织logo上传路径

func (*Config) IsVisitor

func (c *Config) IsVisitor(uid string) bool

IsVisitor 是访客uid

func (*Config) IsVisitorChannel

func (c *Config) IsVisitorChannel(uid string) bool

IsVisitorChannel 是访客频道

type Context

type Context struct {
	log.Log
	EventPool      pool.Collector
	PushPool       pool.Collector // 离线push
	RobotEventPool pool.Collector // 机器人事件pool
	Event          wkevent.Event

	UserIDGen *snowflake.Node // 消息ID生成器

	SetupTask bool // 是否安装task
	// contains filtered or unexported fields
}

Context 配置上下文

func NewContext

func NewContext(cfg *Config) *Context

NewContext NewContext

func (*Context) AddEventListener

func (c *Context) AddEventListener(event string, listener EventListener)

AddEventListener 添加事件监听

func (*Context) AddMessagesListener

func (c *Context) AddMessagesListener(listener MessagesListener)

AddMessagesListener 添加消息监听者

func (*Context) AddOnlineStatusListener

func (c *Context) AddOnlineStatusListener(listener OnlineStatusListener)

AddOnlineStatusListener 添加在线状态监听

func (*Context) AsyncTask

func (c *Context) AsyncTask() *AsyncTask

AsyncTask 异步任务

func (*Context) AuthMiddleware

func (c *Context) AuthMiddleware(r *wkhttp.WKHttp) wkhttp.HandlerFunc

认证中间件

func (*Context) Cache

func (c *Context) Cache() cache.Cache

Cache 缓存

func (*Context) DB

func (c *Context) DB() (*gorm.DB, error)

DB DB

func (*Context) EventBegin

func (c *Context) EventBegin(data *wkevent.Data, tx *gorm.DB) (int64, error)

EventBegin 开启事件

func (*Context) EventCommit

func (c *Context) EventCommit(eventID int64)

EventCommit 提交事件

func (*Context) GenSeq

func (c *Context) GenSeq(flag string) (int64, error)

GenSeq 生产序号

func (*Context) GetAllOnlineStatusListeners

func (c *Context) GetAllOnlineStatusListeners() []OnlineStatusListener

GetAllOnlineStatusListeners 获取所有在线监听者

func (*Context) GetConfig

func (c *Context) GetConfig() *Config

GetConfig 获取配置信息

func (*Context) GetElasticsearch

func (c *Context) GetElasticsearch() *elastic.Client

GetElasticsearch 获取Elasticsearch客户端

func (*Context) GetEventListeners

func (c *Context) GetEventListeners(event string) []EventListener

GetEventListeners 获取某个事件

func (*Context) GetHttpRoute

func (c *Context) GetHttpRoute() *wkhttp.WKHttp

func (*Context) GetRedisConn

func (c *Context) GetRedisConn() *redis.Conn

GetRedisConn GetRedisConn

func (*Context) IMAddSubscriber

func (c *Context) IMAddSubscriber(req *SubscriberAddReq) error

IMAddSubscriber 请求IM创建频道

func (*Context) IMBlacklistAdd

func (c *Context) IMBlacklistAdd(req ChannelBlacklistReq) error

IMBlacklistAdd 添加黑名单

func (*Context) IMBlacklistRemove

func (c *Context) IMBlacklistRemove(req ChannelBlacklistReq) error

IMBlacklistRemove 移除黑名单

func (*Context) IMBlacklistSet

func (c *Context) IMBlacklistSet(req ChannelBlacklistReq) error

IMBlacklistSet 设置黑名单

func (*Context) IMClearConversationUnread

func (c *Context) IMClearConversationUnread(req ClearConversationUnreadReq) error

IMClearConversationUnread 清除用户某个频道的未读数

func (*Context) IMCreateOrUpdateChannel

func (c *Context) IMCreateOrUpdateChannel(req *ChannelCreateReq) error

IMCreateOrUpdateChannel 请求IM创建或更新频道

func (*Context) IMCreateOrUpdateChannelInfo

func (c *Context) IMCreateOrUpdateChannelInfo(req *ChannelInfoCreateReq) error

IMCreateOrUpdateChannelInfo 修改或创建channel信息

func (*Context) IMDeleteConversation

func (c *Context) IMDeleteConversation(req DeleteConversationReq) error

IMDeleteConversation 删除最近会话

func (*Context) IMGetConversations

func (c *Context) IMGetConversations(uid string) ([]*ConversationResp, error)

IMGetConversations 获取用户最近会话列表

func (*Context) IMRemoveSubscriber

func (c *Context) IMRemoveSubscriber(req *SubscriberRemoveReq) error

IMRemoveSubscriber 请求IM创建频道

func (*Context) IMRevokeMessage

func (c *Context) IMRevokeMessage(req *MessageRevokeReq) error

IMRevokeMessage 撤回IM消息

func (*Context) IMSOnlineStatus

func (c *Context) IMSOnlineStatus(uids []string) ([]*OnlinestatusResp, error)

IMSOnlineStatus 获取指定用户的在线状态

func (*Context) IMStreamEnd

func (c *Context) IMStreamEnd(req MessageStreamEndReq) error

func (*Context) IMStreamStart

func (c *Context) IMStreamStart(req MessageStreamStartReq) (string, error)

IMStreamStart 消息流开始 返回流编号

func (*Context) IMSyncChannelMessage

func (c *Context) IMSyncChannelMessage(req SyncChannelMessageReq) (*SyncChannelMessageResp, error)

IMSyncChannelMessage 同步频道消息

func (*Context) IMSyncMessage

func (c *Context) IMSyncMessage(req *MsgSyncReq) ([]*MessageResp, error)

IMSyncMessage 同步IM消息

func (*Context) IMSyncMessageAck

func (c *Context) IMSyncMessageAck(req *SyncackReq) error

IMSyncMessageAck 同步IM消息回执

func (*Context) IMSyncUserConversation

func (c *Context) IMSyncUserConversation(uid string, version int64, msgCount int64, lastMsgSeqs string, larges []*Channel) ([]*SyncUserConversationResp, error)

IMSyncUserConversation 同步用户会话数据

func (*Context) IMWhitelistAdd

func (c *Context) IMWhitelistAdd(req ChannelWhitelistReq) error

IMWhitelistAdd 添加白名单

func (*Context) IMWhitelistRemove

func (c *Context) IMWhitelistRemove(req ChannelWhitelistReq) error

IMWhitelistRemove 移除白名单

func (*Context) IMWhitelistSet

func (c *Context) IMWhitelistSet(req ChannelWhitelistReq) error

IMWhitelistSet 白名单设置(覆盖旧的数据)

func (*Context) NewMemoryCache

func (c *Context) NewMemoryCache() cache.Cache

NewMemoryCache 创建一个内存缓存

func (*Context) NewMySQL

func (c *Context) NewMySQL() (*gorm.DB, error)

NewMySQL 创建mysql数据库实例

func (*Context) NewRedisCache

func (c *Context) NewRedisCache() *common.RedisCache

NewRedisCache 创建一个redis缓存

func (*Context) NotifyMessagesListeners

func (c *Context) NotifyMessagesListeners(messages []*MessageResp)

NotifyMessagesListeners 通知消息监听者

func (*Context) QuitUserDevice

func (c *Context) QuitUserDevice(uid string, deviceFlag int) error

退出用户指定的设备 deviceFlag -1 表示退出用户所有的设备

func (*Context) Schedule

func (c *Context) Schedule(interval time.Duration, f func()) *timingwheel.Timer

Schedule 延迟任务

func (*Context) SendCMD

func (c *Context) SendCMD(req MsgCMDReq) error

SendCMD 发送CMD消息

func (*Context) SendChannelUpdate

func (c *Context) SendChannelUpdate(channel ChannelReq, updateChannel ChannelReq) error

SendChannelUpdate 发送频道更新命令

func (*Context) SendChannelUpdateToGroup

func (c *Context) SendChannelUpdateToGroup(groupNo string) error

func (*Context) SendChannelUpdateToUser

func (c *Context) SendChannelUpdateToUser(uid string, channel ChannelReq) error

func (*Context) SendChannelUpdateWithFromUID

func (c *Context) SendChannelUpdateWithFromUID(channel ChannelReq, updateChannel ChannelReq, fromUID string) error

func (*Context) SendFriendApply

func (c *Context) SendFriendApply(req *MsgFriendApplyReq) error

SendFriendApply 发送好友申请请求

func (*Context) SendFriendDelete

func (c *Context) SendFriendDelete(req *MsgFriendDeleteReq) error

func (*Context) SendFriendSure

func (c *Context) SendFriendSure(req *MsgFriendSureReq) error

SendFriendSure 发送好友确认请求

func (*Context) SendGroupCreate

func (c *Context) SendGroupCreate(req *MsgGroupCreateReq) error

SendGroupCreate 发送群创建的消息

func (*Context) SendGroupExit

func (c *Context) SendGroupExit(groupNo string, uid string, name string) error

发送某个用户退出群聊的消息

func (*Context) SendGroupMemberAdd

func (c *Context) SendGroupMemberAdd(req *MsgGroupMemberAddReq) error

SendGroupMemberAdd 发送群成员添加消息

func (*Context) SendGroupMemberBeRemove

func (c *Context) SendGroupMemberBeRemove(req *MsgGroupMemberRemoveReq) error

SendGroupMemberBeRemove 发送群成员被移除的消息(发送给被踢的群成员)

func (*Context) SendGroupMemberInviteReq

func (c *Context) SendGroupMemberInviteReq(req MsgGroupMemberInviteReq) error

SendGroupMemberInviteReq 群主转让

func (*Context) SendGroupMemberRemove

func (c *Context) SendGroupMemberRemove(req *MsgGroupMemberRemoveReq) error

SendGroupMemberRemove 发送群成员移除消息

func (*Context) SendGroupMemberScanJoin

func (c *Context) SendGroupMemberScanJoin(req MsgGroupMemberScanJoin) error

SendGroupMemberScanJoin 发送群成员扫码加入消息

func (*Context) SendGroupMemberUpdate

func (c *Context) SendGroupMemberUpdate(groupNo string) error

func (*Context) SendGroupTransferGrouper

func (c *Context) SendGroupTransferGrouper(req MsgGroupTransferGrouper) error

SendGroupTransferGrouper 群主转让

func (*Context) SendGroupUpdate

func (c *Context) SendGroupUpdate(req *MsgGroupUpdateReq) error

SendGroupUpdate 发送群更新消息

func (*Context) SendGroupUpgrade

func (c *Context) SendGroupUpgrade(groupNo string) error

群升级通知

func (*Context) SendMessage

func (c *Context) SendMessage(req *MsgSendReq) error

SendMessage 发送消息

func (*Context) SendMessageBatch

func (c *Context) SendMessageBatch(req *MsgSendBatch) error

SendMessageBatch 给一批用户发送消息

func (*Context) SendMessageWithResult

func (c *Context) SendMessageWithResult(req *MsgSendReq) (*MsgSendResp, error)

SendMessage 发送消息

func (*Context) SendRTCCallResult

func (c *Context) SendRTCCallResult(req P2pRtcMessageReq) error

rtc 挂断

func (*Context) SendRevoke

func (c *Context) SendRevoke(req *MsgRevokeReq) error

SendRevoke 发送撤回消息

func (*Context) SendTyping

func (c *Context) SendTyping(channelID string, channelType uint8, fromUID string) error

func (*Context) SendUnableAddDestoryAccountInGroup

func (c *Context) SendUnableAddDestoryAccountInGroup(req *MsgGroupCreateReq) error

SendGroupUnableAddDestoryAccount 发送无法添加注销账号到群聊

func (*Context) SetHttpRoute

func (c *Context) SetHttpRoute(r *wkhttp.WKHttp)

func (*Context) SetValue

func (c *Context) SetValue(value interface{}, key string)

func (*Context) Tracer

func (c *Context) Tracer() *Tracer

Tracer Tracer

func (*Context) UpdateIMToken

func (c *Context) UpdateIMToken(req UpdateIMTokenReq) (*UpdateIMTokenResp, error)

UpdateIMToken 更新IM的token

func (*Context) Value

func (c *Context) Value(key string) any

type ConversationResp

type ConversationResp struct {
	ChannelID   string       `json:"channel_id"`   // 频道ID
	ChannelType uint8        `json:"channel_type"` // 频道类型
	Unread      int64        `json:"unread"`       // 未读数
	Timestamp   int64        `json:"timestamp"`    // 最后一次会话时间戳
	LastMessage *MessageResp `json:"last_message"` // 最后一条消息
}

ConversationResp 最近会话返回数据

type DeleteConversationReq

type DeleteConversationReq struct {
	UID         string `json:"uid"`
	ChannelID   string `json:"channel_id"`   // 频道ID
	ChannelType uint8  `json:"channel_type"` // 频道类型
}

DeleteConversationReq DeleteConversationReq

type DeviceFlag

type DeviceFlag uint8

DeviceFlag 设备类型

const (
	// APP APP
	APP DeviceFlag = iota
	// Web Web
	Web
	// PC在线
	PC
)

func (DeviceFlag) Uint8

func (d DeviceFlag) Uint8() uint8

type DeviceLevel

type DeviceLevel uint8

DeviceLevel 设备等级

const (
	// DeviceLevelSlave 从设备
	DeviceLevelSlave DeviceLevel = 0
	// DeviceLevelMaster 主设备
	DeviceLevelMaster DeviceLevel = 1
)

type EmptySpan

type EmptySpan struct {
}

EmptySpan 空的span

func (*EmptySpan) BaggageItem

func (e *EmptySpan) BaggageItem(restrictedKey string) string

BaggageItem BaggageItem

func (*EmptySpan) Context

func (e *EmptySpan) Context() opentracing.SpanContext

Context Context

func (*EmptySpan) Finish

func (e *EmptySpan) Finish()

Finish Finish

func (*EmptySpan) FinishWithOptions

func (e *EmptySpan) FinishWithOptions(opts opentracing.FinishOptions)

FinishWithOptions FinishWithOptions

func (*EmptySpan) Log

func (e *EmptySpan) Log(data opentracing.LogData)

Log Log

func (*EmptySpan) LogEvent

func (e *EmptySpan) LogEvent(event string)

LogEvent LogEvent

func (*EmptySpan) LogEventWithPayload

func (e *EmptySpan) LogEventWithPayload(event string, payload interface{})

LogEventWithPayload LogEventWithPayload

func (*EmptySpan) LogFields

func (e *EmptySpan) LogFields(fields ...log.Field)

LogFields LogFields

func (*EmptySpan) LogKV

func (e *EmptySpan) LogKV(alternatingKeyValues ...interface{})

LogKV LogKV

func (*EmptySpan) SetBaggageItem

func (e *EmptySpan) SetBaggageItem(restrictedKey, value string) opentracing.Span

SetBaggageItem SetBaggageItem

func (*EmptySpan) SetOperationName

func (e *EmptySpan) SetOperationName(operationName string) opentracing.Span

SetOperationName SetOperationName

func (*EmptySpan) SetTag

func (e *EmptySpan) SetTag(key string, value interface{}) opentracing.Span

SetTag SetTag

func (*EmptySpan) Tracer

func (e *EmptySpan) Tracer() opentracing.Tracer

Tracer Tracer

type EmptySpanContext

type EmptySpanContext struct {
}

EmptySpanContext EmptySpanContext

func (*EmptySpanContext) ForeachBaggageItem

func (e *EmptySpanContext) ForeachBaggageItem(handler func(k, v string) bool)

ForeachBaggageItem ForeachBaggageItem

type EventCommit

type EventCommit func(err error)

EventCommit 事件提交

type EventListener

type EventListener func(data []byte, commit EventCommit)

EventListener EventListener

type FIREBASEPush

type FIREBASEPush struct {
	PackageName string
	JsonPath    string // firebase推送需要的json的路径
	ProjectId   string // serviceAccountJson中的project_id值
}

type FileService

type FileService string

FileService FileService

const (
	// FileServiceAliyunOSS 阿里云oss上传服务
	FileServiceAliyunOSS FileService = "aliyunOSS"
	// FileServiceSeaweedFS seaweedfs(https://github.com/chrislusf/seaweedfs)
	FileServiceSeaweedFS FileService = "seaweedFS"
	// FileServiceMinio minio
	FileServiceMinio FileService = "minio"
)

func (FileService) String

func (u FileService) String() string

type HMSPush

type HMSPush struct {
	PackageName string
	AppID       string
	AppSecret   string
}

华为推送

type MIPush

type MIPush struct {
	PackageName string
	AppID       string
	AppSecret   string
	ChannelID   string
}

小米推送

type MessageDeleteReq

type MessageDeleteReq struct {
	UID         string   `json:"uid"`          // 频道ID
	ChannelID   string   `json:"channel_id"`   // 频道ID
	ChannelType uint8    `json:"channel_type"` // 频道类型
	MessageIDs  []uint64 `json:"message_ids"`  // 消息ID集合 (如果all=1 则此字段无效)
}

MessageDeleteReq 删除消息请求

type MessageResp

type MessageResp struct {
	Header      MsgHeader         `json:"header"`              // 消息头
	Setting     uint8             `json:"setting"`             // 设置
	MessageID   int64             `json:"message_id"`          // 服务端的消息ID(全局唯一)
	MessageSeq  uint32            `json:"message_seq"`         // 消息序列号 (用户唯一,有序递增)
	ClientMsgNo string            `json:"client_msg_no"`       // 客户端消息唯一编号
	Expire      uint32            `json:"expire"`              // 消息过期时间
	FromUID     string            `json:"from_uid"`            // 发送者UID
	ToUID       string            `json:"to_uid"`              // 接受者uid
	ChannelID   string            `json:"channel_id"`          // 频道ID
	ChannelType uint8             `json:"channel_type"`        // 频道类型
	Timestamp   int32             `json:"timestamp"`           // 服务器消息时间戳(10位,到秒)
	Payload     []byte            `json:"payload"`             // 消息内容
	StreamNo    string            `json:"stream_no,omitempty"` // 流编号
	Streams     []*StreamItemResp `json:"streams,omitempty"`   // 消息流
	// ReplyCount    int            `json:"reply_count,omitempty"`     // 回复集合
	// ReplyCountSeq string         `json:"reply_count_seq,omitempty"` // 回复数量seq
	// ReplySeq      string         `json:"reply_seq,omitempty"`       // 回复seq
	// Reactions     []ReactionResp `json:"reactions,omitempty"`       // 回应数据
	IsDeleted   int `json:"is_deleted"`   // 是否已删除
	VoiceStatus int `json:"voice_status"` // 语音状态 0.未读 1.已读
	// contains filtered or unexported fields
}

MessageResp 消息

func (*MessageResp) GetContentType

func (m *MessageResp) GetContentType() int

GetContentType 消息正文类型

func (*MessageResp) GetPayloadMap

func (m *MessageResp) GetPayloadMap() (map[string]interface{}, error)

GetPayloadMap GetPayloadMap

type MessageRevokeReq

type MessageRevokeReq struct {
	ChannelID   string   `json:"channel_id"`   // 频道ID
	ChannelType uint8    `json:"channel_type"` // 频道类型
	MessageIDs  []uint64 `json:"message_ids"`  // 指定需要撤回的消息
}

MessageRevokeReq 消息撤回请求

type MessageStreamEndReq

type MessageStreamEndReq struct {
	StreamNo    string `json:"stream_no"`    // 消息流编号
	ChannelID   string `json:"channel_id"`   // 频道ID
	ChannelType uint8  `json:"channel_type"` // 频道类型
}

type MessageStreamStartReq

type MessageStreamStartReq struct {
	Header      MsgHeader `json:"header"`        // 消息头
	ClientMsgNo string    `json:"client_msg_no"` // 客户端消息编号(相同编号,客户端只会显示一条)
	FromUID     string    `json:"from_uid"`      // 发送者UID
	ChannelID   string    `json:"channel_id"`    // 频道ID
	ChannelType uint8     `json:"channel_type"`  // 频道类型
	Payload     []byte    `json:"payload"`       // 消息内容
}

type MessagesListener

type MessagesListener func(messages []*MessageResp)

MessagesListener 消息监听者

type MinioConfig

type MinioConfig struct {
	URL             string // 文件下载上传或下载基地址 例如: http://127.0.0.1:9000
	UploadURL       string // 文件上传基地址 如果为空则使用URL地址
	DownloadURL     string // 文件下载基地址 如果为空则使用URL地址
	AccessKeyID     string //minio accessKeyID
	SecretAccessKey string //minio secretAccessKey
}

type Mode

type Mode string
const (
	//debug 模式
	DebugMode Mode = "debug"
	// 正式模式
	ReleaseMode Mode = "release"
	// 压力测试模式
	BenchMode Mode = "bench"
)

type MsgCMDReq

type MsgCMDReq struct {
	NoPersist   bool                   `json:"-"`            // 是否需要存储
	FromUID     string                 `json:"from_uid"`     // 模拟发送者的UID
	ChannelID   string                 `json:"channel_id"`   // 频道ID
	ChannelType uint8                  `json:"channel_type"` // 频道类型
	Subscribers []string               `json:"subscribers"`  // 订阅者 如果此字段有值,表示消息只发给指定的订阅者
	CMD         string                 `json:"cmd"`          // 操命令
	Param       map[string]interface{} `json:"param"`        // 命令参数
}

MsgCMDReq CMD消息请求

type MsgFriendApplyReq

type MsgFriendApplyReq struct {
	ApplyUID  string `json:"apply_uid"`  // 发起申请人的uid
	ApplyName string `json:"apply_name"` // 发起申请人的名字
	ToUID     string `json:"to_uid"`     // 接收者
	Remark    string `json:"remark"`     // 申请备注
	Token     string `json:"token"`      // 凭证
}

MsgFriendApplyReq 好友申请

type MsgFriendDeleteReq

type MsgFriendDeleteReq struct {
	FromUID string `json:"from_uid"` // 删除人的uid
	ToUID   string `json:"to_uid"`   // 被删除的好友uid
}

MsgFriendDeleteReq 好友删除

type MsgFriendSureReq

type MsgFriendSureReq struct {
	ToUID    string `json:"to_uid"`    // 接收好友申请的人uid
	FromUID  string `json:"from_uid"`  // 发起申请人的uid
	FromName string `json:"from_name"` // 发起申请人的名字
}

MsgFriendSureReq 确认好友申请

type MsgGroupCreateReq

type MsgGroupCreateReq struct {
	Creator     string        `json:"creator"`      // 创建者
	CreatorName string        `json:"creator_name"` // 创建者名称
	GroupNo     string        `json:"group_no"`
	Version     int64         `json:"version"` // 数据版本
	Members     []*UserBaseVo `json:"members"`
}

MsgGroupCreateReq 创建群请求

type MsgGroupMemberAddReq

type MsgGroupMemberAddReq struct {
	Operator     string        `json:"operator"`      // 操作者uid
	OperatorName string        `json:"operator_name"` // 操作者名称
	GroupNo      string        `json:"group_no"`      // 群编号
	Members      []*UserBaseVo `json:"members"`       // 邀请成员
}

MsgGroupMemberAddReq 添加群成员

type MsgGroupMemberInviteReq

type MsgGroupMemberInviteReq struct {
	GroupNo     string   `json:"group_no"`     // 群编号
	InviteNo    string   `json:"invite_no"`    // 邀请编号
	Inviter     string   `json:"inviter"`      // 邀请者
	InviterName string   `json:"inviter_name"` // 邀请者名称
	Num         int      `json:"num"`          // 邀请成员数量
	Subscribers []string `json:"subscribers"`  // 消息订阅者
}

MsgGroupMemberInviteReq 群成员邀请请求

type MsgGroupMemberRemoveReq

type MsgGroupMemberRemoveReq struct {
	Operator     string        `json:"operator"`      // 操作者uid
	OperatorName string        `json:"operator_name"` // 操作者名称
	GroupNo      string        `json:"group_no"`      // 群编号
	Members      []*UserBaseVo `json:"members"`       // 邀请成员
}

MsgGroupMemberRemoveReq 移除群成员

type MsgGroupMemberScanJoin

type MsgGroupMemberScanJoin struct {
	GroupNo       string `json:"group_no"`       // 群编号
	Generator     string `json:"generator"`      // 二维码生成者uid
	GeneratorName string `json:"generator_name"` // 二维码生成者名称
	Scaner        string `json:"scaner"`         // 扫码者uid
	ScanerName    string `json:"scaner_name"`    // 扫码者名称
}

MsgGroupMemberScanJoin 用户扫码加入群成员

type MsgGroupTransferGrouper

type MsgGroupTransferGrouper struct {
	GroupNo        string `json:"group_no"`
	OldGrouper     string `json:"old_grouper"`      // 老群主
	OldGrouperName string `json:"old_grouper_name"` // 老群主名称
	NewGrouper     string `json:"new_grouper"`      // 新群主
	NewGrouperName string `json:"new_grouper_name"` // 新群主名称
}

MsgGroupTransferGrouper 群主转让

type MsgGroupUpdateReq

type MsgGroupUpdateReq struct {
	GroupNo      string            `json:"group_no"`      // 群编号
	Operator     string            `json:"operator"`      // 操作者uid
	OperatorName string            `json:"operator_name"` // 操作者名称
	Attr         string            `json:"attr"`          // 修改群的属性
	Data         map[string]string `json:"data"`          // 数据
}

MsgGroupUpdateReq 群更新请求

type MsgHeader

type MsgHeader struct {
	NoPersist int `json:"no_persist"` // 是否不持久化
	RedDot    int `json:"red_dot"`    // 是否显示红点
	SyncOnce  int `json:"sync_once"`  // 此消息只被同步或被消费一次(1表示消息将走写模式) ,特别注意:sync_once=1表示写扩散 sync_once=0表示读扩散 写扩散的messageSeq和读扩散messageSeq来源不一样
}

MsgHeader 消息头

func (MsgHeader) String

func (h MsgHeader) String() string

type MsgOrgOrDeptCreateReq

type MsgOrgOrDeptCreateReq struct {
	GroupNo       string                 `json:"group_no"`       // 组织或部门ID
	GroupCategory string                 `json:"group_category"` // 群分类
	Name          string                 `json:"name"`           // 组织或部门名称
	Operator      string                 `json:"operator"`       // 操作者uid
	OperatorName  string                 `json:"operator_name"`  // 操作者名称
	Members       []*OrgOrDeptEmployeeVO `json:"members"`        // 成员
}

MsgOrgOrDeptCreateReq 组织或部门创建

type MsgOrgOrDeptEmployeeAddReq

type MsgOrgOrDeptEmployeeAddReq struct {
	GroupNo string        `json:"group_no"` // 组织或部门ID
	Name    string        `json:"name"`     // 组织或部门名称
	Members []*UserBaseVo `json:"members"`
}

MsgOrgOrDeptEmployeeAddReq 组织或部门新增群成员消息

type MsgOrgOrDeptEmployeeUpdateReq

type MsgOrgOrDeptEmployeeUpdateReq struct {
	Members []*OrgOrDeptEmployeeVO `json:"members"`
}

type MsgRevokeReq

type MsgRevokeReq struct {
	FromUID      string `json:"from_uid"`
	Operator     string `json:"operator"`      // 操作者uid
	OperatorName string `json:"operator_name"` // 操作者名称
	ChannelID    string `json:"channel_id"`    // 频道ID
	ChannelType  uint8  `json:"channel_type"`  // 频道类型
	MessageID    int64  `json:"message_id"`    // 消息ID
}

MsgRevokeReq 撤回消息请求

type MsgSendBatch

type MsgSendBatch struct {
	Header      MsgHeader `json:"header"`      // 消息头
	FromUID     string    `json:"from_uid"`    // 模拟发送者的UID
	Subscribers []string  `json:"subscribers"` // 订阅者 如果此字段有值,表示消息只发给指定的订阅者
	Payload     []byte    `json:"payload"`     // 消息内容
}

MsgSendBatch 给一批用户发送消息请求

type MsgSendReq

type MsgSendReq struct {
	Header      MsgHeader `json:"header"`       // 消息头
	Setting     uint8     `json:"setting"`      // setting
	FromUID     string    `json:"from_uid"`     // 模拟发送者的UID
	ChannelID   string    `json:"channel_id"`   // 频道ID
	ChannelType uint8     `json:"channel_type"` // 频道类型
	StreamNo    string    `json:"stream_no"`    // 消息流号
	Subscribers []string  `json:"subscribers"`  // 订阅者 如果此字段有值,表示消息只发给指定的订阅者
	Payload     []byte    `json:"payload"`      // 消息内容
}

MsgSendReq 发送消息请求

func (*MsgSendReq) String

func (m *MsgSendReq) String() string

type MsgSendResp

type MsgSendResp struct {
	MessageID   int64  `json:"message_id"`    // 消息ID
	ClientMsgNo string `json:"client_msg_no"` // 客户端消息唯一编号
	MessageSeq  uint32 `json:"message_seq"`   // 消息序号
}

type MsgSyncReq

type MsgSyncReq struct {
	UID        string `json:"uid"`         // 谁的消息
	MessageSeq uint32 `json:"message_seq"` // 客户端最大消息序列号
	Limit      int    `json:"limit"`       // 消息数量限制
}

MsgSyncReq 消息同步请求

type OPPOPush

type OPPOPush struct {
	PackageName  string
	AppID        string
	AppKey       string
	AppSecret    string
	MasterSecret string
}

oppo推送

type OSSConfig

type OSSConfig struct {
	Endpoint        string
	BucketName      string // Bucket名称 比如 tangsengdaodao
	BucketURL       string // 文件下载地址域名 对应aliyun的Bucket域名
	AccessKeyID     string
	AccessKeySecret string
}

aliyun oss

type OnlineStatus

type OnlineStatus struct {
	UID              string // 用户uid
	DeviceFlag       uint8  // 设备标记
	Online           bool   // 是否在线
	SocketID         int64  // 当前设备在wukongim中的在线/离线的socketID
	OnlineCount      int    //在线数量 当前DeviceFlag下的在线设备数量
	TotalOnlineCount int    // 当前用户所有在线设备数量
}

OnlineStatus 在线状态

type OnlineStatusListener

type OnlineStatusListener func(onlineStatusList []OnlineStatus)

OnlineStatusListener 在线状态监听

type OnlinestatusResp

type OnlinestatusResp struct {
	UID         string `json:"uid"`          // 在线用户uid
	DeviceFlag  uint8  `json:"device_flag"`  // 设备标记 0. APP 1.web
	LastOffline int    `json:"last_offline"` // 最后一次离线时间
	Online      int    `json:"online"`       // 是否在线
}

OnlinestatusResp 在线状态返回

type OrgEmployeeExitReq

type OrgEmployeeExitReq struct {
	Operator string   `json:"operator"`  // 操作者uid
	GroupNos []string `json:"group_nos"` // 退出的群列表
}

OrgEmployeeExitReq 组织内成员退出

type OrgOrDeptEmployeeVO

type OrgOrDeptEmployeeVO struct {
	Operator     string `json:"operator"`      // 操作者uid
	OperatorName string `json:"operator_name"` // 操作者名称
	EmployeeUid  string `json:"employee_uid"`  // 员工uid
	EmployeeName string `json:"employee_name"` // 员工名称
	GroupNo      string `json:"group_no"`      // 组织或部门ID
	Action       string `json:"action"`        // 操作类型 'add'|'delete'
}

OrgOrDeptEmployeeVO 组织或部门成员更新

type P2pRtcMessageReq

type P2pRtcMessageReq struct {
	FromUID    string
	ToUID      string
	CallType   common.RTCCallType
	ResultType common.RTCResultType
	Second     int
}

type PullMode

type PullMode int
const (
	PullModeDown PullMode = iota
	PullModeUp
)

type ReactionResp

type ReactionResp struct {
	Seq   string     `json:"seq"`   // 回复序列号
	Users []UserResp `json:"users"` // 回应用户集合
	Emoji string     `json:"emoji"` // 回应的emoji
	Count int        `json:"count"` // 回应数量
}

ReactionResp 回应返回

type SMSProvider

type SMSProvider string

SMSProvider 短信供应者

const (
	// SMSProviderAliyun aliyun
	SMSProviderAliyun SMSProvider = "aliyun"
	SMSProviderUnisms SMSProvider = "unisms" // 联合短信(https://unisms.apistd.com/docs/api/send/)
)

type SeaweedConfig

type SeaweedConfig struct {
	URL string // 文件下载上传基地址
}

type Seq

type Seq struct {
	CurSeq int64
	MaxSeq int64
}

Seq Seq

type Setting

type Setting struct {
	Receipt              bool // 消息已读回执,此标记表示,此消息需要已读回执
	NoUpdateConversation bool // 不更新最近会话
	Signal               bool // 是否signal加密
}

Setting Setting

func SettingFromUint8

func SettingFromUint8(v uint8) Setting

SettingFromUint8 SettingFromUint8

func (Setting) ToUint8

func (s Setting) ToUint8() uint8

ToUint8 ToUint8

type StreamItemResp

type StreamItemResp struct {
	StreamSeq   uint32 `json:"stream_seq"`    // 流序号
	ClientMsgNo string `json:"client_msg_no"` // 客户端消息唯一编号
	Blob        []byte `json:"blob"`          // 消息内容
}

type SubscriberAddReq

type SubscriberAddReq struct {
	ChannelID   string   `json:"channel_id"`
	ChannelType uint8    `json:"channel_type"`
	Reset       int      `json:"reset"` // 是否重置订阅者 (0.不重置 1.重置),选择重置,将删除原来的所有成员
	Subscribers []string `json:"subscribers"`
}

SubscriberAddReq 添加订阅请求

type SubscriberRemoveReq

type SubscriberRemoveReq struct {
	ChannelID   string   `json:"channel_id"`
	ChannelType uint8    `json:"channel_type"`
	Subscribers []string `json:"subscribers"`
}

SubscriberRemoveReq 移除订阅请求

type SyncChannelMessageReq

type SyncChannelMessageReq struct {
	LoginUID        string   `json:"login_uid"`
	DeviceUUID      string   `json:"device_uuid"`
	ChannelID       string   `json:"channel_id"`
	ChannelType     uint8    `json:"channel_type"`
	StartMessageSeq uint32   `json:"start_message_seq"` // 开始序列号
	EndMessageSeq   uint32   `json:"end_message_seq"`   // 结束序列号
	Limit           int      `json:"limit"`             // 每次同步数量限制
	PullMode        PullMode `json:"pull_mode"`         // 拉取模式
}

SyncChannelMessageReq 同步频道消息请求

type SyncChannelMessageResp

type SyncChannelMessageResp struct {
	StartMessageSeq uint32         `json:"start_message_seq"` // 开始序列号
	EndMessageSeq   uint32         `json:"end_message_seq"`   // 结束序列号
	PullMode        PullMode       `json:"pull_mode"`         // 拉取模式
	Messages        []*MessageResp `json:"messages"`          // 消息数据
}

SyncChannelMessageResp 同步频道消息返回

type SyncUserConversationResp

type SyncUserConversationResp struct {
	ChannelID       string         `json:"channel_id"`         // 频道ID
	ChannelType     uint8          `json:"channel_type"`       // 频道类型
	Unread          int            `json:"unread"`             // 未读消息
	Timestamp       int64          `json:"timestamp"`          // 最后一次会话时间
	LastMsgSeq      int64          `json:"last_msg_seq"`       // 最后一条消息seq
	LastClientMsgNo string         `json:"last_client_msg_no"` // 最后一条客户端消息编号
	OffsetMsgSeq    int64          `json:"offset_msg_seq"`     // 偏移位的消息seq
	Version         int64          `json:"version"`            // 数据版本
	Recents         []*MessageResp `json:"recents"`            // 最近N条消息
}

SyncUserConversationResp 最近会话离线返回

type SyncUserConversationRespWrap

type SyncUserConversationRespWrap struct {
	Conversations []*SyncUserConversationResp `json:"conversations"`
	CMDVersion    int64                       `json:"cmd_version"` // 最新cmd版本号
	CMDs          []*CMDResp                  `json:"cmds"`        // cmd集合
}

SyncUserConversationRespWrap SyncUserConversationRespWrap

type SyncackReq

type SyncackReq struct {
	// 用户uid
	UID string `json:"uid"`
	// 最后一次同步的message_seq
	LastMessageSeq uint32 `json:"last_message_seq"`
}

SyncackReq 同步回执请求

func (SyncackReq) Check

func (s SyncackReq) Check() error

Check 检查参数输入

func (SyncackReq) String

func (s SyncackReq) String() string

type TablePartitionConfig

type TablePartitionConfig struct {
	MessageTableCount         int // 消息表数量
	MessageUserEditTableCount int // 用户消息编辑表
	ChannelOffsetTableCount   int // 频道偏移表
}

type Tracer

type Tracer struct {
	llog.Log
	// contains filtered or unexported fields
}

Tracer唐僧叨叨Tracer

func NewTracer

func NewTracer(cfg *Config) (*Tracer, error)

NewTracer NewTracer

func (*Tracer) Close

func (t *Tracer) Close() error

Close 关闭

func (*Tracer) ContextWithSpan

func (t *Tracer) ContextWithSpan(ctx context.Context, span opentracing.Span) context.Context

ContextWithSpan ContextWithSpan

func (*Tracer) Extract

func (t *Tracer) Extract(format interface{}, carrier interface{}) (opentracing.SpanContext, error)

Extract Extract

func (*Tracer) ExtractHTTPHeader

func (t *Tracer) ExtractHTTPHeader(header http.Header) (opentracing.SpanContext, error)

ExtractHTTPHeader ExtractHTTPHeader

func (*Tracer) GinMiddle

func (t *Tracer) GinMiddle() gin.HandlerFunc

GinMiddle gin的中间件

func (*Tracer) Inject

func (t *Tracer) Inject(sm opentracing.SpanContext, format interface{}, carrier interface{}) error

Inject Inject

func (*Tracer) InjectHTTPHeader

func (t *Tracer) InjectHTTPHeader(sm opentracing.SpanContext, header http.Header) error

InjectHTTPHeader InjectHTTPHeader

func (*Tracer) StartSpan

func (t *Tracer) StartSpan(operationName string, opts ...opentracing.StartSpanOption) opentracing.Span

StartSpan StartSpan

func (*Tracer) StartSpanFromContext

func (t *Tracer) StartSpanFromContext(ctx context.Context, operationName string, opts ...opentracing.StartSpanOption) (opentracing.Span, context.Context)

StartSpanFromContext StartSpanFromContext

type UnismsConfig

type UnismsConfig struct {
	Signature       string
	AccessKeyID     string
	AccessKeySecret string
	TemplateId      string
}

UnismsConfig unisms短信

type UpdateIMTokenReq

type UpdateIMTokenReq struct {
	UID         string
	Token       string
	DeviceFlag  DeviceFlag
	DeviceLevel DeviceLevel
}

UpdateIMTokenReq 更新IM token的请求

type UpdateIMTokenResp

type UpdateIMTokenResp struct {
	Status UpdateTokenStatus `json:"status"` // 状态
}

UpdateIMTokenResp 更新IM Token的返回参数

type UpdateTokenStatus

type UpdateTokenStatus int
const (
	UpdateTokenStatusSuccess UpdateTokenStatus = 200
	UpdateTokenStatusBan     UpdateTokenStatus = 19
)

type UserBaseVo

type UserBaseVo struct {
	UID  string `json:"uid"`
	Name string `json:"name"`
}

UserBaseVo 用户基础信息

type UserResp

type UserResp struct {
	UID  string `json:"uid"`
	Name string `json:"name"`
}

UserResp UserResp

type VIVOPush

type VIVOPush struct {
	PackageName string
	AppID       string
	AppKey      string
	AppSecret   string
}

Jump to

Keyboard shortcuts

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