8treenet / freedom Goto Github PK
View Code? Open in Web Editor NEWFreedom是一个基于六边形架构的框架,可以支撑充血的领域模型范式。
License: Apache License 2.0
Freedom是一个基于六边形架构的框架,可以支撑充血的领域模型范式。
License: Apache License 2.0
Worker().Store().Set("freedom_local_transaction_db", t.db),把事务对象都用一个key:freedom_local_transaction_db 存的话,并发请求时,获取的都是同一个,难道不会有问题吗?还是我的理解有问题,可以解答一下吗
如果要写UT的话,运行时对象Worker要怎么mock?
Limit all lines to around 80 characters.
Example:
Good.
Example:
// Hello, Li. I've released a new version of the project, would you like to make
// code view for it?
It is exactly 80 characters in the first line.
Good.
Example:
// Let's have a good dinner this Friday, Li? I heard a new restaurant is open from
// my friend.
It is 82 characters in the first line, but it is acceptable.
It is NOT REQUIRED that you MUST limit each line <= 80 characters.
For example, you've been typed 74 characters until "is", and your next word is "open". If it is required each line
must <= 80 characters, you may not discover that it has been exceeded 80 characters before "open" has typed,
therefore you must back to the start position of "open" and insert a newline to content the rule. So, it will lead to
a bad experience in coding if it required each line MUST <= 80 characters.
Bad.
// I didn't know what I want to say, emmmm... Write some words here to make up. Aha,
// it has been finished.
It is 84 characters in the first line (includes punctuations), but it is not acceptable.
Why is it? After the word "make up" you've typed, you would directly know from the editor that it is 78 characters
you've typed in this line. Whatever the next word is, you should realize you MUST insert a newline here, because of
no words that consist of 1 character only. Even if you want to type a letter in the next position, you should also
insert a newline for tidy. So, remember, whatever the next word is, if what you've typed is closed to 80 characters,
insert a newline here, just for tidy.
个人疑问:
因为我个人没有这种六边形模式,比较经常用的是贫血模式。我们一般在po层不会有业务逻辑。
链接地址:https://github.com/8treenet/freedom/tree/master/example/fshop/domain/po
// FetchDB .
func (repo *Repository) FetchDB(db interface{}) error {
resultDB := globalApp.Database.db
transactionData := repo.worker.Store().Get(TransactionKey)
if transactionData != nil {
resultDB = transactionData
}
if resultDB == nil {
return errors.New("DB not found, please install")
}
if !fetchValue(db, resultDB) {
return errors.New("DB not found, please install")
}
// db = globalApp.Database.db.New()
// db.SetLogger(repo.Worker.Logger())
return nil
}
这里拿到的事务,在并发请求情况下是否也会拿取到其他请求的事务?
没有看到文档中提及是否有在生产中大量使用、谁在使用、性能怎么样
一个领域服务对应一个实体吗?跨实体的行为通过聚合根工厂来完成?是这么理解的吗
理解了依赖倒置,但是不知道怎么进行DI。作者可以指明一下freedom中的做法吗?目前没找到框架是怎么进行依赖注入的
我自己做的项目现在通过依赖倒置完成了repo接口和repo实现,但是不知道怎么做DI,卡在这里了。希望解答下,感谢
欢迎大家入群交流Golang领域驱动设计!
该群是freedom作者八叉树与各位golang DDD爱好者交流的基地!
app := freedom.NewApplication()
app.Iris().Use(func(ctx iris.Context) {
ctx.Header("Access-Control-Allow-Origin", "*")
ctx.Header("Access-Control-Allow-Credentials", "true")
ctx.Header("Access-Control-Allow-Headers", "*")
ctx.Header("Access-Control-Allow-Methods", "POST, OPTIONS, GET, PUT, DELETE")
if ctx.Method() == "OPTIONS" {
ctx.StatusCode(http.StatusOK)
return
}
ctx.Next()
})
app.Iris().AllowMethods(iris.MethodOptions)
这样做好像没有解决
疑问:
1、示例中把多个领域的代码放到了一个domain下,为什么不拆分成多个domain呢?
例如 domain/user domain/order domain/goods,每个domain只暴露service给controller调用
2、放在一个domain下当拆分成微服务时候是不是很麻烦呢?
3、聚合服务该怎么分层呢?比如下单操作同时依赖用户服务、商品服务、库存服务和订单服务等,这个服务要单独拆出来吗?还是直接写在订单服务里面?这样是不是就依赖了其他服务了?还是说调用其他服务的api方式来解决呢?
望解惑,谢谢。
能否将cqrs部分单独抽出来独立于DDD、ES及任何框架,单独作为一个tool使用呢?
最近公司有了新项目,正在考虑框架选取的事
在根目录增加scripts目录,用于开发项目时验证修改是否无误,包括测试、覆盖率检查等脚本 | Add 'scripts' directory to validate project for developer, which include test, coverage, etc.
缓存组件里可以设置redis换成过期时间,一级的本地缓存过期时间不需要设置吗
能否增加支持grpc、es等
资源库和领域服务一一对应,通过聚合和聚合根来整合,从使用的角度上来说,资源库对于关系型数据库的联表查询都被拆成了单个查询了,这样是不是不大适用于关系型数据库呢?还是有什么其他考量
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.