model

package
v0.0.0-...-e039532 Latest Latest
Warning

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

Go to latest
Published: May 4, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KilledPodDB = &sdk.DBModel2{
	ColName:        "killed_pod",
	TemplateObject: &KilledPod{},
}
View Source
var MessageDB = &sdk.DBModel2{
	ColName:        "message",
	TemplateObject: &Message{},
}
View Source
var MessageLogDB = &sdk.DBModel2{
	ColName:        "message_log",
	TemplateObject: &MessageLog{},
}
View Source
var MessageQueueDB = sdk.DBSortedQueue{
	ColName: "message_queue",
}
View Source
var MessageRoomDB = &sdk.DBModel2{
	ColName:        "message_room",
	TemplateObject: &MessageRoom{},
}
View Source
var RoomDB = &sdk.DBModel2{
	ColName:        "room",
	TemplateObject: &Room{},
}
View Source
var UserConnectionDB = &sdk.DBModel2{
	ColName:        "user_connection",
	TemplateObject: &UserConnection{},
}
View Source
var UserDB = &sdk.DBModel2{
	ColName:        "user",
	TemplateObject: &User{},
}

Functions

func GetConnById

func GetConnById(id int) *websocket.Connection

func GetConnMap

func GetConnMap() map[int]*websocket.Connection

func InitKilledPod

func InitKilledPod(dbSession *sdk.DBSession, dbName string)

func InitMessageDB

func InitMessageDB(dbSession *sdk.DBSession, dbName string)

func InitMessageLogDB

func InitMessageLogDB(dbSession *sdk.DBSession, dbName string)

func InitMessageQueueDB

func InitMessageQueueDB(dbSession *sdk.DBSession, dbName string)

func InitMessageRoomDB

func InitMessageRoomDB(dbSession *sdk.DBSession, dbName string)

func InitRoomDB

func InitRoomDB(dbSession *sdk.DBSession, dbName string)

func InitUserConDB

func InitUserConDB(dbSession *sdk.DBSession, dbName string)

func InitUserDB

func InitUserDB(dbSession *sdk.DBSession, dbName string)

func SetWebSocket

func SetWebSocket(wss *websocket.WSServer)

Types

type Content

type Content struct {
	Topic      string `json:"topic,omitempty" bson:"topic,omitempty"`
	Status     string `json:"status,omitempty" bson:"status,omitempty"`
	ApiMessage string `json:"apiMessage,omitempty" bson:"apiMessage,omitempty"`
	ErrCode    string `json:"errorCode,omitempty" bson:"errorCode,omitempty"`

	// encoded chat msg of receiver
	ChatMessage     string `json:"chatMessage,omitempty" bson:"chatMessage,omitempty"`
	ChatMessageByte []byte `json:"chatMessageByte,omitempty" bson:"chatMessageByte,omitempty"`

	// encoded chat msg of sender
	SenderChatMessage     string `json:"senderChatMessage,omitempty" bson:"senderChatMessage,omitempty"`
	SenderChatMessageByte []byte `json:"senderChatMessageByte,omitempty" bson:"senderChatMessageByte,omitempty"`

	// for signaling call
	SDP       interface{} `json:"sdp,omitempty" bson:"sdp,omitempty"`
	Candidate interface{} `json:"candidate,omitempty" bson:"candidate,omitempty"`

	Type       string `json:"type,omitempty" bson:"type,omitempty"`
	ChatRoomID string `json:"chatRoomId,omitempty" bson:"chatRoomId,omitempty"`
	FromUserId string `json:"fromUserId,omitempty" bson:"fromUserId,omitempty"`
	// SSOToken    string      `json:"ssoToken,omitempty" bson:"ssoToken,omitempty"`
	UserId      string      `json:"userId,omitempty" bson:"user_id,omitempty"`
	Action      string      `json:"action,omitempty" bson:"action,omitempty"`
	Data        interface{} `json:"data,omitempty" bson:"data,omitempty"`
	User        *User       `json:"user,omitempty" bson:"user,omitempty"`
	IsVideoCall bool        `json:"isVideoCall,omitempty" bson:"is_video_call,omitempty"`

	LastUpdatedTime *time.Time `json:"lastUpdatedTime,omitempty" bson:"last_updated_time,omitempty"`
}

type KilledPod

type KilledPod struct {
	PodName  string
	Reason   string
	FailTime *time.Time
}

type Message

type Message struct {
	ID              bson.ObjectId `json:"id,omitempty" bson:"_id,omitempty"`
	LastUpdatedTime *time.Time    `json:"lastUpdatedTime,omitempty" bson:"last_updated_time,omitempty"`

	Topic          enum.TopicEnumValue         `json:"topic,omitempty" bson:"topic,omitempty"`
	ToUserId       string                      `json:"toUserId,omitempty" bson:"to_user_id,omitempty"`
	DeliveryStatus enum.MessageStatusEnumValue `json:"deliveryStatus,omitempty" bson:"delivery_status,omitempty"`
	Content        *Content                    `json:"content,omitempty" bson:"content,omitempty"`

	Targets    *[]*UserConnection `json:"targets,omitempty" bson:"targets,omitempty"`
	TargetSent *int               `json:"targetSent,omitempty" bson:"target_sent,omitempty"`
}

type MessageLog

type MessageLog struct {
	ID              bson.ObjectId `json:"id,omitempty" bson:"_id,omitempty"`
	LastUpdatedTime *time.Time    `json:"lastUpdatedTime,omitempty" bson:"last_updated_time,omitempty"`
	CreatedTime     *time.Time    `json:"createdTime,omitempty" bson:"created_time,omitempty"`

	ConnectionID bson.ObjectId             `json:"connectionId,omitempty" bson:"connection_id,omitempty"`
	MessageID    *bson.ObjectId            `json:"messageId,omitempty" bson:"message_id,omitempty"`
	UserID       string                    `json:"userId,omitempty" bson:"user_id,omitempty"`
	Message      string                    `json:"message,omitempty" bson:"message,omitempty"`
	Type         enum.MessageTypeEnumValue `json:"type,omitempty" bson:"type,omitempty"`
	IsSuccess    *bool                     `json:"isSuccess,omitempty" bson:"is_success,omitempty"`
}

type MessageQueueItem

type MessageQueueItem struct {
	Category enum.MessageCategoryEnum
	/**
		-Data depend on -Category
	    PUSH_MESSAGE => -Data = message id
	*/
	Data              string
	ConnectionLocalID int
}

type MessageRoom

type MessageRoom struct {
	ID              bson.ObjectId `json:"id,omitempty" bson:"_id,omitempty"`
	LastUpdatedTime *time.Time    `json:"lastUpdatedTime,omitempty" bson:"last_updated_time,omitempty"`
	CreatedTime     *time.Time    `json:"createdTime,omitempty" bson:"created_time,omitempty"`

	UserId     string   `json:"userId,omitempty" bson:"user_id,omitempty"`
	ChatRoomId string   `json:"chatRoomId,omitempty" bson:"chat_room_id,omitempty"`
	Content    *Content `json:"content,omitempty" bson:"content,omitempty"`
}

type NotEqualStr

type NotEqualStr struct {
	NeStr string `bson:"$ne,omitempty"`
}

type OldConnectionQuery

type OldConnectionQuery struct {
	WSHostVersion NotEqualStr             `bson:"ws_host_version,omitempty"`
	Status        enum.ConStatusEnumValue `bson:"status,omitempty"`
}

type Room

type Room struct {
	ID bson.ObjectId `json:"id,omitempty" bson:"_id,omitempty"`

	UserIds    []string `json:"userIds,omitempty" bson:"user_ids,omitempty"`
	PinMessage *Content `json:"pinMessage,omitempty" bson:"pin_message,omitempty"`
	OffsetPin  int64    `json:"offsetPin,omitempty" bson:"offset_pin,omitempty"` // ->use for scroll more message near pin
	Name       string   `json:"name,omitempty" bson:"name,omitempty"`
	Avatar     string   `json:"avatar,omitempty" bson:"avatar,omitempty"`

	Type    enum.RoomTypeEnumValue `json:"roomType,omitempty" bson:"room_type,omitempty"`
	RoomKey string                 `json:"roomKey,omitempty" bson:"room_key,omitempty"`

	PriKey string `json:"-" bson:"pri_key,omitempty"`
	PubKey string `json:"pubKey,omitempty" bson:"pub_key,omitempty"`
}

type User

type User struct {
	ID bson.ObjectId `json:"id,omitempty" bson:"_id,omitempty"`

	UserID   string `json:"userId,omitempty" bson:"user_id,omitempty"`
	Password string `json:"password,omitempty" bson:"password,omitempty"`
	Name     string `json:"name,omitempty" bson:"name,omitempty"`
	Email    string `json:"email,omitempty" bson:"email,omitempty"`
	Phone    string `json:"phone,omitempty" bson:"phone,omitempty"`

	Avatar string `json:"avatar,omitempty" bson:"avatar,omitempty"`
	Key    string `json:"-" bson:"key,omitempty"`
	PubKey string `json:"pub_key,omitempty" bson:"pub_key,omitempty"`
}

type UserConnection

type UserConnection struct {
	ID              bson.ObjectId `json:"id,omitempty" bson:"_id,omitempty"`
	LastUpdatedTime *time.Time    `json:"lastUpdatedTime,omitempty" bson:"last_updated_time,omitempty"`
	CreatedTime     *time.Time    `json:"createdTime,omitempty" bson:"created_time,omitempty"`

	Status        enum.ConStatusEnumValue `json:"status,omitempty" bson:"status,omitempty"`
	WSHost        string                  `json:"wsHost,omitempty" bson:"ws_host,omitempty"`
	WSHostVersion string                  `json:"wsHostVersion,omitempty" bson:"ws_host_version,omitempty"`
	DeviceOs      string                  `json:"deviceOs,omitempty" bson:"device_os,omitempty"`
	AppVersion    string                  `json:"appVersion,omitempty" bson:"app_version,omitempty"`
	DeviceID      string                  `json:"deviceId,omitempty" bson:"device_id,omitempty"`
	IP            string                  `json:"ip,omitempty" bson:"ip,omitempty"`
	UserID        string                  `json:"userId,omitempty" bson:"user_id,omitempty"`
	UserAgent     string                  `json:"userAgent,omitempty" bson:"user_agent,omitempty"`
	InServiceID   int                     `json:"inServiceId,omitempty" bson:"in_service_id,omitempty"`
	ClosedMessage string                  `json:"closedMessage,omitempty" bson:"closed_message,omitempty"`

	ConnectedTime    *time.Time `json:"connectedTime,omitempty" bson:"connected_time,omitempty"`
	AuthorizedTime   *time.Time `json:"authorizedTime,omitempty" bson:"authorized_time,omitempty"`
	DisconnectedTime *time.Time `json:"disconnected_time,omitempty" bson:"disconnected_time,omitempty"`
	LastMessageTime  *time.Time `json:"lastMessageTime,omitempty" bson:"last_message_time,omitempty"`

	// used in message.Targets
	DeliverType enum.DeliverTypeEnumValue `json:"deliverType,omitempty" bson:"deliver_type,omitempty"`
}

type WSInputMessage

type WSInputMessage struct {
	Topic     enum.TopicEnumValue `json:"topic,omitempty" bson:"topic,omitempty"`
	Content   *Content            `json:"content,omitempty" bson:"content,omitempty"`
	UserAgent string              `json:"userAgent,omitempty" bson:"userAgent,omitempty"`
}

type WSOutputMessage

type WSOutputMessage struct {
	Topic   enum.TopicEnumValue `json:"topic,omitempty" bson:"topic,omitempty"`
	Content *Content            `json:"content,omitempty" bson:"content,omitempty"`
}

func (*WSOutputMessage) String

func (outMsg *WSOutputMessage) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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