-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c9db177
commit 47af86d
Showing
5 changed files
with
121 additions
and
68 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,23 @@ | ||
package event | ||
|
||
import "context" | ||
|
||
type Emitter struct { | ||
repository *Repository | ||
publisher publisher | ||
} | ||
|
||
type publisher interface { | ||
Publish(eventID string, message any) | ||
} | ||
|
||
func NewEmitter(repository *Repository, publisher publisher) *Emitter { | ||
return &Emitter{ | ||
repository: repository, | ||
publisher: publisher, | ||
} | ||
} | ||
|
||
func (em *Emitter) Emit(ctx context.Context, event Event) { | ||
|
||
} |
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,5 @@ | ||
package event | ||
|
||
type Event struct { | ||
Name string | ||
} |
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 event | ||
|
||
import ( | ||
"context" | ||
"database/sql" | ||
) | ||
|
||
type Repository struct { | ||
db *sql.DB | ||
} | ||
|
||
func NewRepository(db *sql.DB) *Repository { | ||
return &Repository{ | ||
db: db, | ||
} | ||
} | ||
|
||
func (r *Repository) Insert(ctx context.Context, event Event) (Event, error) { | ||
return event, nil | ||
} |