Sapawarga service for "Nomor Penting" feature.
- Clone this repository with this command
git clone [email protected]:sapawarga/phonebook-service.git
- Use
.env
for environment variable and copy from.env.example
- Use port that written in
docker-compose.yml
- Run
docker-compose up --build
Golang use pattern, one directory is one package. This is repository's structure directory
cmd
- database
- grpc
endpoint
repository
- mysql
- postgres
transport
- grpc
- http
usecase
- phonebook
mocks
- testcases
- mock_repository
config
model
helper
Directory cmd
acts as infrastructure
of all entire service. Initialitation of database, thirdparty apps, routing, and module are in this package. This package using name main
then this package will be the main package that client will access.
Directory endpoint
acts as encoding for request from client and response to client. Every validations request from clients must be here so each request that sent to usecase is clear and valid.
This directory has function for how the service accessing and how the service receive request then return response. This package has policy to arrange how request can be sent by any kind of protocols
This directory is for create all business logic for the service. There is no more validation of the request from client. Moreover, this package is include like usecase, usecase test and usecase interface. Usecase test is for testing all business logic. It is using unit test
This package is consisted of mocking and testcase. Mocking is generated from repository interface moreover it has function for simulating action from real repository. Testcase is for collecting any scenarios of every single unit test. It is using array for collecting all scenarios and in unit test just loop for each scenario.
This package function is for configuration of any constant or variables that use in whole service.
This package is for create struct that will be used in repository and usecase
This package is utility package that can be used without initialization first