message

package
v0.0.0-...-3773cab Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2020 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ROUTE_MESSAGE_STORE_SERVICE = "message_store_service"
)

Variables

This section is empty.

Functions

func MessageStorePool

func MessageStorePool(msgQueue MessageQueueSvc, msgStore MsgStoreSvc)

func NewMongoDBRepo

func NewMongoDBRepo(s *mgo.Session) *mongoDBRepo

func NewService

func NewService(r repoProvider) *service

Types

type CreateRequest

type CreateRequest struct {
	SenderId   string `json:"sender_id" validate:"required"`
	SenderType string `json:"sender_type,omitempty" validate:"omitempty"`

	ReceiverId   string `json:"receiver_id"  validate:"required"`
	ReceiverType string `json:"receiver_type,omitempty"  validate:"omitempty"`

	Content string `json:"content"  validate:"required"`
}

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func InitHandlerMongoDBInjected

func InitHandlerMongoDBInjected(s *mgo.Session) *Handler

func NewHandler

func NewHandler(s serviceProvider) *Handler

func (*Handler) DeleteMessage

func (h *Handler) DeleteMessage(w http.ResponseWriter, r *http.Request)

func (*Handler) GetAllMessage

func (h *Handler) GetAllMessage(w http.ResponseWriter, r *http.Request)

func (*Handler) GetMessageById

func (h *Handler) GetMessageById(w http.ResponseWriter, r *http.Request)

func (*Handler) GetMessagesCommunity

func (h *Handler) GetMessagesCommunity(w http.ResponseWriter, r *http.Request)

func (*Handler) GetMessagesUser

func (h *Handler) GetMessagesUser(w http.ResponseWriter, r *http.Request)

func (*Handler) LoadRoutes

func (h *Handler) LoadRoutes() []router.Route

func (*Handler) PostMessage

func (h *Handler) PostMessage(w http.ResponseWriter, r *http.Request)

func (*Handler) PutMessage

func (h *Handler) PutMessage(w http.ResponseWriter, r *http.Request)

type MessageDB

type MessageDB struct {
	ID        string `bson:"_id"`
	MessageId string `bson:"message_id"`
	Type      string `bson:"type,omitempty"`

	SenderType string `bson:"sender_type,omitempty"`
	SenderId   string `bson:"sender_id"`

	ReceiverType string `bson:"receiver_type,omitempty"`
	ReceiverId   string `bson:"receiver_id"`

	Content   string     `bson:"content"`
	CreatedAt *time.Time `bson:"created_at,omitempty"`
	UpdatedAt *time.Time `bson:"updated_at,omitempty"`
}

type MessageInfo

type MessageInfo struct {
	MessageId string `json:"message_id" bson:"message_id"`
	Type      string `json:"type,omitempty"`

	SenderType string `json:"sender_type,omitempty"`
	SenderId   string `json:"sender_id"`

	ReceiverType string `json:"receiver_type,omitempty"`
	ReceiverId   string `json:"receiver_id"`

	Content   string     `json:"content" bson:"content"`
	CreatedAt *time.Time `json:"created_at,omitempty"`
	UpdatedAt *time.Time `json:"updated_at,omitempty"`
}

type MessageQueueSvc

type MessageQueueSvc interface {
	Close()
	Start() <-chan []byte
	Listen(queueName string, routeKeys []string) (<-chan []byte, error)
}

type MsgStoreSvc

type MsgStoreSvc interface {
	Insert(context.Context, *MessageDB) (string, error)
}

type UpdateRequest

type UpdateRequest struct {
	Content string `json:"content"  validate:"required"`
}

Jump to

Keyboard shortcuts

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