Documentation
¶
Index ¶
- Variables
- func NewInboxGRPCHandler(watchSvc InboxWatchService) pb.InboxServiceServer
- func NewInboxMessageHandler(inboxMessage InboxMessageService, generic services.GenericService, ...) *inboxMessageHandler
- func NewMockInboxMessageDao() *inboxMessageDaoMock
- func PresentInboxMessage(inboxMessage *InboxMessage) openapi.InboxMessage
- type AgentOwnershipChecker
- type InboxMessage
- type InboxMessageDao
- type InboxMessageIndex
- type InboxMessageList
- type InboxMessagePatchRequest
- type InboxMessageService
- type InboxWatchService
- type ServiceLocator
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DisableAdvisoryLock = false UseBlockingAdvisoryLock = true )
Functions ¶
func NewInboxGRPCHandler ¶
func NewInboxGRPCHandler(watchSvc InboxWatchService) pb.InboxServiceServer
func NewInboxMessageHandler ¶
func NewInboxMessageHandler(inboxMessage InboxMessageService, generic services.GenericService, agentOwnership AgentOwnershipChecker) *inboxMessageHandler
func NewMockInboxMessageDao ¶
func NewMockInboxMessageDao() *inboxMessageDaoMock
func PresentInboxMessage ¶
func PresentInboxMessage(inboxMessage *InboxMessage) openapi.InboxMessage
Types ¶
type AgentOwnershipChecker ¶
type AgentOwnershipChecker interface {
VerifyAgentProject(ctx context.Context, agentID, projectID string) *errors.ServiceError
}
type InboxMessage ¶
type InboxMessage struct {
api.Meta
AgentId string `json:"agent_id"`
FromAgentId *string `json:"from_agent_id"`
FromName *string `json:"from_name"`
Body string `json:"body"`
Read *bool `json:"read"`
}
func ConvertInboxMessage ¶
func ConvertInboxMessage(inboxMessage openapi.InboxMessage) *InboxMessage
func (*InboxMessage) BeforeCreate ¶
func (d *InboxMessage) BeforeCreate(tx *gorm.DB) error
type InboxMessageDao ¶
type InboxMessageDao interface {
Get(ctx context.Context, id string) (*InboxMessage, error)
Create(ctx context.Context, inboxMessage *InboxMessage) (*InboxMessage, error)
Replace(ctx context.Context, inboxMessage *InboxMessage) (*InboxMessage, error)
Delete(ctx context.Context, id string) error
FindByIDs(ctx context.Context, ids []string) (InboxMessageList, error)
All(ctx context.Context) (InboxMessageList, error)
UnreadByAgentID(ctx context.Context, agentID string) (InboxMessageList, error)
}
func NewInboxMessageDao ¶
func NewInboxMessageDao(sessionFactory *db.SessionFactory) InboxMessageDao
type InboxMessageIndex ¶
type InboxMessageIndex map[string]*InboxMessage
type InboxMessageList ¶
type InboxMessageList []*InboxMessage
func (InboxMessageList) Index ¶
func (l InboxMessageList) Index() InboxMessageIndex
type InboxMessagePatchRequest ¶
type InboxMessagePatchRequest struct {
Read *bool `json:"read,omitempty"`
}
type InboxMessageService ¶
type InboxMessageService interface {
Get(ctx context.Context, id string) (*InboxMessage, *errors.ServiceError)
Create(ctx context.Context, inboxMessage *InboxMessage) (*InboxMessage, *errors.ServiceError)
Replace(ctx context.Context, inboxMessage *InboxMessage) (*InboxMessage, *errors.ServiceError)
Delete(ctx context.Context, id string) *errors.ServiceError
All(ctx context.Context) (InboxMessageList, *errors.ServiceError)
UnreadByAgentID(ctx context.Context, agentID string) (InboxMessageList, *errors.ServiceError)
FindByIDs(ctx context.Context, ids []string) (InboxMessageList, *errors.ServiceError)
OnUpsert(ctx context.Context, id string) error
OnDelete(ctx context.Context, id string) error
}
func NewInboxMessageService ¶
func NewInboxMessageService(lockFactory db.LockFactory, inboxMessageDao InboxMessageDao, events services.EventService, watchSvc InboxWatchService) InboxMessageService
func Service ¶
func Service(s *environments.Services) InboxMessageService
type InboxWatchService ¶
type InboxWatchService interface {
Subscribe(ctx context.Context, agentID string) (<-chan *InboxMessage, func())
Notify(msg *InboxMessage)
}
func NewInboxWatchService ¶
func NewInboxWatchService() InboxWatchService
type ServiceLocator ¶
type ServiceLocator func() InboxMessageService
func NewServiceLocator ¶
func NewServiceLocator(env *environments.Env) ServiceLocator
Click to show internal directories.
Click to hide internal directories.