biz_ext_framework is a repository for reusable business extension components.
Components are organized by top-level directories. Some directories are already independent Go modules, and some are placeholders reserved for follow-up work.
Modules in this repository can be used in two ways:
- use low-level modules independently, without pulling in other modules
- use
service_manageras the service-side integration layer that wires several modules together
service_manager currently integrates:
biz_componentbiz_ctxbiz_identitybiz_observationbiz_processext_model
Those lower-level modules do not depend on each other and can still be used separately.
+-------------------+
| service_manager |
| integration |
+-------------------+
/ / | \ \
v v v v v
+-----------+ +-----------+ +-----------+ +-----------+ +-----------+
| biz_ctx | |biz_identity| |biz_observ.| |biz_process| | ext_model |
|session ctx| |identity wl | |log/metric/| |multi- | |model |
| | | | |trace | |process | |filter |
+-----------+ +-----------+ +-----------+ +-----------+ +-----------+
Independent usage:
biz_component biz_ctx biz_identity biz_observation biz_process ext_model ext_spi ext_process ext_interceptor
| | | | | | | | |
+------------+----------+--------------+--------------+------------+---------+---------+----------------+
each module can be used alone
biz_component/: independent Go module for IOC-style business component managementbiz_ctx/: independent Go module for business context componentsbiz_identity/: independent Go module for business identity abstractionsbiz_observation/: independent Go module for business observation utilitiesbiz_process/: independent Go module for business process FSMext_interceptor/: independent Go module for extension interceptor abstractionsext_model/: independent Go module for extension model abstractionsext_process/: independent Go module for extension process templateext_spi/: independent Go module for SPI template abstractionsservice_manager/: independent Go module for service-side integration and container managementMakefile: repository-level helper targetsgo.mod: repository-level Go module definition
service_manager provides a service-side integration layer built on top of other reusable modules:
ServiceManager: service instance lifecycle managementServiceManagerBuilder: container initialization and service constructionComponentContainer: IOC component managementCtxContainer: business session context managementIdentityContainer: business identity whitelist managementObservationContainer: log / metrics / trace dependency managementProcessContainer: multiple named process orchestration managementSPIContainer: extension definition to implementation managementExtProcessContainer: extension process definition to implementation managementInterceptorContainer: interceptor definition to implementation managementModelContainer: outbound RPC ext model whitelist filtering
Documentation:
- English:
service_manager/README.md - 中文:
service_manager/README-ZH.md
ext_model provides a generic, concurrency-safe model map abstraction:
ExtObj: value contract withKey() stringExtModel[V]: map behavior interfaceExtMap[V]: default implementationCopyExtMap: copy helper withWithDeepCopyandWithKeyFilter
Documentation:
- English:
ext_model/README.md - 中文:
ext_model/README-ZH.md
biz_component provides IOC-style business component management:
ContainerServiceScopeSessionScopeProviderResolver
Documentation:
- English:
biz_component/README.md - 中文:
biz_component/README-ZH.md
biz_identity provides a technical component for business identity abstractions:
BizIdentityParserValidator
Documentation:
- English:
biz_identity/README.md - 中文:
biz_identity/README-ZH.md
biz_observation provides lightweight observation utilities:
log_utilmetrics_utiltrace_utilobservation_util
Documentation:
- English:
biz_observation/README.md - 中文:
biz_observation/README-ZH.md
biz_process provides process orchestration components:
- FSM
- BPMN-like serial-layer / parallel-node orchestration
- DAG orchestration
Documentation:
- English:
biz_process/README.md - 中文:
biz_process/README-ZH.md
ext_process provides a generic extension process template:
Mode(Serial,Parallel)TemplateMatchFuncProcessFunc(withcontinueNextsupport in serial mode)
Documentation:
- English:
ext_process/README.md - 中文:
ext_process/README-ZH.md
ext_spi provides a generic SPI template with four modes:
FirstAllFirstMatchedAllMatched
Documentation:
- English:
ext_spi/README.md - 中文:
ext_spi/README-ZH.md
ext_interceptor provides a generic interceptor template abstraction:
HandlerTemplateMatchFuncInterceptFunc
Documentation:
- English:
ext_interceptor/README.md - 中文:
ext_interceptor/README-ZH.md
package main
import (
"fmt"
"github.com/daidai21/biz_ext_framework/ext_model"
)
type User struct {
ID string
Name string
}
func (u User) Key() string {
return u.ID
}
func main() {
var users ext_model.ExtModel[User] = &ext_model.ExtMap[User]{}
users.Set(User{ID: "u1", Name: "Alice"})
user, ok := users.Get("u1")
fmt.Println(user.Name, ok)
}Run tests from the target module directory:
cd ext_model && go test ./...Repository-level helper target:
make statistics_lines