Documentation
¶
Index ¶
- Variables
- type Contact
- type ContactRepository
- type ContactServicer
- type ContactState
- type Conversation
- type ConversationRepository
- type ConversationServicer
- type ConversationState
- type DeliveryServicer
- type FindContactOptions
- type FindConversionOptions
- type FindGroupMemberOptions
- type FindGroupOptions
- type FindMessagesOptions
- type Group
- type GroupMember
- type GroupMemberRepository
- type GroupRepository
- type GroupServicer
- type GroupState
- type GroupType
- type Message
- type MessageRepository
- type MessageServicer
- type MessageState
- type MessageType
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrContactExist = types.AppError{ErrorCode: "contact_exist", Message: "the contact already exists"}
)
View Source
var (
ErrMessageInvalid = types.AppError{ErrorCode: "invalid_message", Message: "the message's is invalid"}
)
Functions ¶
This section is empty.
Types ¶
type Contact ¶
type Contact struct { GroupID string `json:"group_id" db:"group_id"` MemberID string `json:"member_id" db:"member_id"` MemberID1 string `json:"-" db:"member_id_1"` MemberID2 string `json:"-" db:"member_id_2"` Member *identity.Member `json:"member"` State ContactState `json:"state" db:"state"` CreatedAt *time.Time `json:"created_at" db:"created_at"` UpdatedAt *time.Time `json:"updated_at" db:"updated_at"` }
type ContactRepository ¶
type ContactServicer ¶
type ContactState ¶
type ContactState int
const ( ContactStateNormal ContactState = 1 ContactStateBlock ContactState = 2 )
type Conversation ¶
type Conversation struct { ID string `json:"id" db:"id"` GroupID string `json:"group_id" db:"group_id"` MemberID string `json:"-" db:"member_id"` IsMute bool `json:"is_mute" db:"is_mute"` LastAckMessageID string `json:"last_ack_message_id" db:"last_ack_message_id"` State ConversationState `json:"state" db:"state"` CreatedAt *time.Time `json:"created_at" db:"created_at"` UpdatedAt *time.Time `json:"updated_at" db:"updated_at"` }
type ConversationRepository ¶
type ConversationRepository interface { DB() *sqlx.DB Conversations(ctx context.Context, opts *FindConversionOptions) ([]*Conversation, error) InsertTx(ctx context.Context, target *Conversation, tx *sqlx.Tx) error }
type ConversationServicer ¶
type ConversationServicer interface { Conversations(ctx context.Context, opts *FindConversionOptions) ([]*Conversation, error) CreateConversation(ctx context.Context, conversation *Conversation) error UnreadMessageCount(ctx context.Context, conversationID string) (int, error) MarkAllMessageAsRead(ctx context.Context, conversationID string) error GetConversationMessageCount(ctx context.Context, conversationID string) (int, error) }
type ConversationState ¶
type ConversationState int
const ( ConversationStateNormal ConversationState = 1 ConversationStateBlock ConversationState = 2 ConversationStateDelete ConversationState = 3 )
type DeliveryServicer ¶
type FindContactOptions ¶
type FindConversionOptions ¶
type FindGroupMemberOptions ¶
type FindGroupOptions ¶
type FindMessagesOptions ¶
type Group ¶
type Group struct { ID string `json:"id" db:"id"` Name string `json:"name" db:"name"` Description string `json:"description" db:"description"` Type GroupType `json:"type" db:"type"` MaxMemberCount int `json:"-" db:"max_member_count"` MemberCount int `json:"member_count" db:"member_count"` CreatorID string `json:"-" db:"creator_id"` State GroupState `json:"state" db:"state"` CreatedAt *time.Time `json:"created_at" db:"created_at"` UpdatedAt *time.Time `json:"updated_at" db:"updated_at"` }
type GroupMember ¶
type GroupMember struct { ID string `json:"id" db:"id"` GroupID string `json:"group_id" db:"group_id"` MemberID string `json:"member_id" db:"member_id"` IsAdmin bool `json:"is_admin" db:"is_admin"` CreatedAt *time.Time `json:"created_at" db:"created_at"` UpdatedAt *time.Time `json:"updated_at" db:"updated_at"` }
type GroupMemberRepository ¶
type GroupMemberRepository interface { DB() *sqlx.DB GroupMembers(ctx context.Context, opts *FindGroupMemberOptions) ([]*GroupMember, error) BatchInsertTx(ctx context.Context, members []*GroupMember, tx *sqlx.Tx) error }
type GroupRepository ¶
type GroupServicer ¶
type GroupServicer interface { Groups(ctx context.Context, opts *FindGroupOptions) ([]*Group, error) CreateGroup(ctx context.Context, group *Group, memberIDs []string) error DissolveGroup(ctx context.Context, groupID string) error // 解散群組 JoinGroup(ctx context.Context, groupID string, memberID string) error LeaveGroup(ctx context.Context, groupID string) error AddGroupMember(ctx context.Context, groupID string, memberID string) error GroupMembers(ctx context.Context, opts *FindGroupMemberOptions) ([]*GroupMember, error) SetAdmin(ctx context.Context, groupID string, memberID string) error RemoveAdmin(ctx context.Context, groupID string, memberID string) error GroupAdmins(ctx context.Context, groupID string) ([]*GroupMember, error) }
type GroupState ¶
type GroupState int
const ( GroupStateNormal GroupState = 1 GroupStateDissolved GroupState = 2 )
type Message ¶
type Message struct { ID string `json:"id,omitempty" db:"id"` SeqID int32 `json:"seq_id,omitempty" db:"seq_id"` Type MessageType `json:"type,omitempty" db:"type"` GroupID string `json:"group_id,omitempty" db:"group_id"` SenderID string `json:"sender_id,omitempty" db:"sender_id"` SenderFirstName string `json:"sender_first_name,omitempty" db:"sender_first_name"` SenderLastName string `json:"sender_last_name,omitempty" db:"sender_last_name"` Content string `json:"content,omitempty" db:"content"` State MessageState `json:"state,omitempty" db:"state"` CreatedAt *time.Time `json:"created_at,omitempty" db:"created_at"` UpdatedAt *time.Time `json:"updated_at,omitempty" db:"updated_at"` }
type MessageRepository ¶
type MessageServicer ¶
type MessageState ¶
type MessageState int
const ( MessageStateNormal MessageState = 1 MessageStateDelete MessageState = 2 MessageStateDone MessageState = 3 // 完成朋友邀請 )
type MessageType ¶
type MessageType int
const ( MessageTypeNotification MessageType = 1 MessageTypeText MessageType = 2 MessageTypeImage MessageType = 3 )
Click to show internal directories.
Click to hide internal directories.