biz

package
v0.0.0-...-c12296b Latest Latest
Warning

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

Go to latest
Published: May 5, 2024 License: MIT Imports: 29 Imported by: 0

README

Biz

Documentation

Index

Constants

View Source
const (
	AppTypeAll        = 0
	AppTypeAppPackage = -1
	AppTypeRepo       = -2
)
View Source
const (
	AppUntested   = "untested"
	AppTested     = "tested"
	AppTestFailed = "test_failed"
)
View Source
const (
	ClusterStateInit     = "init"
	ClusterStateChecked  = "checked"
	ClusterStateNotReady = "not ready"
	ClusterStateRunning  = "running"
	ClusterStateFailed   = "failed"
	ClusterStateFinished = "finished"
)
View Source
const (
	NodeSateInit      = "init"
	NodeStateRunning  = "running"
	NodeStateFailed   = "failed"
	NodeStateFinished = "finished"
)
View Source
const (
	ClusterRoleMaster = "master"
	ClusterRoleWorker = "worker"
	ClusterRoleEdge   = "edge"
)
View Source
const (
	ProjectStateInit    = "init"
	ProjectStateRunning = "running"
	ProjectStateStopped = "stopped"
)
View Source
const (
	BackendBusiness  = "backend"
	FrontendBusiness = "frontend"
	BigDataBusiness  = "bigdata"
	MLBusiness       = "ml"
)
View Source
const (
	GolangTechnology = "golang"
	PythonTechnology = "python"
	JavaTechnology   = "java"
	NodejsTechnology = "nodejs"
)
View Source
const (
	AdminID   = -1
	AdminName = "admin"
)

Variables

ProviderSet is biz providers.

Functions

This section is empty.

Types

type App

type App struct {
	ID            int64         `json:"id" gorm:"column:id;primaryKey;AUTO_INCREMENT"`
	Name          string        `json:"name" gorm:"column:name; default:''; NOT NULL; index"`
	Icon          string        `json:"icon,omitempty" gorm:"column:icon; default:''; NOT NULL"`
	AppTypeID     int64         `json:"app_type_id,omitempty" gorm:"column:app_type_id; default:0; NOT NULL"`
	AppHelmRepoID int64         `json:"app_helm_repo_id,omitempty" gorm:"column:app_helm_repo_id; default:0; NOT NULL"`
	Versions      []*AppVersion `json:"versions,omitempty" gorm:"-"`
	gorm.Model
}

func (*App) AddVersion

func (a *App) AddVersion(version *AppVersion)

func (*App) DeleteVersion

func (a *App) DeleteVersion(version string)

func (*App) GetVersion

func (a *App) GetVersion(version string) *AppVersion

func (*App) GetVersionById

func (a *App) GetVersionById(id int64) *AppVersion

func (*App) UpdateVersion

func (a *App) UpdateVersion(version *AppVersion)

type AppDeployedResource

type AppDeployedResource struct {
	Name      string   `json:"name"`
	Kind      string   `json:"kind"`
	Events    []string `json:"events"`
	StartedAt string   `json:"started_at"`
	Status    []string `json:"status"`
}

type AppHelmRepo

type AppHelmRepo struct {
	ID          int64  `json:"id" gorm:"column:id;primaryKey;AUTO_INCREMENT"`
	Name        string `json:"name" gorm:"column:name; default:''; NOT NULL"`
	Url         string `json:"url" gorm:"column:url; default:''; NOT NULL"`
	IndexPath   string `json:"index_path" gorm:"column:index_path; default:''; NOT NULL"`
	Description string `json:"description" gorm:"column:description; default:''; NOT NULL"`
	gorm.Model
}

func (*AppHelmRepo) SetIndexPath

func (a *AppHelmRepo) SetIndexPath(path string)

type AppRepo

type AppRepo interface {
	Save(context.Context, *App) error
	List(ctx context.Context, appReq *App, page, pageSize int32) ([]*App, int32, error)
	Get(ctx context.Context, appID int64) (*App, error)
	GetByName(ctx context.Context, name string) (*App, error)
	Delete(ctx context.Context, appID, versionID int64) error
	CreateAppType(ctx context.Context, appType *AppType) error
	ListAppType(ctx context.Context) ([]*AppType, error)
	DeleteAppType(ctx context.Context, appTypeID int64) error
	SaveDeployApp(ctx context.Context, appDeployed *DeployApp) error
	DeleteDeployApp(ctx context.Context, id int64) error
	DeployAppList(ctx context.Context, appDeployedReq DeployApp, page, pageSuze int32) ([]*DeployApp, int32, error)
	GetDeployApp(ctx context.Context, id int64) (*DeployApp, error)
	SaveRepo(ctx context.Context, helmRepo *AppHelmRepo) error
	ListRepo(ctx context.Context) ([]*AppHelmRepo, error)
	GetRepo(ctx context.Context, helmRepoID int64) (*AppHelmRepo, error)
	GetRepoByName(ctx context.Context, repoName string) (*AppHelmRepo, error)
	DeleteRepo(ctx context.Context, helmRepoID int64) error
}

type AppType

type AppType struct {
	ID   int64  `json:"id" gorm:"column:id;primaryKey;AUTO_INCREMENT"`
	Name string `json:"name" gorm:"column:name; default:''; NOT NULL"`
	gorm.Model
}

func DefaultAppType

func DefaultAppType() []*AppType

type AppUsecase

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

func NewAppUsecase

func NewAppUsecase(repo AppRepo, logger log.Logger, c *conf.Bootstrap, clusterRepo ClusterRepo, projectRepo ProjectRepo) *AppUsecase

func (*AppUsecase) AppOperation

func (uc *AppUsecase) AppOperation(ctx context.Context, deployedApp *DeployApp) error

func (*AppUsecase) AppTest

func (uc *AppUsecase) AppTest(ctx context.Context, appID, versionID int64) (*DeployApp, error)

func (*AppUsecase) BaseInstallation

func (uc *AppUsecase) BaseInstallation(ctx context.Context, cluster *Cluster, project *Project) error

默认app安装

func (*AppUsecase) CreateAppType

func (uc *AppUsecase) CreateAppType(ctx context.Context, appType *AppType) error

func (*AppUsecase) Delete

func (uc *AppUsecase) Delete(ctx context.Context, id, versionId int64) error

func (*AppUsecase) DeleteAppType

func (uc *AppUsecase) DeleteAppType(ctx context.Context, appTypeID int64) error

func (*AppUsecase) DeleteDeployedApp

func (uc *AppUsecase) DeleteDeployedApp(ctx context.Context, id int64) error

func (*AppUsecase) DeleteRepo

func (uc *AppUsecase) DeleteRepo(ctx context.Context, helmRepoID int64) error

删除repo

func (*AppUsecase) DeployApp

func (uc *AppUsecase) DeployApp(ctx context.Context, deployAppReq *DeployApp) (*DeployApp, error)

func (*AppUsecase) DeployAppList

func (uc *AppUsecase) DeployAppList(ctx context.Context, appDeployedReq DeployApp, page, pageSize int32) ([]*DeployApp, int32, error)

func (*AppUsecase) Get

func (uc *AppUsecase) Get(ctx context.Context, id, versionId int64) (*App, error)

func (*AppUsecase) GetAppByName

func (uc *AppUsecase) GetAppByName(ctx context.Context, name string) (app *App, err error)

func (*AppUsecase) GetAppDeployed

func (uc *AppUsecase) GetAppDeployed(ctx context.Context, id int64) (*DeployApp, error)

func (*AppUsecase) GetAppDetailByRepo

func (uc *AppUsecase) GetAppDetailByRepo(ctx context.Context, helmRepoID int64, appName, version string) (*App, error)

根据repo获取app详情包含app version

func (*AppUsecase) GetAppsByRepo

func (uc *AppUsecase) GetAppsByRepo(ctx context.Context, helmRepoID int64) ([]*App, error)

根据repo获取app列表

func (*AppUsecase) GetDeployedResources

func (uc *AppUsecase) GetDeployedResources(ctx context.Context, appDeployID int64) ([]*AppDeployedResource, error)

func (*AppUsecase) List

func (uc *AppUsecase) List(ctx context.Context, appReq *App, page, pageSize int32) ([]*App, int32, error)

func (*AppUsecase) ListAppType

func (uc *AppUsecase) ListAppType(ctx context.Context) ([]*AppType, error)

func (*AppUsecase) ListRepo

func (uc *AppUsecase) ListRepo(ctx context.Context) ([]*AppHelmRepo, error)

repo列表

func (*AppUsecase) Save

func (uc *AppUsecase) Save(ctx context.Context, app *App) error

func (*AppUsecase) SaveRepo

func (uc *AppUsecase) SaveRepo(ctx context.Context, helmRepo *AppHelmRepo) error

保存repo

func (*AppUsecase) StopApp

func (uc *AppUsecase) StopApp(ctx context.Context, id int64) error

type AppVersion

type AppVersion struct {
	ID          int64             `json:"id" gorm:"column:id;primaryKey;AUTO_INCREMENT"`
	AppID       int64             `json:"app_id" gorm:"column:app_id; default:0; NOT NULL; index"`
	AppName     string            `json:"app_name,omitempty" gorm:"column:app_name; default:''; NOT NULL"`
	Name        string            `json:"name,omitempty" gorm:"column:name; default:''; NOT NULL"`
	Chart       string            `json:"chart,omitempty" gorm:"column:chart; default:''; NOT NULL"`
	Version     string            `json:"version,omitempty" gorm:"column:version; default:''; NOT NULL; index"`
	Config      string            `json:"config,omitempty" gorm:"column:config; default:''; NOT NULL"`
	Readme      string            `json:"readme,omitempty" gorm:"-"`
	State       string            `json:"state,omitempty" gorm:"column:state; default:''; NOT NULL"`
	TestResult  string            `json:"test_result,omitempty" gorm:"column:test_result; default:''; NOT NULL"` // 哪些资源部署成功,哪些失败
	Description string            `json:"description,omitempty" gorm:"column:description; default:''; NOT NULL"`
	Metadata    pkgChart.Metadata `json:"metadata,omitempty" gorm:"-"`
	gorm.Model
}

func (*AppVersion) GetAppDeployed

func (v *AppVersion) GetAppDeployed() *DeployApp

func (*AppVersion) GetChartInfo

func (v *AppVersion) GetChartInfo(appPath string) error

type Biz

type Biz struct {
}

func NewBiz

func NewBiz(logger log.Logger) (*Biz, error)

type Business

type Business struct {
	Name        string       `json:"name" gorm:"column:name; default:''; NOT NULL"`
	Technologys []Technology `json:"technologys" gorm:"-"`
}

type CD

type CD struct {
	ID        int64  `json:"id" gorm:"column:id;primaryKey;AUTO_INCREMENT"`
	CIID      int64  `json:"ci_id" gorm:"column:ci_id; default:0; NOT NULL"`
	ServiceID int64  `json:"service_id" gorm:"column:service_id; default:0; NOT NULL"`
	UserID    int64  `json:"user_id" gorm:"column:user_id; default:0; NOT NULL"`
	Logs      string `json:"logs" gorm:"-"`
	gorm.Model
}

type CI

type CI struct {
	ID          int64  `json:"id" gorm:"column:id;primaryKey;AUTO_INCREMENT"`
	Version     string `json:"version,omitempty" gorm:"column:version; default:''; NOT NULL"`
	Branch      string `json:"branch,omitempty" gorm:"column:branch; default:''; NOT NULL"`
	Tag         string `json:"tag,omitempty" gorm:"column:tag; default:''; NOT NULL"`
	Description string `json:"description,omitempty" gorm:"column:description; default:''; NOT NULL"`
	ServiceID   int64  `json:"service_id,omitempty" gorm:"column:service_id; default:0; NOT NULL"`
	UserID      int64  `json:"user_id,omitempty" gorm:"column:user_id; default:0; NOT NULL"`
	Logs        string `json:"logs" gorm:"-"`
	gorm.Model
}

type Cluster

type Cluster struct {
	ID               int64   `json:"id" gorm:"column:id;primaryKey;AUTO_INCREMENT"`
	Name             string  `json:"name" gorm:"column:name; default:''; NOT NULL"`
	ServerVersion    string  `json:"server_version" gorm:"column:server_version; default:''; NOT NULL"`
	ApiServerAddress string  `json:"api_server_address" gorm:"column:api_server_address; default:''; NOT NULL"`
	Config           string  `json:"config" gorm:"column:config; default:''; NOT NULL;"`
	Addons           string  `json:"addons" gorm:"column:addons; default:''; NOT NULL;"`
	AddonsConfig     string  `json:"addons_config" gorm:"column:addons_config; default:''; NOT NULL;"`
	State            string  `json:"state" gorm:"column:state; default:''; NOT NULL;"`
	Nodes            []*Node `json:"nodes" gorm:"-"`
	Logs             string  `json:"logs" gorm:"-"` // logs data from localfile

	gorm.Model
}

func (*Cluster) GetNode

func (c *Cluster) GetNode(nodeId int64) *Node

type ClusterRepo

type ClusterRepo interface {
	Save(context.Context, *Cluster) error
	Get(context.Context, int64) (*Cluster, error)
	List(context.Context, *Cluster) ([]*Cluster, error)
	Delete(context.Context, int64) error
	ReadClusterLog(cluster *Cluster) error
	WriteClusterLog(cluster *Cluster) error
}

type ClusterUsecase

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

func NewClusterUseCase

func NewClusterUseCase(c *conf.Bootstrap, repo ClusterRepo, logger log.Logger) *ClusterUsecase

func (*ClusterUsecase) AddNode

func (uc *ClusterUsecase) AddNode(ctx context.Context, clusterID int64, nodeID int64) error

添加节点

func (*ClusterUsecase) CheckConfig

func (uc *ClusterUsecase) CheckConfig(ctx context.Context, clusterID int64) (*Cluster, error)

func (*ClusterUsecase) CurrentCluster

func (uc *ClusterUsecase) CurrentCluster() (*Cluster, error)

func (*ClusterUsecase) Delete

func (uc *ClusterUsecase) Delete(ctx context.Context, id int64) error

func (*ClusterUsecase) DeleteNode

func (uc *ClusterUsecase) DeleteNode(ctx context.Context, clusterID int64, nodeID int64) error

func (*ClusterUsecase) Get

func (uc *ClusterUsecase) Get(ctx context.Context, id int64) (*Cluster, error)

func (*ClusterUsecase) List

func (uc *ClusterUsecase) List(ctx context.Context) ([]*Cluster, error)

func (*ClusterUsecase) RemoveNode

func (uc *ClusterUsecase) RemoveNode(ctx context.Context, clusterID int64, nodeID int64) error

移除节点

func (*ClusterUsecase) Save

func (uc *ClusterUsecase) Save(ctx context.Context, cluster *Cluster) error

func (*ClusterUsecase) SetUpCluster

func (uc *ClusterUsecase) SetUpCluster(ctx context.Context, clusterID int64) error

安装集群

func (*ClusterUsecase) UninstallCluster

func (uc *ClusterUsecase) UninstallCluster(ctx context.Context, clusterID int64) error

卸载集群

type DeployApp

type DeployApp struct {
	ID          int64  `json:"id" gorm:"column:id;primaryKey;AUTO_INCREMENT"`
	ReleaseName string `json:"release_name,omitempty" gorm:"column:release_name; default:''; NOT NULL"`
	AppID       int64  `json:"app_id" gorm:"column:app_id; default:0; NOT NULL; index"`
	VersionID   int64  `json:"version_id" gorm:"column:version_id; default:0; NOT NULL; index"`
	Version     string `json:"version,omitempty" gorm:"column:version; default:''; NOT NULL"`
	RepoID      int64  `json:"repo_id,omitempty" gorm:"column:repo_id; default:0; NOT NULL"`
	AppName     string `json:"app_name,omitempty" gorm:"column:app_name; default:''; NOT NULL"`
	AppTypeID   int64  `json:"app_type_id,omitempty" gorm:"column:app_type_id; default:0; NOT NULL"`
	Chart       string `json:"chart,omitempty" gorm:"column:chart; default:''; NOT NULL"`
	ClusterID   int64  `json:"cluster_id" gorm:"column:cluster_id; default:0; NOT NULL; index"`
	ProjectID   int64  `json:"project_id" gorm:"column:project_id; default:0; NOT NULL; index"`
	UserID      int64  `json:"user_id" gorm:"column:user_id; default:0; NOT NULL; index"`
	Namespace   string `json:"namespace,omitempty" gorm:"column:namespace; default:''; NOT NULL"`
	Config      string `json:"config,omitempty" gorm:"column:config; default:''; NOT NULL"`
	State       string `json:"state,omitempty" gorm:"column:state; default:''; NOT NULL"`
	IsTest      bool   `json:"is_test,omitempty" gorm:"column:is_test; default:false; NOT NULL"`
	Manifest    string `json:"manifest,omitempty" gorm:"column:manifest; default:''; NOT NULL"` // also template | yaml
	Notes       string `json:"notes,omitempty" gorm:"column:notes; default:''; NOT NULL"`
	Logs        string `json:"logs,omitempty" gorm:"column:logs; default:''; NOT NULL"`
	gorm.Model
}

type Node

type Node struct {
	ID           int64  `json:"id" gorm:"column:id;primaryKey;AUTO_INCREMENT"`
	Name         string `json:"name" gorm:"column:name; default:''; NOT NULL"`
	Labels       string `json:"labels" gorm:"column:labels; default:''; NOT NULL"`
	Annotations  string `json:"annotations" gorm:"column:annotations; default:''; NOT NULL"`
	OSImage      string `json:"os_image" gorm:"column:os_image; default:''; NOT NULL"`
	Kernel       string `json:"kernel" gorm:"column:kernel; default:''; NOT NULL"`
	Container    string `json:"container" gorm:"column:container; default:''; NOT NULL"`
	Kubelet      string `json:"kubelet" gorm:"column:kubelet; default:''; NOT NULL"`
	KubeProxy    string `json:"kube_proxy" gorm:"column:kube_proxy; default:''; NOT NULL"`
	InternalIP   string `json:"internal_ip" gorm:"column:internal_ip; default:''; NOT NULL"`
	ExternalIP   string `json:"external_ip" gorm:"column:external_ip; default:''; NOT NULL"`
	User         string `json:"user" gorm:"column:user; default:''; NOT NULL"`
	Password     string `json:"password" gorm:"column:password; default:''; NOT NULL"`
	SudoPassword string `json:"sudo_password" gorm:"column:sudo_password; default:''; NOT NULL"`
	Role         string `json:"role" gorm:"column:role; default:''; NOT NULL;"` // master worker edge
	State        string `json:"state" gorm:"column:state; default:''; NOT NULL"`
	ClusterID    int64  `json:"cluster_id" gorm:"column:cluster_id; default:0; NOT NULL"`
	gorm.Model
}

type Port

type Port struct {
	ID            int64  `json:"id" gorm:"column:id;primaryKey;AUTO_INCREMENT"`
	IngressPath   string `json:"ingress_path" gorm:"column:ingress_path; default:''; NOT NULL"`    // /api/v1
	Protocol      string `json:"protocol" gorm:"column:protocol; default:''; NOT NULL"`            // TCP, UDP
	ContainerPort int32  `json:"container_port" gorm:"column:container_port; default:0; NOT NULL"` // 80
}

type Project

type Project struct {
	ID           int64      `json:"id" gorm:"column:id;primaryKey;AUTO_INCREMENT"`
	Name         string     `json:"name" gorm:"column:name; default:''; NOT NULL"`
	Namespace    string     `json:"namespace" gorm:"column:namespace; default:''; NOT NULL"`
	State        string     `json:"state" gorm:"column:state; default:''; NOT NULL"`
	Description  string     `json:"description" gorm:"column:description; default:''; NOT NULL"`
	ClusterID    int64      `json:"cluster_id" gorm:"column:cluster_id; default:0; NOT NULL"`
	Business     []Business `json:"business" gorm:"-"`
	BusinessJson []byte     `json:"business_json" gorm:"column:business_json; type:json"`
	gorm.Model
}

type ProjectRepo

type ProjectRepo interface {
	Save(context.Context, *Project) error
	Get(context.Context, int64) (*Project, error)
	List(context.Context, int64) ([]*Project, error)
	ListByIds(context.Context, []int64) ([]*Project, error)
	Delete(context.Context, int64) error
}

type ProjectUsecase

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

func NewProjectUseCase

func NewProjectUseCase(repo ProjectRepo, logger log.Logger, c *conf.Bootstrap) *ProjectUsecase

func (*ProjectUsecase) Delete

func (uc *ProjectUsecase) Delete(ctx context.Context, id int64) error

func (*ProjectUsecase) Enable

func (uc *ProjectUsecase) Enable(ctx context.Context, project *Project, cluster *Cluster, baseAppInstallation func(context.Context, *Cluster, *Project) error) error

func (*ProjectUsecase) Get

func (uc *ProjectUsecase) Get(ctx context.Context, id int64) (*Project, error)

func (*ProjectUsecase) List

func (uc *ProjectUsecase) List(ctx context.Context, clusterID int64) ([]*Project, error)

func (*ProjectUsecase) ListByIds

func (uc *ProjectUsecase) ListByIds(ctx context.Context, ids []int64) ([]*Project, error)

func (*ProjectUsecase) Save

func (uc *ProjectUsecase) Save(ctx context.Context, projectParam *Project) error

type Service

type Service struct {
	ID           int64   `json:"id" gorm:"column:id;primaryKey;AUTO_INCREMENT"`
	Name         string  `json:"name,omitempty" gorm:"column:name; default:''; NOT NULL"`
	CodeRepo     string  `json:"code_repo,omitempty" gorm:"column:code_repo; default:''; NOT NULL"`   // git repo url
	Replicas     int32   `json:"replicas" gorm:"column:replicas; default:0; NOT NULL"`                // 0 == auto
	CPU          float32 `json:"cpu" gorm:"column:cpu; default:0; NOT NULL"`                          // 0.5=500m
	LimitCpu     float32 `json:"limit_cpu" gorm:"column:limit_cpu; default:0; NOT NULL"`              // 0 == auto
	GPU          float32 `json:"gpu" gorm:"column:gpu; default:0; NOT NULL"`                          // 0 == no gpu
	LimitGPU     float32 `json:"limit_gpu" gorm:"column:limit_gpu; default:0; NOT NULL"`              // GPU !==0 LimitGPU 0 == auto
	Memory       float32 `json:"memory" gorm:"column:memory; default:0; NOT NULL"`                    // 0.5=500m
	LimitMemory  float32 `json:"limit_memory" gorm:"column:limit_memory; default:0; NOT NULL"`        // 0 == auto
	Disk         float32 `json:"disk" gorm:"column:disk; default:0; NOT NULL"`                        // 0.5=500m
	LimitDisk    float32 `json:"limit_disk" gorm:"column:limit_disk; default:0; NOT NULL"`            // 0 == auto
	Business     string  `json:"business,omitempty" gorm:"column:business; default:''; NOT NULL"`     // business name
	Technology   string  `json:"technology,omitempty" gorm:"column:technology; default:''; NOT NULL"` // technology name
	Ports        []Port  `json:"ports" gorm:"-"`
	ProjectID    int64   `json:"project_id,omitempty" gorm:"column:project_id; default:0; NOT NULL"`
	PortsJson    []byte  `json:"ports_json" gorm:"column:ports_json; type:json"`
	CIWorklfowID int64   `json:"ci_workflow_id,omitempty" gorm:"column:ci_workflow_id; default:0; NOT NULL"`
	CDWorklfowID int64   `json:"cd_workflow_id,omitempty" gorm:"column:cd_workflow_id; default:0; NOT NULL"`
	gorm.Model
}

type ServicesRepo

type ServicesRepo interface {
	List(ctx context.Context, serviceParam *Service, page, pageSize int) ([]*Service, int64, error)
	Save(ctx context.Context, service *Service) error
	Get(ctx context.Context, id int64) (*Service, error)
	Delete(ctx context.Context, id int64) error
	GetWorkflow(ctx context.Context, id int64) (*Workflow, error)
	SaveWrkflow(ctx context.Context, workflow *Workflow) error
	DeleteWrkflow(ctx context.Context, id int64) error
}

type ServicesUseCase

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

func NewServicesUseCase

func NewServicesUseCase(repo ServicesRepo, logger log.Logger) *ServicesUseCase

func (*ServicesUseCase) Delete

func (uc *ServicesUseCase) Delete(ctx context.Context, id int64) error

func (*ServicesUseCase) Get

func (uc *ServicesUseCase) Get(ctx context.Context, id int64) (*Service, error)

func (*ServicesUseCase) GetWorkflow

func (uc *ServicesUseCase) GetWorkflow(ctx context.Context, id int64, args string) (*Workflow, error)

func (*ServicesUseCase) List

func (uc *ServicesUseCase) List(ctx context.Context, serviceParam *Service, page, pageSize int) ([]*Service, int64, error)

func (*ServicesUseCase) Save

func (uc *ServicesUseCase) Save(ctx context.Context, service *Service) error

func (*ServicesUseCase) SaveWorkflow

func (uc *ServicesUseCase) SaveWorkflow(ctx context.Context, serviceId int64, wfType string, wf *Workflow) error

type Technology

type Technology struct {
	Name string `json:"name" gorm:"column:name; default:''; NOT NULL"`
}

type User

type User struct {
	ID       int64  `json:"id,omitempty" gorm:"column:id;primaryKey;AUTO_INCREMENT"`
	Name     string `json:"name,omitempty" gorm:"column:name; default:''; NOT NULL"`
	Email    string `json:"email,omitempty" gorm:"column:email; default:''; NOT NULL"`
	PassWord string `json:"password,omitempty" gorm:"column:password; default:''; NOT NULL"`
	State    int32  `json:"state,omitempty" gorm:"column:state; default:0; NOT NULL"`
	gorm.Model
}

type UserRepo

type UserRepo interface {
	GetUserInfoByEmail(ctx context.Context, email string) (*User, error)
	GetUserByID(ctx context.Context, id int64) (*User, error)
	Save(ctx context.Context, user *User) error
}

type UserUseCase

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

func NewUseUser

func NewUseUser(repo UserRepo, logger log.Logger, conf *conf.Bootstrap) *UserUseCase

func (*UserUseCase) CheckJWT

func (u *UserUseCase) CheckJWT(ctx context.Context, tokenString string) (*User, error)

解析jwt

func (*UserUseCase) GetUserByID

func (u *UserUseCase) GetUserByID(ctx context.Context, id int64) (*User, error)

func (*UserUseCase) GetUserInfo

func (u *UserUseCase) GetUserInfo(ctx context.Context) (*User, error)

通过token获取用户信息

func (*UserUseCase) SignIn

func (u *UserUseCase) SignIn(ctx context.Context, email string, password string) (token string, err error)

func (*UserUseCase) SignUp

func (u *UserUseCase) SignUp(ctx context.Context, email, name, password string) (token string, err error)

type Workflow

type Workflow struct {
	ID       int64  `json:"id" gorm:"column:id;primaryKey;AUTO_INCREMENT"`
	Name     string `json:"name,omitempty" gorm:"column:name; default:''; NOT NULL"`
	Workflow []byte `json:"workflow" gorm:"column:workflow; type:json"`
}

Jump to

Keyboard shortcuts

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