biz

package
v0.0.0-...-5c0e286 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: MIT Imports: 26 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 (
	BusinessTypeBackend  = 1
	BusinessTypeFrontend = 2
	BusinessTypeBigData  = 3
	BusinessTypeAI       = 4
	BusinessTypeOther    = 5
)
View Source
const (
	TechnologyTypeGolang     = 1
	TechnologyTypeJava       = 2
	TechnologyTypePython     = 3
	TechnologyTypeVue        = 4
	TechnologyTypeReact      = 5
	TechnologyTypeOther      = 6
	TechnologyTypeHadoop     = 7
	TechnologyTypeSpark      = 8
	TechnologyTypeTensorflow = 9
	TechnologyTypePytorch    = 10
)
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)
	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)
	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) 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 BusinessType

type BusinessType struct {
	ID              int64            `json:"id" gorm:"column:id;primaryKey;AUTO_INCREMENT"`
	Name            string           `json:"name" gorm:"column:name; default:''; NOT NULL"`
	ProjectID       int64            `json:"project_id" gorm:"column:project_id; default:0; NOT NULL"`
	TechnologyTypes []TechnologyType `json:"technology_types" gorm:"-"`
}

type CD

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

type CI

type CI struct {
	ID           int    `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"`
	Args         string `json:"args,omitempty" gorm:"column:args; type:json"`
	Description  string `json:"description,omitempty" gorm:"column:description; default:''; NOT NULL"`
	WorkflowName string `json:"workflow_name,omitempty" gorm:"column:workflow_name; default:''; NOT NULL"`
	ServiceID    int    `json:"service_id,omitempty" gorm:"column:service_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            int    `json:"id" gorm:"column:id;primaryKey;AUTO_INCREMENT"`
	IngressPath   string `json:"ingress_path" gorm:"column:ingress_path; default:''; NOT NULL"`
	ContainerPort int32  `json:"container_port" gorm:"column:container_port; default:0; NOT NULL"`
}

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"`
	BusinessTypes    []BusinessType `json:"business_types" gorm:"-"`
	BusinessTypeJson []byte         `json:"business_type_json" gorm:"column:business_type_json; type:json"`
	gorm.Model
}

func (*Project) GetBusinessTypes

func (p *Project) GetBusinessTypes()

type ProjectRepo

type ProjectRepo interface {
	Save(context.Context, *Project) error
	Get(context.Context, int64) (*Project, error)
	List(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) *ProjectUsecase

func (*ProjectUsecase) Delete

func (uc *ProjectUsecase) Delete(ctx context.Context, id int64) 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) Save

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

type Service

type Service struct {
	ID           int    `json:"id" gorm:"column:id;primaryKey;AUTO_INCREMENT"`
	Name         string `json:"name,omitempty" gorm:"column:name; default:''; NOT NULL"`
	NameSpace    string `json:"namespace,omitempty" gorm:"column:namespace; default:''; NOT NULL"`
	Repo         string `json:"repo,omitempty" gorm:"column:repo; default:''; NOT NULL"`         // git repo url
	Registry     string `json:"registry" gorm:"column:registry; default:''; NOT NULL"`           // docker registry url
	RegistryUser string `json:"registry_user" gorm:"column:registry_user; default:''; NOT NULL"` // docker registry user
	RegistryPwd  string `json:"registry_pwd" gorm:"column:registry_pwd; default:''; NOT NULL"`   // docker registry password
	Workflow     string `json:"workflow" gorm:"column:workflow; type:text"`
	Replicas     int32  `json:"replicas" gorm:"column:replicas; default:0; NOT NULL"`
	CPU          string `json:"cpu" gorm:"column:cpu; default:''; NOT NULL"`
	LimitCpu     string `json:"limit_cpu" gorm:"column:limit_cpu; default:''; NOT NULL"`
	GPU          string `json:"gpu" gorm:"column:gpu; default:''; NOT NULL"`
	LimitGPU     string `json:"limit_gpu" gorm:"column:limit_gpu; default:''; NOT NULL"`
	Memory       string `json:"memory" gorm:"column:memory; default:''; NOT NULL"`
	LimitMemory  string `json:"limit_memory" gorm:"column:limit_memory; default:''; NOT NULL"`
	Disk         string `json:"disk" gorm:"column:disk; default:''; NOT NULL"`
	LimitDisk    string `json:"limit_disk" gorm:"column:limit_disk; default:''; NOT NULL"`
	Config       string `json:"config" gorm:"column:config; default:''; NOT NULL"`
	Secret       string `json:"secret" gorm:"column:secret; default:''; NOT NULL"`
	Ports        []Port `json:"ports" gorm:"-"`
	CIItems      []*CI  `json:"ci_items,omitempty" gorm:"-"`
	CDItems      []*CD  `json:"cd_items,omitempty" gorm:"-"`
	gorm.Model
}

type ServicesRepo

type ServicesRepo interface {
}

type ServicesUseCase

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

func NewServicesUseCase

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

type TechnologyType

type TechnologyType struct {
	ID             int64  `json:"id" gorm:"column:id;primaryKey;AUTO_INCREMENT"`
	Name           string `json:"name" gorm:"column:name; default:''; NOT NULL"`
	BusinessTypeID int64  `json:"business_type_id" gorm:"column:business_type_id; default:0; 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)

Jump to

Keyboard shortcuts

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