cago

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: MIT Imports: 11 Imported by: 3

README

[TOC]

Cago

Cago 一个快速开发的集成式框架.使用模块化的开发模式,每一个组件都可以单独的调用.

Cago 只对社区工具进行集成,大大减少迁移难度和学习成本,我们不生产代码,我们只是方案的搬运工.

使用 go 的struct来声明 API 和 swagger 文档,可以通过脚手架来帮助你生成相关内容.

快速开始

简单示例

脚手架

脚手架文档

CI/CD

部署资源

cago 提供了gitlab-cigolanglint-ciKubernetes的 CI/CD 配置文件,可以快速帮你实现 CI/CD.

当本地调试时也可以使用docker compose up -d启动调试环境.

默认使用etcd作为配置中心,同时也支持文件作为配置启动.

组件

参考项目

  • GoFrame
  • GoMicro

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Version

func Version() string

Types

type Cago

type Cago struct {
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, cfg *configs.Config) *Cago

New 初始化cago

func (*Cago) DisableLogger

func (r *Cago) DisableLogger() *Cago

DisableLogger 禁用框架日志

func (*Cago) Registry

func (r *Cago) Registry(component Component) *Cago

Registry 注册组件

func (*Cago) RegistryCancel

func (r *Cago) RegistryCancel(component ComponentCancel) *Cago

RegistryCancel 注册cancel组件

func (*Cago) Start

func (r *Cago) Start() error

Start 启动框架,在此之前组件已全部启动,此处只做停止等待

type CloseHandle

type CloseHandle func()

type Component

type Component interface {
	Start(ctx context.Context, cfg *configs.Config) error
	CloseHandle()
}

type ComponentCancel

type ComponentCancel interface {
	Component
	StartCancel(ctx context.Context, cancel context.CancelFunc, cfg *configs.Config) error
}

type FuncComponent

type FuncComponent func(ctx context.Context, cfg *configs.Config) error

func (FuncComponent) CloseHandle

func (f FuncComponent) CloseHandle()

func (FuncComponent) Start

func (f FuncComponent) Start(ctx context.Context, cfg *configs.Config) error

type FuncComponentCancel

type FuncComponentCancel func(ctx context.Context, cancel context.CancelFunc, cfg *configs.Config) error

func (FuncComponentCancel) CloseHandle

func (f FuncComponentCancel) CloseHandle()

func (FuncComponentCancel) Start

func (FuncComponentCancel) StartCancel

func (f FuncComponentCancel) StartCancel(ctx context.Context, cancel context.CancelFunc, cfg *configs.Config) error

Jump to

Keyboard shortcuts

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