command
module
Version:
v0.0.0-...-de196d9
Opens a new window with list of versions in this module.
Published: Oct 25, 2021
License: Apache-2.0
Opens a new window with license information.
Imports: 11
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
Go hexagonal architecture example
This is an example illustrating how to structure code in go using
hexagonal architecture
Reference :
https://youtu.be/rQnTtQZGpg8
Here are some articles about hexagonal architecture
Folder structure
- api -> contains api handler logic
- repository -> logic to intact with different storage mechanisms (mongo, redis etc)
- memory -> implementation of repository logic using in-memory store (hashmap)
- serializer -> logic to encode/decode objects to bytes
- json -> serializer implementation using json
- msgpack -> serializer implementation using msgpack
- shortner -> app and domain logic for shortner
- logic.go -> business logic written as a service
- model.go -> struct
- repository.go -> interface to deal with repository
- serializer.go -> interface to encode/decode Redirect struct
- service.go -> interface for business logic
Build and run
Run the following command to run the app
./run.sh
Run the following to test the app
./scripts/test.sh
The script will create a new short link and print the output
Documentation
¶
There is no documentation for this package.
Source Files
¶
Directories
¶
|
|
repository
|
|
|
|
serializer
|
|
|
|
|
|
|
|
Click to show internal directories.
Click to hide internal directories.