freedom

package module
v1.7.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 18, 2020 License: Apache-2.0 Imports: 12 Imported by: 8

README

freedom

License Go Report Card Build Status GoDoc

freedom是一个基于六边形架构的框架,可以支撑充血的领域模型范式。

Overview

  • 集成iris v12
  • 集成普罗米修斯
  • 集成gorm
  • 链路追踪
  • infra容器 基于组件的基础设施
  • http2 server & client
  • 依赖注入&依赖倒置
  • CRUD 代码生成
  • DDD&六边形架构
  • 消息事件&事件重试&领域事件
  • 一级缓存&二级缓存&防击穿

安装

$ go get github.com/8treenet/freedom/freedom

创建项目

$ freedom new-project [project-name]

生成po 持久化对象

# 编辑 [project-name]/cmd/conf/db.toml 填入数据库地址
# 可指定配置地址和输出目录 freedom new-po -h 查看更多
$ cd [project-name]
$ freedom new-po

Example

基础教程
http2监听和依赖倒置
事务组件和自定义组件
消息事件和领域事件
一个完整的电商demo,包含CQRS、聚合、实体、领域事件、仓库、基础设施

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Configure added in v0.0.3

func Configure(obj interface{}, file string, must bool, metaData ...interface{})

Configure .

func HandleBusMiddleware added in v1.7.4

func HandleBusMiddleware(worker Worker)

func Logger

func Logger() *golog.Logger

Logger .

func Prepare added in v1.6.2

func Prepare(f func(Initiator))

Prepare .

func Prometheus added in v1.5.5

func Prometheus() *internal.Prometheus

Prometheus .

func SetConfigurer added in v1.6.9

func SetConfigurer(confer Configurer)

SetConfigurer .

Types

type Application

type Application interface {
	InstallGorm(f func() (db *gorm.DB))
	InstallRedis(f func() (client redis.Cmdable))
	InstallOther(f func() interface{})
	InstallMiddleware(handler iris.Handler)
	InstallParty(relativePath string)
	CreateH2CRunner(addr string, configurators ...host.Configurator) iris.Runner
	CreateRunner(addr string, configurators ...host.Configurator) iris.Runner
	Iris() *iris.Application
	Logger() *golog.Logger
	Run(serve iris.Runner, c iris.Configuration)
	InstallDomainEventInfra(eventInfra DomainEventInfra)
	Start(f func(starter Starter))
	InstallBusMiddleware(handle ...BusHandler)
	InstallSerializer(marshal func(v interface{}) ([]byte, error), unmarshal func(data []byte, v interface{}) error)
}

Application .

func NewApplication added in v1.0.5

func NewApplication() Application

NewApplication .

type BeforeActivation added in v1.7.1

type BeforeActivation = mvc.BeforeActivation

type Bus added in v1.6.2

type Bus = internal.Bus

type BusHandler added in v1.6.2

type BusHandler = internal.BusHandler

type Configuration added in v1.6.9

type Configuration = iris.Configuration

func DefaultConfiguration added in v1.6.9

func DefaultConfiguration() Configuration

type Configurer added in v1.6.9

type Configurer interface {
	Configure(obj interface{}, file string, must bool, metaData ...interface{})
}

type Context added in v1.3.0

type Context = iris.Context

type DomainEventInfra added in v1.3.7

type DomainEventInfra = internal.DomainEventInfra

type Entity added in v1.3.7

type Entity = internal.Entity

type GORMRepository

type GORMRepository = internal.GORMRepository

GORMRepository .

type Infra added in v1.3.0

type Infra = internal.Infra

Infra .

type Initiator

type Initiator = internal.Initiator

Initiator .

type QueryBuilder

type QueryBuilder = internal.QueryBuilder

QueryBuilder .

type Repository

type Repository = internal.Repository

Repository .

type Result added in v1.3.0

type Result = hero.Result

type SingleBoot added in v1.1.9

type SingleBoot = internal.SingleBoot

SingleBoot .

type Starter added in v1.6.2

type Starter = internal.Starter

type UnitTest added in v1.4.0

type UnitTest = internal.UnitTest

func NewUnitTest added in v1.4.0

func NewUnitTest() UnitTest

type Worker added in v1.7.1

type Worker = internal.Worker

Worker .

func ToWorker added in v1.7.1

func ToWorker(ctx Context) Worker

Directories

Path Synopsis
example
base/adapter/dto
Code generated by 'freedom new-project base'
Code generated by 'freedom new-project base'
base/adapter/po
Code generated by 'freedom new-project base'
Code generated by 'freedom new-project base'
base/adapter/repository
Code generated by 'freedom new-project base' Code generated by 'freedom new-project base'
Code generated by 'freedom new-project base' Code generated by 'freedom new-project base'
base/domain
Code generated by 'freedom new-project base'
Code generated by 'freedom new-project base'
base/infra
Code generated by 'freedom new-project base' Code generated by 'freedom new-project base' Code generated by 'freedom new-project base'
Code generated by 'freedom new-project base' Code generated by 'freedom new-project base' Code generated by 'freedom new-project base'
base/server
Code generated by 'freedom new-project base'
Code generated by 'freedom new-project base'
event-example/server
Code generated by 'freedom new-project event-example'
Code generated by 'freedom new-project event-example'
fshop/adapter/po
Code generated by 'freedom new-po' Code generated by 'freedom new-po' Code generated by 'freedom new-po' Code generated by 'freedom new-po' Code generated by 'freedom new-po' Code generated by 'freedom new-po' Code generated by 'freedom new-project fshop' Code generated by 'freedom new-po'
Code generated by 'freedom new-po' Code generated by 'freedom new-po' Code generated by 'freedom new-po' Code generated by 'freedom new-po' Code generated by 'freedom new-po' Code generated by 'freedom new-po' Code generated by 'freedom new-project fshop' Code generated by 'freedom new-po'
fshop/adapter/repository
Code generated by 'freedom new-po'
Code generated by 'freedom new-po'
fshop/infra
Code generated by 'freedom new-project fshop' Code generated by 'freedom new-project fshop' Code generated by 'freedom new-project fshop'
Code generated by 'freedom new-project fshop' Code generated by 'freedom new-project fshop' Code generated by 'freedom new-project fshop'
fshop/server
Code generated by 'freedom new-project fshop'
Code generated by 'freedom new-project fshop'
http2/adapter/po
Code generated by 'freedom new-project http2'
Code generated by 'freedom new-project http2'
http2/adapter/repositorys
Code generated by 'freedom new-project http2'
Code generated by 'freedom new-project http2'
http2/server
Code generated by 'freedom new-project http2'
Code generated by 'freedom new-project http2'
infra-example/adapter/dto
Code generated by 'freedom new-project infra-example'
Code generated by 'freedom new-project infra-example'
infra-example/adapter/po
Code generated by 'freedom new-po' Code generated by 'freedom new-po' Code generated by 'freedom new-project infra-example'
Code generated by 'freedom new-po' Code generated by 'freedom new-po' Code generated by 'freedom new-project infra-example'
infra-example/adapter/repository
Code generated by 'freedom new-po' Code generated by 'freedom new-project infra-example'
Code generated by 'freedom new-po' Code generated by 'freedom new-project infra-example'
infra-example/infra
Code generated by 'freedom new-project infra-example' Code generated by 'freedom new-project infra-example' Code generated by 'freedom new-project infra-example'
Code generated by 'freedom new-project infra-example' Code generated by 'freedom new-project infra-example' Code generated by 'freedom new-project infra-example'
infra-example/server
Code generated by 'freedom new-project infra-example'
Code generated by 'freedom new-project infra-example'
infra-example/server/conf
Code generated by 'freedom new-project infra-example'
Code generated by 'freedom new-project infra-example'
cmd
infra

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL