Documentation ¶
Index ¶
- func InitDb(driver string, dsn string) (*gorm.DB, error)
- func InitFailoverRedis(masterName string, sentinelAddrs []string, password string, ...) (*redis.Client, error)
- func InitRedis(addr string, pass string) (*redis.Client, error)
- func KeyMessageAckIndex(account string) string
- type Group
- type GroupMember
- type IDGenerator
- type MessageContent
- type MessageIndex
- type Model
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitFailoverRedis ¶
func InitFailoverRedis(masterName string, sentinelAddrs []string, password string, timeout time.Duration) (*redis.Client, error)
InitFailoverRedis init redis with sentinels
func KeyMessageAckIndex ¶
KeyMessageAckIndex return a redis key of the read index
Types ¶
type GroupMember ¶
type GroupMember struct { Model Account string `gorm:"uniqueIndex:uni_gp_acc;size:60"` Group string `gorm:"uniqueIndex:uni_gp_acc;index;size:30"` Alias string `gorm:"size:30"` }
GroupMember GroupMember
type IDGenerator ¶
type IDGenerator struct {
// contains filtered or unexported fields
}
IDGenerator generate unique id
func NewIDGenerator ¶
func NewIDGenerator(nodeID int64) (*IDGenerator, error)
NewIDGenerator NewIDGenerator
func (*IDGenerator) ParseBase36 ¶
func (g *IDGenerator) ParseBase36(id string) (snowflake.ID, error)
ParseBase36 ParseBase36
type MessageContent ¶
type MessageIndex ¶
type MessageIndex struct { ID int64 `gorm:"primarykey"` AccountA string `gorm:"index;size:60;not null;comment:队列唯一标识"` AccountB string `gorm:"size:60;not null;comment:另一方"` Direction byte `gorm:"default:0;not null;comment:1表示AccountA为发送者"` MessageID int64 `gorm:"not null;comment:关联消息内容表中的ID"` Group string `gorm:"size:30;comment:群ID,单聊情况为空"` SendTime int64 `gorm:"index;not null;comment:消息发送时间"` }
Click to show internal directories.
Click to hide internal directories.