package
1.1.1
Repository: https://github.com/sunranlike/sunr.git
Documentation: pkg.go.dev

# Packages

Package cobra is a commander providing a simple interface to create powerful modern CLI interfaces.
No description provided by the author
No description provided by the author
Copyright 2021 jianfengye.
Copyright 2021 jianfengye.
No description provided by the author
No description provided by the author

# Functions

这个函数是干嘛的?我们需要将容器融入gin框架,所以在gin的Engine结构体中嵌入了一个container字段,他是framework.Container接口,所以我们需要一个结构体实现这个接口的方法。这就是我们的HadeContainer,上面的几个方法都是为了实现container接口为什么用一个函数?简洁?.

# Structs

HadeContainer 是服务容器的具体实现,服务可以注册入这个结构这个结构也会作为返回值返回给gin的engine字段的Container接口当然就需要这个结构体实现接口描述的方法.

# Interfaces

Container 是一个服务容器,提供绑定服务和获取服务的功能我们要在framework中定义container接口和provider接口并且要在框架文件夹内定义一个实现container接口的结构体。但是provide接口不需要在框架文件夹内实现这样实现了核心容器只有一个实现,而你的服务可以有多种实现。 .
ServiceProvider 定义一个服务提供者需要实现的接口这里只需要定义接口,不需要具体的结构体去实现,这就是服务容器——服务提供者模型的好处我们只需要实现容器接口,服务提供者可以在他处实现,实现了解绑比如说你想要实现一个缓存服务,你只需要按照服务提供者接口去实现即可扩展性好且不会侵入.

# Type aliases

No description provided by the author