diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9ad5952 --- /dev/null +++ b/.gitignore @@ -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 \ No newline at end of file diff --git a/domains/events.go b/domains/events.go index 1f63e02..e3e1d12 100644 --- a/domains/events.go +++ b/domains/events.go @@ -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 +} diff --git a/drivers/rabbitmq/events.go b/drivers/rabbitmq/events.go new file mode 100644 index 0000000..2f47065 --- /dev/null +++ b/drivers/rabbitmq/events.go @@ -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 +} diff --git a/useCases/event.go b/useCases/event.go new file mode 100644 index 0000000..cff28d9 --- /dev/null +++ b/useCases/event.go @@ -0,0 +1 @@ +package usecases diff --git a/useCases/todo.go b/useCases/todo.go deleted file mode 100644 index e69de29..0000000