-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
274 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
*.dll | ||
*.so | ||
*.dylib | ||
|
||
.vscode | ||
# Test binary, built with `go test -c` | ||
*.test | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,43 @@ | ||
# Go-KGPKernel | ||
# Go-KGPKernel | ||
Go Virgin "ready-to-development-scale" Kernel for organizations following the Ker-G Pattern | ||
|
||
--- | ||
|
||
## Kernel's boundaries | ||
|
||
- The KGP Kernel's goal is to contain all of the business code of an application. | ||
- The KGP Kernel is agnostic of the context of use. | ||
- The Contextual Application (Web App, CLI, Desktop application, etc..) that uses the Kernel has to provide it with access to configuration attributes, external providers and the data persistence layer by implementing the interfaces *IConfigsManager*, *IProvidersManager* and *IRepositoriesManager*. | ||
|
||
|
||
--- | ||
|
||
## Layers' boundaries | ||
|
||
- Roles, Domains and Services are the layers of the kernel. | ||
- Roles, Domains and Services are each designed to be respectively developed in isolation from other objects of the same layer. | ||
|
||
- Roles are designed to be easily developped by different developpers in the same Kernel Repo. | ||
- Roles can make calls to Domains and Services. | ||
|
||
- Domains are designed to be developped outside the Kernel Repo (In order to be reused by different kernels) as well as inside the Kernel Repo. | ||
- Domains are Roles-agnostic and can make calls to Services. | ||
- Domains may have private Subdomains. | ||
|
||
- Services are Roles-agnostic and domains-agnostics. | ||
- Services are encapsulation for external service providers, external domains (Micro-services) and "domains" whose purpose is to serve other domains. | ||
|
||
## Tips for getting started | ||
|
||
From Scratch : | ||
- Copy/Past */Domains/_FooDomain* and start to develop domains. | ||
- Copy/Past */Services/_ExampleService* each time a domain need one. | ||
|
||
*more to come...* | ||
|
||
--- | ||
|
||
### Contact | ||
|
||
Do you want to know more about the KGP Kernel and the Ker-G Pattern? | ||
Please feel free to ping me at [@AlexandreGrdl](https://twitter.com/AlexandreGrdl "@AlexandreGrdl") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package domains | ||
|
||
import ( | ||
"agourdel.com/kgpkernel/domains/foodomain" | ||
) | ||
|
||
type DomainsManager struct { | ||
FooActions foodomain.FooActions | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package config | ||
|
||
type FooConfig struct { | ||
FirstValue int64 | ||
SecondValue string | ||
} | ||
|
||
func NewDefautFooConfig() *FooConfig { | ||
defautConfig := &FooConfig{ | ||
FirstValue: 42, | ||
SecondValue: "Defaut", | ||
} | ||
|
||
return defautConfig | ||
} | ||
|
||
func NewFooConfig(firstValue int64, secondValue string) *FooConfig { | ||
fooConfig := &FooConfig{ | ||
FirstValue: firstValue, | ||
SecondValue: secondValue, | ||
} | ||
|
||
return fooConfig | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package foodomain | ||
|
||
import ( | ||
"agourdel.com/kgpkernel/domains/foodomain/config" | ||
"agourdel.com/kgpkernel/domains/foodomain/interfaces" | ||
|
||
|
||
) | ||
|
||
type FooActions struct { | ||
fooConfig config.FooConfig | ||
fooRepositories interfaces.IFooRepositories | ||
fooService1 interfaces.IFooService1 | ||
} | ||
|
||
func newFooActions(fooConfig config.FooConfig, fooRepositories interfaces.IFooRepositories, fooService1 interfaces.IFooService1) *FooActions { | ||
mFooActions := &FooActions{ | ||
fooConfig: fooConfig, | ||
fooRepositories: fooRepositories, | ||
fooService1: fooService1, | ||
} | ||
|
||
return mFooActions | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package interfaces | ||
|
||
import ( | ||
"agourdel.com/kgpkernel/domains/foodomain/models" | ||
) | ||
|
||
type IFooRepositories interface { | ||
GetVirgins() []models.VirginModel | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package interfaces | ||
|
||
type IFooService1 interface { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package models | ||
|
||
type VirginModel struct { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module agourdel.com/kgpkernel | ||
|
||
go 1.22.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package interfaces | ||
|
||
import( | ||
FooConfig "agourdel.com/kgpkernel/domains/foodomain/config" | ||
ExampleConfig "agourdel.com/kgpkernel/services/exampleservice/config" | ||
) | ||
|
||
type IConfigsManager struct { | ||
FooConfig FooConfig.FooConfig | ||
ExampleConfig ExampleConfig.ExampleConfig | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package interfaces | ||
|
||
import( | ||
ExampleInterfaces "agourdel.com/kgpkernel/services/exampleservice/interfaces" | ||
) | ||
|
||
type IProvidersManager struct { | ||
ExampleProvider ExampleInterfaces.IExampleProvider | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package interfaces | ||
|
||
import ( | ||
FooInterfaces "agourdel.com/kgpkernel/domains/foodomain/interfaces" | ||
) | ||
|
||
type IRepositoriesManager struct { | ||
FooRepositories FooInterfaces.IFooRepositories | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package kgpkernel | ||
|
||
import( | ||
WaldoRole "agourdel.com/kgpkernel/roles/waldorole" | ||
KernelInterfaces "agourdel.com/kgpkernel/interfaces" | ||
KernelServices "agourdel.com/kgpkernel/services" | ||
KernelDomains "agourdel.com/kgpkernel/domains" | ||
) | ||
|
||
type Kernel struct { | ||
RepositoriesManager KernelInterfaces.IRepositoriesManager | ||
ProvidersManager KernelInterfaces.IProvidersManager | ||
ConfigManager KernelInterfaces.IConfigsManager | ||
ServicesManager KernelServices.ServicesManager | ||
DomainesManager KernelDomains.DomainsManager | ||
Roles RolesStruct | ||
} | ||
|
||
|
||
type RolesStruct struct { | ||
WaldoRole WaldoRole.WaldoRole | ||
} | ||
|
||
|
||
func newKernel( | ||
config KernelInterfaces.IConfigsManager, | ||
repositoriesManager KernelInterfaces.IRepositoriesManager, | ||
providersManager KernelInterfaces.IProvidersManager) *Kernel { | ||
|
||
kernel := &Kernel{ | ||
RepositoriesManager : repositoriesManager, | ||
ProvidersManager: providersManager, | ||
ConfigManager: config, | ||
ServicesManager: *KernelServices.NewServicesManager(config,providersManager), | ||
} | ||
|
||
return kernel | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package waldoroles | ||
|
||
import( | ||
KernelServices "agourdel.com/kgpkernel/services" | ||
KernelDomains "agourdel.com/kgpkernel/domains" | ||
KernelInterfaces "agourdel.com/kgpkernel/interfaces" | ||
) | ||
|
||
type WaldoRole struct { | ||
configManager KernelInterfaces.IConfigsManager | ||
servicesManager KernelServices.ServicesManager | ||
domainsManager KernelDomains.DomainsManager | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package config | ||
|
||
|
||
type ExampleConfig struct { | ||
FirstValue int64 | ||
SecondValue string | ||
} | ||
|
||
func NewDefautExampleConfig() *ExampleConfig { | ||
defautConfig := &ExampleConfig{ | ||
FirstValue: 42, | ||
SecondValue: "Defaut", | ||
} | ||
|
||
return defautConfig | ||
} | ||
|
||
func NewExampleConfig(firstValue int64, secondValue string) *ExampleConfig { | ||
exampleservice := &ExampleConfig{ | ||
FirstValue: firstValue, | ||
SecondValue: secondValue, | ||
} | ||
|
||
return exampleservice | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package exampleservice | ||
|
||
import ( | ||
"agourdel.com/kgpkernel/services/exampleservice/config" | ||
"agourdel.com/kgpkernel/services/exampleservice/interfaces" | ||
|
||
) | ||
|
||
type ExampleService struct { | ||
Config config.ExampleConfig | ||
Provider interfaces.IExampleProvider | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package interfaces | ||
|
||
type IExampleProvider struct { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package services | ||
|
||
import( | ||
KernelInterfaces "agourdel.com/kgpkernel/interfaces" | ||
ExampleService "agourdel.com/kgpkernel/services/exampleservice" | ||
) | ||
|
||
type ServicesManager struct { | ||
providersManager KernelInterfaces.IProvidersManager | ||
configsManager KernelInterfaces.IConfigsManager | ||
ExampleService ExampleService.ExampleService | ||
} | ||
|
||
func NewServicesManager( | ||
configsManager KernelInterfaces.IConfigsManager, | ||
providersManager KernelInterfaces.IProvidersManager) *ServicesManager { | ||
|
||
servicesManager := &ServicesManager{ | ||
providersManager: providersManager, | ||
configsManager: configsManager, | ||
ExampleService: ExampleService.ExampleService{ | ||
Config:configsManager.ExampleConfig, | ||
Provider:providersManager.ExampleProvider, | ||
}, | ||
} | ||
|
||
return servicesManager | ||
} |