Documentation ¶
Index ¶
- Constants
- func ApiPathPrefix(pathPrefix string, obj Object) string
- func ConfigIocObject(req *LoadConfigRequest) error
- func DevelopmentSetup(req *LoadConfigRequest)
- func GetIocObjectUid(obj Object) (name, version string)
- func GinApiPathPrefix(pathPrefix string, obj Object) string
- func GrpcControllerCount() int
- func LoadGinApi(pathPrefix string, root gin.IRouter)
- func LoadGoRestfulApi(pathPrefix string, root *restful.Container)
- func LoadGrpcController(server *grpc.Server)
- func ObjectUid(o *ObjectWrapper) string
- func ValidateFileType(ext string) error
- type GRPCControllerObject
- type GetOption
- type GinApiObject
- type GoRestfulApiObject
- type InjectTag
- type LoadConfigRequest
- type NamespaceStore
- func (i *NamespaceStore) Autowire() error
- func (s *NamespaceStore) Close(ctx context.Context) error
- func (s *NamespaceStore) Count() int
- func (s *NamespaceStore) ForEach(fn func(*ObjectWrapper))
- func (s *NamespaceStore) Get(name string, opts ...GetOption) Object
- func (s *NamespaceStore) ImplementInterface(objType reflect.Type, opts ...GetOption) (objs []Object)
- func (s *NamespaceStore) Init() error
- func (s *NamespaceStore) Len() int
- func (s *NamespaceStore) Less(i, j int) bool
- func (s *NamespaceStore) List() (uids []string)
- func (s *NamespaceStore) Load(target any, opts ...GetOption) (Object, error)
- func (i *NamespaceStore) LoadFromEnv(prefix string) error
- func (i *NamespaceStore) LoadFromFile(filename string) error
- func (s *NamespaceStore) Registry(v Object)
- func (s *NamespaceStore) SetPriority(v int) *NamespaceStore
- func (s *NamespaceStore) Sort()
- func (s *NamespaceStore) Swap(i, j int)
- type Object
- type ObjectImpl
- func (i *ObjectImpl) AllowOverwrite() bool
- func (i *ObjectImpl) Close(ctx context.Context) error
- func (i *ObjectImpl) Hello1111() string
- func (i *ObjectImpl) Init() error
- func (i *ObjectImpl) Meta() ObjectMeta
- func (i *ObjectImpl) Name() string
- func (i *ObjectImpl) Priority() int
- func (i *ObjectImpl) Version() string
- type ObjectMeta
- type ObjectWrapper
- type StoreManage
- type StoreUser
- type Stroe
Constants ¶
View Source
const (
API_NAMESPACE = "apis"
)
View Source
const (
CONFIG_NAMESPACE = "configs"
)
View Source
const (
CONTROLLER_NAMESPACE = "controllers"
)
View Source
const (
DEFAULT_NAMESPACE = "default"
)
View Source
const (
DEFAULT_VERSION = "v1"
)
Variables ¶
This section is empty.
Functions ¶
func ApiPathPrefix ¶
func ApiPathPrefix(pathPrefix string, obm ObjectMeta, obj Object) string {
func ConfigIocObject ¶
func ConfigIocObject(req *LoadConfigRequest) error
func DevelopmentSetup ¶
func DevelopmentSetup(req *LoadConfigRequest)
func GetIocObjectUid ¶
func GinApiPathPrefix ¶
func GrpcControllerCount ¶
func GrpcControllerCount() int
func LoadGoRestfulApi ¶
func LoadGoRestfulApi(pathPrefix string, root *restful.Container)
LoadHttpApp 装载所有的http app
func ValidateFileType ¶
Types ¶
type GRPCControllerObject ¶
--------------------------------------------- GRPCService GRPC服务的实例
type GinApiObject ¶
------------------------------------gin-------------------------------------------
type GoRestfulApiObject ¶
type GoRestfulApiObject interface { Object Registry(*restful.WebService) }
------------------------------------go-restful-------------------------------------------
type InjectTag ¶
type InjectTag struct { // 是否自动注入 Autowire bool // 空间 Namespace string // 注入对象的名称 Name string // 注入对象的版本, 默认v1 Version string }
func NewInjectTag ¶
func NewInjectTag() *InjectTag
type LoadConfigRequest ¶
type LoadConfigRequest struct { // 环境变量配置 ConfigEnv *configEnv // 文件配置方式 ConfigFile *configFile }
func NewLoadConfigRequest ¶
func NewLoadConfigRequest() *LoadConfigRequest
type NamespaceStore ¶
type NamespaceStore struct { // 空间名称 Namespace string // 空间优先级 Priority int // 空间对象列表 Items []*ObjectWrapper }
这个初始化,在store的时候,也就是在namespace.go中
func (*NamespaceStore) Autowire ¶
func (i *NamespaceStore) Autowire() error
func (*NamespaceStore) Close ¶
func (s *NamespaceStore) Close(ctx context.Context) error
销毁对象,此接口,暂未调用
func (*NamespaceStore) ForEach ¶
func (s *NamespaceStore) ForEach(fn func(*ObjectWrapper))
这个是给加载配置文件用的.api路由也用了
func (*NamespaceStore) ImplementInterface ¶
func (s *NamespaceStore) ImplementInterface(objType reflect.Type, opts ...GetOption) (objs []Object)
寻找实现了接口的对象
func (*NamespaceStore) Less ¶
func (s *NamespaceStore) Less(i, j int) bool
Less 比较切片中两个元素的大小,实现了 sort.Interface 接口
func (*NamespaceStore) List ¶
func (s *NamespaceStore) List() (uids []string)
func (*NamespaceStore) Load ¶
func (s *NamespaceStore) Load(target any, opts ...GetOption) (Object, error)
根据对象对象加载对象
func (*NamespaceStore) LoadFromEnv ¶
func (i *NamespaceStore) LoadFromEnv(prefix string) error
从环境变量中加载对象配置
func (*NamespaceStore) LoadFromFile ¶
func (i *NamespaceStore) LoadFromFile(filename string) error
从环境配置文件中加载对象配置
func (*NamespaceStore) Registry ¶
func (s *NamespaceStore) Registry(v Object)
func (*NamespaceStore) SetPriority ¶
func (s *NamespaceStore) SetPriority(v int) *NamespaceStore
对象的优先级
func (*NamespaceStore) Swap ¶
func (s *NamespaceStore) Swap(i, j int)
Swap 交换切片中两个元素的位置,实现了 sort.Interface 接口
type Object ¶
type Object interface { // 对象初始化 Init() error // 对象的名称 Name() string // 对象版本 Version() string // 对象优先级 Priority() int // 对象的销毁 Close(ctx context.Context) error // 是否允许同名对象被替换, 默认不允许被替换.根据注册先后 AllowOverwrite() bool // // 对象一些元数据, 对象的更多描述信息, 扩展使用 Meta() ObjectMeta }
Object 内部服务实例, 不需要暴露
type ObjectImpl ¶
type ObjectImpl struct { }
func (*ObjectImpl) AllowOverwrite ¶
func (i *ObjectImpl) AllowOverwrite() bool
func (*ObjectImpl) Hello1111 ¶
func (i *ObjectImpl) Hello1111() string
func (*ObjectImpl) Init ¶
func (i *ObjectImpl) Init() error
func (*ObjectImpl) Name ¶
func (i *ObjectImpl) Name() string
func (*ObjectImpl) Priority ¶
func (i *ObjectImpl) Priority() int
func (*ObjectImpl) Version ¶
func (i *ObjectImpl) Version() string
type ObjectMeta ¶
func DefaultObjectMeta ¶
func DefaultObjectMeta() ObjectMeta
type ObjectWrapper ¶
type ObjectWrapper struct { Name string Version string AllowOverwrite bool Priority int Value Object }
func NewObjectWrapper ¶
func NewObjectWrapper(obj Object) *ObjectWrapper
type StoreManage ¶
type StoreUser ¶
type Stroe ¶
type Stroe interface { StoreUser StoreManage //暂时不需要环境变量加载配置 }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.