forked from ebhomengo/niki
feat(niki): new folder( tructure for developing branch
This commit is contained in:
parent
193539f78d
commit
c7debfefc6
|
@ -1,5 +0,0 @@
|
|||
package main
|
||||
|
||||
func main() {
|
||||
|
||||
}
|
|
@ -35,7 +35,7 @@ os.Setenv("EB_MULTI_WORD_VAR", "this is a multi-word var")
|
|||
|
||||
### 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.
|
||||
|
||||
|
@ -51,7 +51,7 @@ db:
|
|||
|
||||
### 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.
|
||||
|
||||
Example of defining default configurations:
|
||||
|
|
|
@ -2,10 +2,10 @@ package entity
|
|||
|
||||
import "time"
|
||||
|
||||
type PiggyBank struct {
|
||||
type KindBox struct {
|
||||
ID uint
|
||||
TotalAmount uint
|
||||
RecieverId uint
|
||||
ReceiverId uint
|
||||
SenderId uint
|
||||
SerialNumber string
|
||||
Status uint
|
|
@ -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
|
||||
}
|
|
@ -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
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package param
|
||||
|
||||
import "git.gocasts.ir/ebhomengo/niki/entity"
|
||||
|
||||
type KindBoxAddRequest struct {
|
||||
KindBox entity.KindBox
|
||||
}
|
||||
|
||||
type KindBoxAddResponse struct {
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package param
|
||||
|
||||
type KindBoxDeleteRequest struct {
|
||||
kindBoxID uint
|
||||
}
|
||||
|
||||
type KindBoxDeleteResponse struct {
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package param
|
||||
|
||||
import "git.gocasts.ir/ebhomengo/niki/entity"
|
||||
|
||||
type KindBoxGetAllRequest struct {
|
||||
}
|
||||
|
||||
type KindBoxGetAllResponse struct {
|
||||
AllKindBox []entity.KindBox
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package param
|
||||
|
||||
import "git.gocasts.ir/ebhomengo/niki/entity"
|
||||
|
||||
type KindBoxGetByIdRequest struct {
|
||||
kindBoxID uint
|
||||
}
|
||||
|
||||
type KindBoxGetByIdResponse struct {
|
||||
entity.KindBox
|
||||
}
|
|
@ -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
|
||||
}
|
|
@ -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
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package param
|
||||
|
||||
type KindBoxReqDeleteRequest struct {
|
||||
kindBoxID uint
|
||||
}
|
||||
|
||||
type KindBoxReqDeleteResponse struct {
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package param
|
||||
|
||||
import "git.gocasts.ir/ebhomengo/niki/entity"
|
||||
|
||||
type KindBoxReqGetAllRequest struct {
|
||||
}
|
||||
|
||||
type KindBoxReqGetAllResponse struct {
|
||||
AllKindBoxReq []entity.KindBoxReq
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package param
|
||||
|
||||
import "git.gocasts.ir/ebhomengo/niki/entity"
|
||||
|
||||
type KindBoxReqGetByIdRequest struct {
|
||||
KindBoxReqID uint
|
||||
}
|
||||
|
||||
type KindBoxReqGetByIdResponse struct {
|
||||
entity.KindBoxReq
|
||||
}
|
|
@ -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
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
package param
|
||||
|
||||
type PiggyBankDeleteRequest struct {
|
||||
}
|
||||
|
||||
type PiggyBankDeleteResponse struct {
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
package param
|
||||
|
||||
type PiggyBankGetAllRequest struct {
|
||||
}
|
||||
|
||||
type PiggyBankGetAllResponse struct {
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
package param
|
||||
|
||||
type PiggyBankGetByIdRequest struct {
|
||||
}
|
||||
|
||||
type PiggyBankGetByIdResponse struct {
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
package param
|
||||
|
||||
type PiggyBankStoreRequest struct {
|
||||
}
|
||||
|
||||
type PiggyBankStoreResponse struct {
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
package param
|
||||
|
||||
type PiggyBankUpdateRequest struct {
|
||||
}
|
||||
|
||||
type PiggyBankUpdateResponse struct {
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
package param
|
||||
|
||||
type ReqKindBoxDeleteRequest struct {
|
||||
reqKindBoxID uint
|
||||
}
|
||||
|
||||
type ReqKindBoxDeleteResponse struct {
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
package param
|
||||
|
||||
type ReqKindBoxGetAllRequest struct {
|
||||
}
|
||||
|
||||
type ReqKindBoxGetAllResponse struct {
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
package param
|
||||
|
||||
type ReqKindBoxGetByIdRequest struct {
|
||||
reqKindBoxID uint
|
||||
}
|
||||
|
||||
type ReqKindBoxGetByIdResponse struct {
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
package param
|
||||
|
||||
import "git.gocasts.ir/ebhomengo/niki/entity"
|
||||
|
||||
type ReqKindBoxStoreRequest struct {
|
||||
reqKindBox entity.ReqKindBox
|
||||
}
|
||||
|
||||
type ReqKindBoxStoreResponse struct {
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
package param
|
||||
|
||||
import "git.gocasts.ir/ebhomengo/niki/entity"
|
||||
|
||||
type ReqKindBoxUpdateRequest struct {
|
||||
reqKindBoxID uint
|
||||
reqKindBox entity.ReqKindBox
|
||||
}
|
||||
|
||||
type ReqKindBoxUpdateResponse struct {
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package mysqlpiggybank
|
||||
package mysqlkindBoxbank
|
||||
|
||||
import "git.gocasts.ir/ebhomengo/niki/repository/mysql"
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
package mysqlpiggybank
|
||||
package mysqlkindBoxbank
|
||||
|
|
|
@ -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")
|
||||
}
|
|
@ -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")
|
||||
}
|
|
@ -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")
|
||||
}
|
|
@ -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")
|
||||
}
|
|
@ -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,
|
||||
}
|
||||
}
|
|
@ -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")
|
||||
}
|
|
@ -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")
|
||||
}
|
|
@ -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")
|
||||
}
|
|
@ -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")
|
||||
}
|
|
@ -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")
|
||||
}
|
|
@ -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,
|
||||
}
|
||||
}
|
|
@ -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")
|
||||
}
|
|
@ -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
|
||||
}
|
|
@ -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
|
||||
}
|
|
@ -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
|
||||
}
|
|
@ -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,
|
||||
}
|
||||
}
|
|
@ -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
|
||||
}
|
|
@ -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
|
||||
}
|
|
@ -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
|
||||
}
|
|
@ -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
|
||||
}
|
|
@ -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
|
||||
}
|
|
@ -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,
|
||||
}
|
||||
}
|
|
@ -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
|
||||
}
|
|
@ -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
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
package piggybankvalidator
|
||||
|
||||
import "git.gocasts.ir/ebhomengo/niki/param"
|
||||
|
||||
func (v Validator) ValidateDeleteRequest(req param.PiggyBankDeleteRequest) {
|
||||
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
package piggybankvalidator
|
||||
|
||||
import "git.gocasts.ir/ebhomengo/niki/param"
|
||||
|
||||
func (v Validator) ValidateGetByIdRequest(req param.PiggyBankGetByIdRequest) {
|
||||
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
package piggybankvalidator
|
||||
|
||||
import "git.gocasts.ir/ebhomengo/niki/param"
|
||||
|
||||
func (v Validator) ValidateStoreRequest(req param.PiggyBankStoreRequest) {
|
||||
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
package piggybankvalidator
|
||||
|
||||
import "git.gocasts.ir/ebhomengo/niki/param"
|
||||
|
||||
func (v Validator) ValidateUpdateRequest(req param.PiggyBankUpdateRequest) {
|
||||
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
package piggybankvalidator
|
||||
|
||||
type Repository interface {
|
||||
}
|
||||
|
||||
type Validator struct {
|
||||
repo Repository
|
||||
}
|
||||
|
||||
func New(repo Repository) Validator {
|
||||
return Validator{repo: repo}
|
||||
}
|
Loading…
Reference in New Issue