model

package
v0.0.0-...-b89eba7 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpandToJson

func ExpandToJson(extend *MsgExtend) (pgtype.JSON, error)

ExpandToJson MsgExtend 转 pgtype.Json 可以存nil 参数: 消息扩展信息 返回: pgtype.Json 对象

Types

type Content

type Content struct {
	Type TokenType `json:"type"`
	ID   int64     `json:"id"`
}

func NewTokenContent

func NewTokenContent(t TokenType, ID int64) *Content

NewTokenContent 新建一种类型的token

func (*Content) Marshal

func (c *Content) Marshal() ([]byte, error)

func (*Content) Unmarshal

func (c *Content) Unmarshal(data []byte) error

type CreateFileMsg

type CreateFileMsg struct {
	AccountID, RelationID, RlyMsgID int64
	File                            *multipart.FileHeader
}

type CreateMsg

type CreateMsg struct {
	AccountID, RelationID, FileID, RlyMsgID int64
	NotifyType, MsgType, MsgContent         string
	MsgExtend                               *MsgExtend
}

type FeedMsgsByAccountIDAndTime

type FeedMsgsByAccountIDAndTime struct {
	AccountID     int64
	Limit, Offset int32
	LastTime      time.Time
}

type GetMsgsByContent

type GetMsgsByContent struct {
	RelationID, AccountID int64
	Limit, Offset         int32
	Content               string
}

type GetMsgsByRelationIDAndTime

type GetMsgsByRelationIDAndTime struct {
	AccountID, RelationID int64
	LastTime              time.Time
	Limit, Offset         int32
}

type GetPinMsgsByRelationID

type GetPinMsgsByRelationID struct {
	AccountID, RelationID int64
	Limit, Offset         int32
}

type GetRlyMsgsInfoByMsgID

type GetRlyMsgsInfoByMsgID struct {
	AccountID, RelationID, RlyMsgID int64
	Limit, Offset                   int32
}

type GetTopMsgByRelationID

type GetTopMsgByRelationID struct {
	AccountID, RelationID int64
}

type HandleReadMsg

type HandleReadMsg struct {
	AccessToken string  // AccessToken
	MsgIDs      []int64 // 消息IDs
	RelationID  int64   // 这些消息所处的关系ID
	ReaderID    int64   // 读者账户ID
}

type HandleSendMsg

type HandleSendMsg struct {
	AccessToken string     // AccessToken
	RelationID  int64      // 关系ID
	AccountID   int64      // 账户ID
	MsgContent  string     // 消息内容
	MsgExtend   *MsgExtend // 消息扩展信息
	RlyMsgID    int64      // 回复消息ID (如果是回复消息,则此字段大于0)
}

type MsgExtend

type MsgExtend struct {
	Remind []Remind `json:"remind"` // @的描述信息
}

MsgExtend 消息扩展信息 可能为null

func JsonToExpand

func JsonToExpand(data pgtype.JSON) (*MsgExtend, error)

JsonToExpand pgtype.Json 转 MsgExtend, 参数: pgtype.Json 对象(如果存的json为nil或未定义则返回nil) 返回: 解析后的消息扩展信息(可能为nil)

type MsgType

type MsgType string
const (
	MsgTypeText MsgType = "text"
	MsgTypeFile MsgType = "file"
)

type PublishFile

type PublishFile struct {
	File       *multipart.FileHeader `form:"file"  binding:"required" swaggerignore:"true"`
	RelationID int64                 `form:"relation_id"  binding:"required"`
	AccountID  int64                 `form:"account_id"  binding:"required"`
}

type PublishFileRe

type PublishFileRe struct {
	ID       int64     `json:"id"`
	FileType string    `json:"file_type"`
	FileSize int64     `json:"file_size"`
	Url      string    `json:"url"`
	CreateAt time.Time `json:"create_at"`
}

type Remind

type Remind struct {
	Idx       int64 `json:"idx" binding:"required,gte=1" validate:"required,gte=1"`        // 第几个@
	AccountID int64 `json:"account_id" binding:"required,gte=1" validate:"required,gte=1"` // 被@的账号ID
}

type RevokeMsg

type RevokeMsg struct {
	AccountID, MsgID int64
}

type Setting

type Setting struct {
	SettingInfo
	GroupInfo  *SettingGroupInfo  `json:"group_info"`  // 群组信息
	FriendInfo *SettingFriendInfo `json:"friend_info"` // 好友信息
}

type SettingFriend

type SettingFriend struct {
	SettingInfo
	FriendInfo *SettingFriendInfo `json:"friend_info"` // 好友信息
}

type SettingFriendInfo

type SettingFriendInfo struct {
	AccountID int64  `json:"account_id"` // 好友ID
	Name      string `json:"name"`       // 好友姓名
	Avatar    string `json:"avatar"`     //	好友头像
}

type SettingGroup

type SettingGroup struct {
	SettingInfo
	GroupInfo *SettingGroupInfo `json:"group_info"`
}

type SettingGroupInfo

type SettingGroupInfo struct {
	RelationID  int64  `json:"relation_id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Avatar      string `json:"avatar"`
}

type SettingInfo

type SettingInfo struct {
	RelationID   int64     `json:"relation_id"`    // 关系ID
	RelationType string    `json:"relation_type"`  // 关系类型['group','friend']
	NickName     string    `json:"nick_name"`      // 昵称(群组时为在群中昵称,好友时为好友昵称, 空表示未设置)
	IsNotDisturb bool      `json:"is_not_disturb"` // 是否免打扰
	IsPin        bool      `json:"is_pin"`         // 是否pin
	PinTime      time.Time `json:"pin_time"`       // pin时间
	IsShow       bool      `json:"is_show"`        // 是否显示
	LastShow     time.Time `json:"last_show"`      // 最后显示时间
}

type SettingPin

type SettingPin struct {
	SettingPinInfo
	GroupInfo  *SettingGroupInfo  `json:"group_info"`  // 群组信息
	FriendInfo *SettingFriendInfo `json:"friend_info"` // 好友信息
}

type SettingPinInfo

type SettingPinInfo struct {
	RelationID   int64     `json:"relation_id"`   // 关系ID
	RelationType string    `json:"relation_type"` // 关系类型['group','friend']
	NickName     string    `json:"nick_name"`     // 昵称(群组时为在群中昵称,好友时为好友昵称, 空表示未设置)
	PinTime      time.Time `json:"pin_time"`      // pin时间
}

type Token

type Token struct {
	AccessToken string
	Payload     *token.Payload
	Content     *Content
}

Token 结合token.Payload和Token

type TokenType

type TokenType string
const (
	UserToken    TokenType = "user"
	AccountToken TokenType = "account"
)

type UpdateMsgPin

type UpdateMsgPin struct {
	AccountID, RelationID, MsgID int64
	IsPin                        bool
}

type UpdateMsgTop

type UpdateMsgTop struct {
	AccountID, RelationID, MsgID int64
	IsTop                        bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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