首页>国内 > 正文

Farseer-Go,一个模块化的完整基础设施框架

2023-01-06 09:17:24来源:程序员升职加薪之旅

概述文档(国内)[1]文档(国外)[2]开源(Github)[3]什么是farseer-go

基于Golang模块化完整的基础设施框架,创建现代化Web应用和APIs。

使用目前最为流行的组件,并用模块化技术来提供这些组件。


(资料图片仅供参考)

框架完美支持DDD领域驱动​的战术设计,如仓储资源库、应用层事务、领域事件、应用层动态WebAPI。

它有一个.net core[4]成熟版本,已经使用了10多年,非常棒

不用担心框架会让你依赖过多的包,farseer-go的组件都是独立的包,不使用的包不会下载到您的应用程序中

每个组件都是单独的包,因此版本号也是单独发布的

有什么特点?统一配置​:所有的配置被整合到./farseer.yaml优雅:所有的模块都遵循开发者体验优先为原则。模块化:供了完整的模块化系统,使你能够开发可重复使用的应用程序模块。领域驱动:帮助你实现基于DDD的分层架构并构建可维护的代码库。链路追踪(下个版本推出):如果您使用框架中的Orm、Redis、Http、Grpc、ES、MQ、EventBus、Task、FSS,将隐式为您实现链路追踪,并提供API请求日志、慢查询。

结合FOPS[5]项目(自动构建、链路追踪控制台、K8S集群日志收集)支持代码无侵入的全链路实时监控。

集成的组件

包名

描述

地址

fs

基础核心包

​​https://github.com/farseer-go/fs​​

collections

数据集合

​​https://github.com/farseer-go/collections​​

webapi

web api服务

​​https://github.com/farseer-go/webapi​​

async

异步编程

​​https://github.com/farseer-go/async​​

mapper

对象转换

​​https://github.com/farseer-go/mapper​​

cacheMemory

本地缓存

​​https://github.com/farseer-go/cacheMemory​​

redis

client

​​https://github.com/farseer-go/redis​​

data

数据库ORM

​​https://github.com/farseer-go/data​​

elasticSearch

client

​​https://github.com/farseer-go/elasticSearch​​

eventBus

事件总线

​​https://github.com/farseer-go/eventBus​​

queue

本地队列

​​https://github.com/farseer-go/queue​​

tasks

本地任务

​​https://github.com/farseer-go/tasks​​

fss

分布试调度client

​​https://github.com/farseer-go/fss​​

utils

工具集

​​https://github.com/farseer-go/utils​​

如何开始main.go
package mainimport "github.com/farseer-go/fs"func main() {   fs.Initialize[StartupModule]("your project Name")}

在main函数第一行,执行fs.Initialize,开始初始化框架

运行后控制台打印加载信息:

2022-12-01 17:07:24 应用名称:your project Name2022-12-01 17:07:24 主机名称:MacBook-Pro.local2022-12-01 17:07:24 系统时间:2022-12-01 17:07:242022-12-01 17:07:24   进程ID:61232022-12-01 17:07:24   应用ID:1933370229638184962022-12-01 17:07:24   应用IP:192.168.1.42022-12-01 17:07:24 ---------------------------------------2022-12-01 17:07:24 加载模块...2022-12-01 17:07:24 加载模块:webapi.Module2022-12-01 17:07:24 加载模块:domain.Module2022-12-01 17:07:24 加载模块:application.Module2022-12-01 17:07:24 加载模块:interfaces.Module2022-12-01 17:07:24 加载模块:data.Module2022-12-01 17:07:24 加载模块:eventBus.Module2022-12-01 17:07:24 加载模块:queue.Module2022-12-01 17:07:24 加载模块:infrastructure.Module2022-12-01 17:07:24 加载模块:main.StartupModule2022-12-01 17:07:24 加载完毕,共加载 10 个模块2022-12-01 17:07:24 ---------------------------------------2022-12-01 17:07:24 初始化完毕,共耗时:1 ms 2022-12-01 17:07:24 ---------------------------------------2022-12-01 17:07:24 [Info] Web服务已启动:http://localhost:8888/
参考资料

[1]文档(国内):https://farseer-go.gitee.io/

[2]文档(国外):https://farseer-go.github.io/doc/

[3]开源(Github):https://github.com/farseer-go/fs

[4].net core:https://github.com/FarseerNet/Farseer.Net/

[5]FOPS:https://github.com/FarseerNet/FOPS

本文转载自微信公众号「 程序员升级打怪之旅」,作者「王中阳Go」,可以通过以下二维码关注。

转载本文请联系「 程序员升级打怪之旅」公众号。

关键词: 基础设施 应用程序 系统时间 可重复使用 实时监控

相关新闻

Copyright 2015-2020   三好网  版权所有 联系邮箱:435 22 640@qq.com  备案号: 京ICP备2022022245号-21