model

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	ID         uint64    `gorm:"column:id" json:"id"`
	NickName   string    `gorm:"column:nickname" json:"nickname"`
	Status     int       `gorm:"column:status" json:"status"`
	Broker     string    `gorm:"column:broker" json:"broker"`
	Token      string    `gorm:"column:token" json:"token"`
	CreatedAt  time.Time `gorm:"column:created_at" json:"-"`
	ModifiedAt time.Time `gorm:"column:modified_at" json:"-"`
}

func (Account) TableName

func (Account) TableName() string

type BaseRespCmd

type BaseRespCmd struct {
	Cmd  string `json:"cmd"`
	Code int32  `json:"code"`
}

type BizHub

type BizHub struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

melody.Session keys 是一个Map,多线程处理有并发问题

func NewBizHub

func NewBizHub() *BizHub

func (*BizHub) GetAllClient

func (h *BizHub) GetAllClient() []*Client

func (*BizHub) GetSession

func (h *BizHub) GetSession(accountId uint64) (*melody.Session, bool)

func (*BizHub) RemoveClient

func (h *BizHub) RemoveClient(accountId uint64)

func (*BizHub) SetClient

func (h *BizHub) SetClient(nickName string, accountId uint64, session *melody.Session)

func (*BizHub) SetLastPong

func (h *BizHub) SetLastPong(accountId uint64, t time.Time)

type BrokerHub

type BrokerHub struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

melody.Session keys 是一个Map,多线程处理有并发问题

func NewBrokerHub

func NewBrokerHub() *BrokerHub

func (*BrokerHub) GetBroker

func (h *BrokerHub) GetBroker(brokerAddr string) (pb.BrokerClient, bool)

func (*BrokerHub) SetBroker

func (h *BrokerHub) SetBroker(brokerAddr string, client pb.BrokerClient)

func (*BrokerHub) Size

func (h *BrokerHub) Size() int

type Client

type Client struct {
	Session *melody.Session `json:"-"`

	NickName  string    `json:"nickName"`
	AccountId uint64    `json:"accountId"`
	LastPong  time.Time `json:"lastPong"`
}

func NewClient

func NewClient(nickName string, accountId uint64, session *melody.Session) *Client

type CmdCreateAccountReq

type CmdCreateAccountReq struct {
	Cmd      string `json:"cmd"`
	NickName string `json:"nickName"`
}

type CmdCreateAccountResp

type CmdCreateAccountResp struct {
	BaseRespCmd
	NickName  string `json:"nickName"`
	AccountId uint64 `json:"accountId"`
	Token     string `json:"token"`
}

type CmdDialogueReq

type CmdDialogueReq struct {
	Cmd       string `json:"cmd"`
	RequestId string `json:"requestId"`
	SenderId  uint64 `json:"senderId"`
	SessionId uint64 `json:"sessionId"`
	Content   string `json:"content"`
}

type CmdDialogueResp

type CmdDialogueResp struct {
	BaseRespCmd
	RequestId string `json:"requestId"`
	MsgId     uint64 `json:"msgId"`
}

type CmdMatchReq

type CmdMatchReq struct {
	Cmd       string `json:"cmd"`
	AccountId uint64 `json:"accountId"`
}

type CmdMatchResp

type CmdMatchResp struct {
	BaseRespCmd
	PartnerId   uint64 `json:"partnerId,omitempty"`
	PartnerName string `json:"partnerName,omitempty"`
	SessionId   uint64 `json:"sessionId,omitempty"`
}

type CmdPingReq

type CmdPingReq struct {
	Cmd       string `json:"cmd"`
	AccountId uint64 `json:"accountId"`
}

由broker发出

{
"cmd": "PING",
"accountId": 12000
}

type CmdPingResp

type CmdPingResp struct {
	Cmd       string `json:"cmd"`
	AccountId uint64 `json:"accountId"`
}

由Client发出

{
	"cmd": "PONG"
	"accountId": 12000
}

type CmdPushDialogueReq

type CmdPushDialogueReq struct {
	Cmd       string `json:"cmd"`
	MsgId     uint64 `json:"msgId"`
	SenderId  uint64 `json:"senderId"`
	SessionId uint64 `json:"sessionId"`
	Content   string `json:"content"`
}

type CmdPushDialogueResp

type CmdPushDialogueResp struct {
	BaseRespCmd
}

type CmdPushSignalReq

type CmdPushSignalReq struct {
	Cmd        string      `json:"cmd"`
	SenderId   uint64      `json:"senderId"`
	SessionId  uint64      `json:"sessionId"`
	ReceiverId uint64      `json:"receiverId"`
	SignalType string      `json:"signalType"`
	Data       interface{} `json:"data"`
}

type CmdPushSignalResp

type CmdPushSignalResp struct {
	BaseRespCmd
}

type CmdPushViewedAckReq

type CmdPushViewedAckReq struct {
	Cmd       string `json:"cmd"`
	SessionId uint64 `json:"sessionId"`
	AccountId uint64 `json:"accountId"`
	MsgId     uint64 `json:"msgId"`
}

type CmdReConnectReq

type CmdReConnectReq struct {
	Cmd       string `json:"cmd"`
	AccountId uint64 `json:"accountId"`
	Token     string `json:"token"`
}

type CmdReConnectResp

type CmdReConnectResp struct {
	BaseRespCmd
}

type CmdViewedAckReq

type CmdViewedAckReq struct {
	Cmd       string `json:"cmd"`
	SessionId uint64 `json:"sessionId"`
	AccountId uint64 `json:"accountId"`
	MsgId     uint64 `json:"MsgId"`
}

type CmdViewedAckResp

type CmdViewedAckResp struct {
	BaseRespCmd
}

type CommonCmd

type CommonCmd struct {
	Cmd string `json:"cmd"`
}

type InBox

type InBox struct {
	ID         uint64 `gorm:"column:id" json:"id"`
	SenderId   uint64 `gorm:"column:sender_id" json:"sender_id"`
	MsgId      uint64 `gorm:"column:msg_id" json:"msg_id"`
	ReceiverId uint64 `gorm:"column:receiver_id" json:"receiver_id"`
}

func (InBox) TableName

func (InBox) TableName() string

type OutBox

type OutBox struct {
	ID         uint64    `gorm:"column:id" json:"id"`
	SenderId   uint64    `gorm:"column:sender_id" json:"sender_id"`
	SessionId  uint64    `gorm:"column:session_id" json:"session_id"`
	Status     int       `gorm:"column:status" json:"status"`
	MsgType    int       `gorm:"column:msg_type" json:"msg_type"`
	Content    string    `gorm:"column:content" json:"content"`
	CreatedAt  time.Time `gorm:"column:created_at" json:"-"`
	ModifiedAt time.Time `gorm:"column:modified_at" json:"-"`
}

func (OutBox) TableName

func (OutBox) TableName() string

type Session

type Session struct {
	ID         uint64    `gorm:"column:id" json:"id"`
	Status     int       `gorm:"column:status" json:"status"`
	CreatedAt  time.Time `gorm:"column:created_at" json:"-"`
	ModifiedAt time.Time `gorm:"column:modified_at" json:"-"`
}

func (Session) TableName

func (Session) TableName() string

type SessionAccount

type SessionAccount struct {
	ID        uint64 `gorm:"column:id" json:"id"`
	SessionId uint64 `gorm:"column:session_id" json:"session_id"`
	AccountId uint64 `gorm:"column:account_id" json:"account_id"`
}

func (SessionAccount) TableName

func (SessionAccount) TableName() string

Jump to

Keyboard shortcuts

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