model

package
v0.0.0-...-db099c4 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB

DB 数据库全局变量

Functions

func GetDB

func GetDB() *gorm.DB

GetDB 返回默认的数据库

func Init

func Init() *gorm.DB

Init 初始化数据库

Types

type BaseModel

type BaseModel struct {
	ID        uint64     `gorm:"primary_key;AUTO_INCREMENT;column:id" json:"id"`
	CreatedAt time.Time  `gorm:"column:created_at" json:"created_at"`
	UpdatedAt time.Time  `gorm:"column:updated_at" json:"updated_at"`
	DeletedAt *time.Time `gorm:"column:deleted_at" sql:"index" json:"-"`
}

type ChatInfo

type ChatInfo struct {
	User      *UserInfo `json:"user"`
	Msg       *MsgInfo  `json:"msg"`
	ShowTime  string    `json:"show_time"`
	NewMsgNum int       `json:"new_msg_num"`
}

type ChatModel

type ChatModel struct {
	BaseModel
	SenderUID   uint64 `gorm:"column:sender_uid" json:"sender_uid"`
	ReceiverUID uint64 `gorm:"column:receiver_uid" json:"receiver_uid"`
	LastMsgID   int    `gorm:"column:last_msg_id" json:"last_msg_id"`
	MsgNum      int    `gorm:"column:msg_num" json:"msg_num"`
	IsDelete    int    `gorm:"column:is_delete" json:"is_delete"`
	Extra       string `gorm:"column:extra" json:"extra"`
}

func (*ChatModel) TableName

func (c *ChatModel) TableName() string

TableName sets the insert table name for this struct type

type ChatMsgModel

type ChatMsgModel struct {
	ID     uint64 `gorm:"primary_key;AUTO_INCREMENT;column:id" json:"id"`
	ChatID uint64 `gorm:"column:chat_id" json:"chat_id"`
	MsgID  uint64 `gorm:"column:msg_id" json:"msg_id"`
}

func (*ChatMsgModel) TableName

func (c *ChatMsgModel) TableName() string

TableName sets the insert table name for this struct type

type MsgInfo

type MsgInfo struct {
	MsgId    uint64      `json:"msg_id"`
	IsSelf   int         `json:"is_self"`
	MsgType  int         `json:"msg_type"`
	Content  interface{} `json:"content"`
	LocalMid uint64      `json:"local_mid"`
	ShowTime string      `json:"show_time"`
}

type MsgList

type MsgList struct {
	Lock  *sync.Mutex
	IdMap map[uint64]*MsgInfo
}

type MsgModel

type MsgModel struct {
	BaseModel
	ChatID      uint64 `gorm:"column:chat_id" json:"chat_id"`
	Content     string `gorm:"column:content" json:"content"`
	Extra       string `gorm:"column:extra" json:"extra"`
	LocalMid    uint64 `gorm:"column:local_mid" json:"local_mid"`
	MsgType     int    `gorm:"column:msg_type" json:"msg_type"`
	ReceiveType int    `gorm:"column:receive_type" json:"receive_type"`
	UserID      uint64 `gorm:"column:user_id" json:"user_id"`
}

func (*MsgModel) TableName

func (m *MsgModel) TableName() string

TableName sets the insert table name for this struct type

type SendMsgInput

type SendMsgInput struct {
	UserId      uint64 `json:"user_id"`
	YUserId     uint64 `json:"y_user_id"`
	ChatId      uint64 `json:"chat_id"`
	LocalMId    uint64 `json:"local_m_id"`
	MsgType     int    `json:"msg_type"`
	ReceiveType int    `json:"receive_type"`
	Content     string `json:"content"`
	Width       int    `json:"width"`
	Height      int    `json:"height"`
	Duration    int    `json:"duration"`
	ClassId     uint64 `json:"class_id"`
}

type Token

type Token struct {
	Token string `json:"token"`
}

Token represents a JSON web token.

type UserBaseModel

type UserBaseModel struct {
	BaseModel
	Phone          int64     `gorm:"column:phone" json:"phone"`
	Username       string    `gorm:"column:username" json:"username"`
	Avatar         string    `gorm:"column:avatar" json:"avatar"`
	Password       string    `gorm:"column:password" json:"password"`
	OpenID         string    `gorm:"column:open_id" json:"open_id, omitempty"`
	UnionID        string    `gorm:"column:union_id" json:"union_id, omitempty"`
	Sex            int       `gorm:"column:sex" json:"sex"`
	PostCount      int       `gorm:"column:post_count" json:"post_count"`
	CommentCount   int       `gorm:"column:comment_count" json:"comment_count"`
	ReplyCount     int       `gorm:"column:reply_count" json:"reply_count"`
	ClassCount     int       `gorm:"column:class_count" json:"class_count"`
	FollowingCount int       `gorm:"column:following_count" json:"following_count"`
	FollowerCount  int       `gorm:"column:follower_count" json:"follower_count"`
	Status         int       `gorm:"column:status" json:"status"`
	LastLoginIP    string    `gorm:"column:last_login_ip" json:"last_login_ip"`
	LastLoginTime  time.Time `gorm:"column:last_login_time" json:"last_login_time"`
}

func (*UserBaseModel) TableName

func (u *UserBaseModel) TableName() string

TableName sets the insert table name for this struct type

type UserChatList

type UserChatList struct {
	Lock  *sync.Mutex
	IdMap map[uint64]*ChatInfo
}

type UserChatModel

type UserChatModel struct {
	Id         uint64 `gorm:"primary_key;AUTO_INCREMENT;column:id" json:"id"`
	ChatID     uint64 `gorm:"column:chat_id" json:"chat_id"`
	ClearMsgID uint64 `gorm:"column:clear_msg_id" json:"clear_msg_id"`
	DelMsgID   uint64 `gorm:"column:del_msg_id" json:"del_msg_id"`
	Extra      string `gorm:"column:extra" json:"extra"`
	LastMsgID  uint64 `gorm:"column:last_msg_id" json:"last_msg_id"`
	MsgNum     int    `gorm:"column:msg_num" json:"msg_num"`
	UserID     uint64 `gorm:"column:user_id" json:"user_id"`
	YUserID    uint64 `gorm:"column:yuser_id" json:"yuser_id"`
}

func (*UserChatModel) TableName

func (u *UserChatModel) TableName() string

TableName sets the insert table name for this struct type

type UserInfo

type UserInfo struct {
	Id             uint64 `json:"id"`
	Phone          int    `json:"phone"`
	Username       string `json:"username"`
	Avatar         string `json:"avatar"`
	Sex            int    `json:"sex"`
	PostCount      int    `json:"post_count"`
	CommentCount   int    `json:"comment_count"`
	ReplyCount     int    `json:"reply_count"`
	FeedCount      int    `json:"feed_count"`
	FollowingCount int    `json:"following_count"`
	FollowerCount  int    `json:"follower_count"`
	ClassCount     int    `json:"class_count"`    // 总班级数
	LikeCount      int    `json:"like_count"`     // 总的喜欢数
	PointCount     int    `json:"point_count"`    // 总的斑点数
	ActivityCount  int    `json:"activity_count"` // 活动数
	IsFollow       int    `json:"is_follow"`      // 是否关注用户
	IsFollowed     int    `json:"is_followed"`    // 是否被粉丝关注
	InviteStatus   int    `json:"invite_status"`  // 邀请状态(在班级中邀请的))
	CreatedAt      string `json:"created_at"`
}

type UserList

type UserList struct {
	Lock  *sync.Mutex
	IdMap map[uint64]*UserInfo
}

Jump to

Keyboard shortcuts

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