Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

chore(dealer): scaffold of events usecase #12

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Created by https://www.toptal.com/developers/gitignore/api/go,godot,windows,linux,macos
# Edit at https://www.toptal.com/developers/gitignore?templates=go,godot,windows,linux,macos

### Go ###
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

#ignore .env
.env

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/



### Linux ###
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### Windows ###
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

# End of https://www.toptal.com/developers/gitignore/api/go,windows,linux,macos
5 changes: 5 additions & 0 deletions domains/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,8 @@ type EventModel interface {
GetById(id int64) (Event, error)
UpdateById(id int64, state string) error
}

type EventQueue interface {
Subscribe(eventType string, callback func()) error
Publish(event Event) error
}
31 changes: 31 additions & 0 deletions drivers/rabbitmq/events.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package rabbitmq

import (
"github.com/platzily/dealer/config"
"github.com/platzily/dealer/domains"
"github.com/streadway/amqp"
)

const MAIN_EVENTS_QUEUE = "main_queue"

var env *config.RabbitMQConfig = config.ReadRabbitMQConfig()

type EventQueue struct {
conn *amqp.Connection
}

func New(rabbitConnection *amqp.Connection) domains.EventQueue {
return &EventQueue{
conn: rabbitConnection,
}
}

func (eq *EventQueue) Subscribe(eventType string, callback func()) error {

return nil
}

func (eq *EventQueue) Publish(event domains.Event) error {

return nil
}
1 change: 1 addition & 0 deletions useCases/event.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package usecases
Empty file removed useCases/todo.go
Empty file.