feat(niki): new folder( tructure for developing branch

This commit is contained in:
Alireza Mokhtari Garakani 2023-12-20 11:57:13 +03:30
parent 193539f78d
commit c7debfefc6
56 changed files with 243 additions and 254 deletions

View File

@ -1,5 +0,0 @@
package main
func main() {
}

View File

@ -35,7 +35,7 @@ os.Setenv("EB_MULTI_WORD_VAR", "this is a multi-word var")
### 2. Initialization from `config.yml` ### 2. Initialization from `config.yml`
💡 Store variables which are `dependant to the environment` that code is running or the area, the variables that `change more frequent`. 💡 Add variables which are `dependant to the environment` that code is running or the area, the variables that `change more frequent`.
The package supports loading configurations from a YAML file named `config.yml`. Ensure the YAML file is in the correct format. The package supports loading configurations from a YAML file named `config.yml`. Ensure the YAML file is in the correct format.
@ -51,7 +51,7 @@ db:
### 3. Default Settings via `Default()` ### 3. Default Settings via `Default()`
💡 Store variables which they have `the least probability of change`. 💡 Add variables which they have `the least probability of change`.
The `Default()` function in the package allows defining default configurations that act as fallbacks. This function should return a `Config` struct. The `Default()` function in the package allows defining default configurations that act as fallbacks. This function should return a `Config` struct.
Example of defining default configurations: Example of defining default configurations:

View File

@ -2,10 +2,10 @@ package entity
import "time" import "time"
type PiggyBank struct { type KindBox struct {
ID uint ID uint
TotalAmount uint TotalAmount uint
RecieverId uint ReceiverId uint
SenderId uint SenderId uint
SerialNumber string SerialNumber string
Status uint Status uint

14
entity/kind_box_req.go Normal file
View File

@ -0,0 +1,14 @@
package entity
import "time"
type KindBoxReq struct {
ID uint
TypeId uint
CountRequested uint
CountAccepted uint
BenefactorID uint
Status uint
Description string
StatusChangedAt *time.Time
}

View File

@ -1,12 +0,0 @@
package entity
type ReqKindBox struct {
ID uint
TypeId uint
CountRequested uint
CountAccepted uint
NikokarId uint
Status uint
Description string
StatusChangedAt *time.Time
}

10
param/kind_box/add.go Normal file
View File

@ -0,0 +1,10 @@
package param
import "git.gocasts.ir/ebhomengo/niki/entity"
type KindBoxAddRequest struct {
KindBox entity.KindBox
}
type KindBoxAddResponse struct {
}

8
param/kind_box/delete.go Normal file
View File

@ -0,0 +1,8 @@
package param
type KindBoxDeleteRequest struct {
kindBoxID uint
}
type KindBoxDeleteResponse struct {
}

10
param/kind_box/get_all.go Normal file
View File

@ -0,0 +1,10 @@
package param
import "git.gocasts.ir/ebhomengo/niki/entity"
type KindBoxGetAllRequest struct {
}
type KindBoxGetAllResponse struct {
AllKindBox []entity.KindBox
}

View File

@ -0,0 +1,11 @@
package param
import "git.gocasts.ir/ebhomengo/niki/entity"
type KindBoxGetByIdRequest struct {
kindBoxID uint
}
type KindBoxGetByIdResponse struct {
entity.KindBox
}

11
param/kind_box/update.go Normal file
View File

@ -0,0 +1,11 @@
package param
import "git.gocasts.ir/ebhomengo/niki/entity"
type KindBoxUpdateRequest struct {
KindBox entity.KindBox
}
type KindBoxUpdateResponse struct {
KindBox entity.KindBox
}

11
param/kind_box_req/add.go Normal file
View File

@ -0,0 +1,11 @@
package param
import "git.gocasts.ir/ebhomengo/niki/entity"
type KindBoxReqAddRequest struct {
KindBoxReq entity.KindBoxReq
}
type KindBoxReqAddResponse struct {
KindBoxReq entity.KindBoxReq
}

View File

@ -0,0 +1,8 @@
package param
type KindBoxReqDeleteRequest struct {
kindBoxID uint
}
type KindBoxReqDeleteResponse struct {
}

View File

@ -0,0 +1,10 @@
package param
import "git.gocasts.ir/ebhomengo/niki/entity"
type KindBoxReqGetAllRequest struct {
}
type KindBoxReqGetAllResponse struct {
AllKindBoxReq []entity.KindBoxReq
}

View File

@ -0,0 +1,11 @@
package param
import "git.gocasts.ir/ebhomengo/niki/entity"
type KindBoxReqGetByIdRequest struct {
KindBoxReqID uint
}
type KindBoxReqGetByIdResponse struct {
entity.KindBoxReq
}

View File

@ -0,0 +1,11 @@
package param
import "git.gocasts.ir/ebhomengo/niki/entity"
type KindBoxReqUpdateRequest struct {
KindBoxReq entity.KindBoxReq
}
type KindBoxReqUpdateResponse struct {
KindBoxReq entity.KindBoxReq
}

View File

@ -1,7 +0,0 @@
package param
type PiggyBankDeleteRequest struct {
}
type PiggyBankDeleteResponse struct {
}

View File

@ -1,7 +0,0 @@
package param
type PiggyBankGetAllRequest struct {
}
type PiggyBankGetAllResponse struct {
}

View File

@ -1,7 +0,0 @@
package param
type PiggyBankGetByIdRequest struct {
}
type PiggyBankGetByIdResponse struct {
}

View File

@ -1,7 +0,0 @@
package param
type PiggyBankStoreRequest struct {
}
type PiggyBankStoreResponse struct {
}

View File

@ -1,7 +0,0 @@
package param
type PiggyBankUpdateRequest struct {
}
type PiggyBankUpdateResponse struct {
}

View File

@ -1,8 +0,0 @@
package param
type ReqKindBoxDeleteRequest struct {
reqKindBoxID uint
}
type ReqKindBoxDeleteResponse struct {
}

View File

@ -1,7 +0,0 @@
package param
type ReqKindBoxGetAllRequest struct {
}
type ReqKindBoxGetAllResponse struct {
}

View File

@ -1,8 +0,0 @@
package param
type ReqKindBoxGetByIdRequest struct {
reqKindBoxID uint
}
type ReqKindBoxGetByIdResponse struct {
}

View File

@ -1,10 +0,0 @@
package param
import "git.gocasts.ir/ebhomengo/niki/entity"
type ReqKindBoxStoreRequest struct {
reqKindBox entity.ReqKindBox
}
type ReqKindBoxStoreResponse struct {
}

View File

@ -1,11 +0,0 @@
package param
import "git.gocasts.ir/ebhomengo/niki/entity"
type ReqKindBoxUpdateRequest struct {
reqKindBoxID uint
reqKindBox entity.ReqKindBox
}
type ReqKindBoxUpdateResponse struct {
}

View File

@ -1,4 +1,4 @@
package mysqlpiggybank package mysqlkindBoxbank
import "git.gocasts.ir/ebhomengo/niki/repository/mysql" import "git.gocasts.ir/ebhomengo/niki/repository/mysql"

View File

@ -1 +1 @@
package mysqlpiggybank package mysqlkindBoxbank

10
service/kind_box/add.go Normal file
View File

@ -0,0 +1,10 @@
package kindboxservice
import (
param "git.gocasts.ir/ebhomengo/niki/param/kind_box"
)
func (s Service) Add(newKindBoxReq param.KindBoxAddRequest) (param.KindBoxAddResponse, error) {
// some code
panic("not implemented")
}

View File

@ -0,0 +1,7 @@
package kindboxservice
import param "git.gocasts.ir/ebhomengo/niki/param/kind_box"
func (s Service) Delete(kindBoxId param.KindBoxDeleteRequest) error {
panic("not implemented")
}

View File

@ -0,0 +1,7 @@
package kindboxservice
import param "git.gocasts.ir/ebhomengo/niki/param/kind_box"
func (s Service) GetAll() (param.KindBoxGetAllResponse, error) {
panic("not implement")
}

View File

@ -0,0 +1,7 @@
package kindboxservice
import param "git.gocasts.ir/ebhomengo/niki/param/kind_box"
func (s Service) GetById(request param.KindBoxGetByIdRequest) (param.KindBoxGetByIdResponse, error) {
panic("not implement")
}

View File

@ -0,0 +1,21 @@
package kindboxservice
import "git.gocasts.ir/ebhomengo/niki/entity"
type Repository interface {
AddKindBox(kindBox entity.KindBox) (entity.KindBox, error)
EditKindBox(kindBoxID uint, kindBoxInput entity.KindBox) (entity.KindBox, error)
DeleteKindBox(kindBoxID uint) error
GetAllKindBox() ([]entity.KindBox, error)
GetKindBoxByID(kindBox uint) (entity.KindBox, error)
}
type Service struct {
repo Repository
}
func New(repository Repository) Service {
return Service{
repo: repository,
}
}

View File

@ -0,0 +1,9 @@
package kindboxservice
import (
param "git.gocasts.ir/ebhomengo/niki/param/kind_box"
)
func (s Service) Update(updatedKindBox param.KindBoxUpdateRequest) (param.KindBoxUpdateResponse, error) {
panic("not implement")
}

View File

@ -0,0 +1,10 @@
package kindboxservice
import (
param "git.gocasts.ir/ebhomengo/niki/param/kind_box_req"
)
func (s Service) Add(newKindBoxReq param.KindBoxReqAddRequest) (param.KindBoxReqAddResponse, error) {
// some code
panic("not implemented")
}

View File

@ -0,0 +1,7 @@
package kindboxservice
import param "git.gocasts.ir/ebhomengo/niki/param/kind_box_req"
func (s Service) Delete(kindBoxReqId param.KindBoxReqDeleteRequest) error {
panic("not implemented")
}

View File

@ -0,0 +1,7 @@
package kindboxservice
import param "git.gocasts.ir/ebhomengo/niki/param/kind_box_req"
func (s Service) GetAll() (param.KindBoxReqGetAllResponse, error) {
panic("not implement")
}

View File

@ -0,0 +1,7 @@
package kindboxservice
import param "git.gocasts.ir/ebhomengo/niki/param/kind_box_req"
func (s Service) GetById(request param.KindBoxReqGetByIdRequest) (param.KindBoxReqGetByIdResponse, error) {
panic("not implement")
}

View File

@ -0,0 +1,21 @@
package kindboxservice
import "git.gocasts.ir/ebhomengo/niki/entity"
type Repository interface {
AddKindBoxReq(kindBoxReq entity.KindBoxReq) (entity.KindBoxReq, error)
EditKindBoxReq(kindBoxReqID uint, kindBoxReqInput entity.KindBoxReq) (entity.KindBoxReq, error)
DeleteKindBoxReq(kindBoxReqID uint) error
GetAllKindBoxReq() ([]entity.KindBoxReq, error)
GetKindBoxReqByID(kindBoxReq uint) (entity.KindBoxReq, error)
}
type Service struct {
repo Repository
}
func New(repository Repository) Service {
return Service{
repo: repository,
}
}

View File

@ -0,0 +1,9 @@
package kindboxservice
import (
param "git.gocasts.ir/ebhomengo/niki/param/kind_box_req"
)
func (s Service) Update(updatedKindBoxReq param.KindBoxReqUpdateRequest) (param.KindBoxReqUpdateResponse, error) {
panic("not implement")
}

View File

@ -1,7 +0,0 @@
package piggybankservice
import "git.gocasts.ir/ebhomengo/niki/param"
func (s Service) Delete(req param.PiggyBankDeleteRequest) (param.PiggyBankDeleteResponse, error) {
return param.PiggyBankDeleteResponse{}, nil
}

View File

@ -1,7 +0,0 @@
package piggybankservice
import "git.gocasts.ir/ebhomengo/niki/param"
func (s Service) GetAll(req param.PiggyBankGetAllRequest) (param.PiggyBankGetAllResponse, error) {
return param.PiggyBankGetAllResponse{}, nil
}

View File

@ -1,7 +0,0 @@
package piggybankservice
import "git.gocasts.ir/ebhomengo/niki/param"
func (s Service) GetById(req param.PiggyBankGetByIdRequest) (param.PiggyBankGetByIdResponse, error) {
return param.PiggyBankGetByIdResponse{}, nil
}

View File

@ -1,21 +0,0 @@
package piggybankservice
import "git.gocasts.ir/ebhomengo/niki/entity"
type Repository interface {
AddPiggyBank(piggy entity.PiggyBank) (entity.PiggyBank, error)
EditPiggyBank(piggyID uint, piggyBankInput entity.PiggyBank) (entity.PiggyBank, error)
DeletePiggyBank(piggyID uint) error
GetAllPiggyBank() ([]entity.PiggyBank, error)
GetPiggyBankByID(piggyBank uint) (entity.PiggyBank, error)
}
type Service struct {
repo Repository
}
func New(repository Repository) Service {
return Service{
repo: repository,
}
}

View File

@ -1,7 +0,0 @@
package piggybankservice
import "git.gocasts.ir/ebhomengo/niki/param"
func (s Service) Store(req param.PiggyBankStoreRequest) (param.PiggyBankStoreResponse, error) {
return param.PiggyBankStoreResponse{}, nil
}

View File

@ -1,7 +0,0 @@
package piggybankservice
import "git.gocasts.ir/ebhomengo/niki/param"
func (s Service) Update(req param.PiggyBankUpdateRequest) (param.PiggyBankUpdateResponse, error) {
return param.PiggyBankUpdateResponse{}, nil
}

View File

@ -1,7 +0,0 @@
package reqkindboxservice
import "git.gocasts.ir/ebhomengo/niki/param"
func (s Service) Delete(req param.ReqKindBoxDeleteRequest) (param.ReqKindBoxDeleteResponse, error) {
return param.ReqKindBoxDeleteResponse{}, nil
}

View File

@ -1,7 +0,0 @@
package reqkindboxservice
import "git.gocasts.ir/ebhomengo/niki/param"
func (s Service) GetAll(req param.ReqKindBoxGetAllRequest) (param.ReqKindBoxGetAllResponse, error) {
return param.ReqKindBoxGetAllResponse{}, nil
}

View File

@ -1,7 +0,0 @@
package reqkindboxservice
import "git.gocasts.ir/ebhomengo/niki/param"
func (s Service) GetById(req param.ReqKindBoxGetByIdRequest) (param.ReqKindBoxGetByIdResponse, error) {
return param.ReqKindBoxGetByIdResponse{}, nil
}

View File

@ -1,21 +0,0 @@
package reqkindboxservice
import "git.gocasts.ir/ebhomengo/niki/entity"
type Repository interface {
AddReqKindBox(reqKindBox entity.ReqKindBox) (entity.ReqKindBox, error)
EditReqKindBox(reqKindBoxID uint, reqKindBox entity.ReqKindBox) (entity.ReqKindBox, error)
DeleteReqKindBox(reqKindBoxID uint) error
GetAllReqKindBox() ([]entity.ReqKindBox, error)
GetReqKindBoxByID(reqKindBoxID uint) (entity.ReqKindBox, error)
}
type Service struct {
repo Repository
}
func New(repository Repository) Service {
return Service{
repo: repository,
}
}

View File

@ -1,7 +0,0 @@
package reqkindboxservice
import "git.gocasts.ir/ebhomengo/niki/param"
func (s Service) Store(req param.ReqKindBoxStoreRequest) (param.ReqKindBoxStoreResponse, error) {
return param.ReqKindBoxStoreResponse{}, nil
}

View File

@ -1,7 +0,0 @@
package reqkindboxservice
import "git.gocasts.ir/ebhomengo/niki/param"
func (s Service) Update(req param.ReqKindBoxUpdateRequest) (param.ReqKindBoxUpdateResponse, error) {
return param.ReqKindBoxUpdateResponse{}, nil
}

View File

@ -1,7 +0,0 @@
package piggybankvalidator
import "git.gocasts.ir/ebhomengo/niki/param"
func (v Validator) ValidateDeleteRequest(req param.PiggyBankDeleteRequest) {
}

View File

@ -1,7 +0,0 @@
package piggybankvalidator
import "git.gocasts.ir/ebhomengo/niki/param"
func (v Validator) ValidateGetByIdRequest(req param.PiggyBankGetByIdRequest) {
}

View File

@ -1,7 +0,0 @@
package piggybankvalidator
import "git.gocasts.ir/ebhomengo/niki/param"
func (v Validator) ValidateStoreRequest(req param.PiggyBankStoreRequest) {
}

View File

@ -1,7 +0,0 @@
package piggybankvalidator
import "git.gocasts.ir/ebhomengo/niki/param"
func (v Validator) ValidateUpdateRequest(req param.PiggyBankUpdateRequest) {
}

View File

@ -1,12 +0,0 @@
package piggybankvalidator
type Repository interface {
}
type Validator struct {
repo Repository
}
func New(repo Repository) Validator {
return Validator{repo: repo}
}