generated from PackagrIO/goweb-template
-
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
moved event bus into its own package.
created models for event bus messaging. added logger. added source complete and sync events.
- Loading branch information
Showing
9 changed files
with
143 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package models | ||
|
||
type EventSourceSyncStatus string | ||
|
||
const ( | ||
EventTypeSourceSync EventSourceSyncStatus = "source_sync" | ||
EventTypeSourceComplete EventSourceSyncStatus = "source_complete" | ||
) | ||
|
||
type EventInterface interface { | ||
GetUserID() string | ||
} | ||
|
||
type Event struct { | ||
UserID string `json:"-"` | ||
EventType EventSourceSyncStatus `json:"event_type"` | ||
} | ||
|
||
func (e *Event) GetUserID() string { | ||
return e.UserID | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package models | ||
|
||
type EventSourceComplete struct { | ||
*Event `json:",inline"` | ||
SourceID string `json:"source_id"` | ||
} | ||
|
||
func NewEventSourceComplete(userID string, sourceID string) *EventSourceComplete { | ||
return &EventSourceComplete{ | ||
Event: &Event{ | ||
UserID: userID, | ||
EventType: EventTypeSourceComplete, | ||
}, | ||
SourceID: sourceID, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package models | ||
|
||
type EventSourceSync struct { | ||
*Event `json:",inline"` | ||
SourceID string `json:"source_id"` | ||
ResourceType string `json:"resource_type"` | ||
ResourceID string `json:"resource_id"` | ||
} | ||
|
||
func NewEventSourceSync(userID string, sourceID string, resourceType string, resourceID string) *EventSourceSync { | ||
return &EventSourceSync{ | ||
Event: &Event{ | ||
UserID: userID, | ||
EventType: EventTypeSourceSync, | ||
}, | ||
SourceID: sourceID, | ||
ResourceType: resourceType, | ||
ResourceID: resourceID, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters