Documentation ¶
Index ¶
- Constants
- Variables
- type Agent
- type AgentRepo
- type AgentUsecase
- func (uc *AgentUsecase) Create(ctx context.Context, agent *Agent) error
- func (uc *AgentUsecase) Delete(ctx context.Context, id uuid.UUID) error
- func (uc *AgentUsecase) Get(ctx context.Context, id uuid.UUID) (p *Agent, err error)
- func (uc *AgentUsecase) List(ctx context.Context) (ps []*Agent, err error)
- func (uc *AgentUsecase) Update(ctx context.Context, id uuid.UUID, agent *Agent) error
- type ComputeImage
- type ComputeImageRepo
- type ComputeInstance
- type ComputeInstanceCreate
- type ComputeInstanceRepo
- type ComputeInstanceUsercase
- func (uc *ComputeInstanceUsercase) Create(ctx context.Context, cic *ComputeInstanceCreate) (*ComputeInstance, error)
- func (uc *ComputeInstanceUsercase) Delete(ctx context.Context, id uuid.UUID) error
- func (uc *ComputeInstanceUsercase) ListComputeImage(ctx context.Context) ([]*ComputeImage, error)
- func (uc *ComputeInstanceUsercase) ListComputeSpec(ctx context.Context) ([]*ComputeSpec, error)
- type ComputeSpec
- type ComputeSpecRepo
- type Greeter
- type GreeterRepo
- type GreeterUsecase
- type Storage
- type StorageRepo
- type Storagecase
- func (uc *Storagecase) Create(ctx context.Context, storage *Storage) error
- func (uc *Storagecase) Delete(ctx context.Context, id uuid.UUID) error
- func (uc *Storagecase) Get(ctx context.Context, id uuid.UUID) (p *Storage, err error)
- func (uc *Storagecase) List(ctx context.Context, owner string, parentId string) (ps []*Storage, err error)
- func (uc *Storagecase) Update(ctx context.Context, id uuid.UUID, storage *Storage) error
- type User
- type UserRepo
- type UserUsercase
- func (uc *UserUsercase) Create(ctx context.Context, user *User) error
- func (uc *UserUsercase) Delete(ctx context.Context, id uuid.UUID) error
- func (uc *UserUsercase) Get(ctx context.Context, id uuid.UUID) (p *User, err error)
- func (uc *UserUsercase) GetValidateCode(ctx context.Context, user User) (string, error)
- func (uc *UserUsercase) List(ctx context.Context, entity User) (ps []*User, err error)
- func (uc *UserUsercase) Login(ctx context.Context, user *User) (string, error)
- func (uc *UserUsercase) LoginWithValidateCode(ctx context.Context, user *User) (string, error)
- func (uc *UserUsercase) SendValidateCode(ctx context.Context, entity User) error
- func (uc *UserUsercase) Update(ctx context.Context, id uuid.UUID, user *User) error
Constants ¶
View Source
const ( InstanceStatusStarting int8 = iota InstanceStatusRunning InstanceStatusTerminal InstanceStatusExpire )
Variables ¶
View Source
var ( // ErrUserNotFound is user not found. ErrUserNotFound = errors.NotFound(v1.ErrorReason_USER_NOT_FOUND.String(), "user not found") )
View Source
var ProviderSet = wire.NewSet( NewGreeterUsecase, NewAgentUsecase, NewStorageUsecase, NewUserUsecase, NewComputeInstanceUsercase, )
ProviderSet is biz providers.
Functions ¶
This section is empty.
Types ¶
type AgentRepo ¶
type AgentRepo interface { //db ListAgent(ctx context.Context) ([]*Agent, error) GetAgent(ctx context.Context, id uuid.UUID) (*Agent, error) CreateAgent(ctx context.Context, agent *Agent) error UpdateAgent(ctx context.Context, id uuid.UUID, agent *Agent) error DeleteAgent(ctx context.Context, id uuid.UUID) error }
type AgentUsecase ¶
type AgentUsecase struct {
// contains filtered or unexported fields
}
func NewAgentUsecase ¶
func NewAgentUsecase(repo AgentRepo, logger log.Logger) *AgentUsecase
func (*AgentUsecase) Create ¶
func (uc *AgentUsecase) Create(ctx context.Context, agent *Agent) error
type ComputeImage ¶
type ComputeImageRepo ¶
type ComputeImageRepo interface { List(ctx context.Context) ([]*ComputeImage, error) Get(ctx context.Context, id int32) (*ComputeImage, error) }
type ComputeInstance ¶
type ComputeInstance struct { // ID of the ent. ID uuid.UUID `json:"id,omitempty"` // Owner holds the value of the "owner" field. Owner string `json:"owner,omitempty"` // Name holds the value of the "name" field. Name string `json:"name,omitempty"` // Core holds the value of the "core" field. Core string `json:"core,omitempty"` // Memory holds the value of the "memory" field. Memory string `json:"memory,omitempty"` // Image holds the value of the "image" field. Image string `json:"image,omitempty"` // ExpirationTime holds the value of the "expiration_time" field. ExpirationTime time.Time `json:"expiration_time,omitempty"` // 0: 启动中,1:运行中,2:连接中断, 3:过期 Status int8 `json:"status,omitempty"` // 容器id ContainerID string `json:"container_id,omitempty"` // p2p agent Id PeerID string `json:"peer_id,omitempty"` }
type ComputeInstanceCreate ¶
type ComputeInstanceRepo ¶
type ComputeInstanceUsercase ¶
type ComputeInstanceUsercase struct {
// contains filtered or unexported fields
}
func NewComputeInstanceUsercase ¶
func NewComputeInstanceUsercase(specRepo ComputeSpecRepo, instanceRepo ComputeInstanceRepo, imageRepo ComputeImageRepo, logger log.Logger) *ComputeInstanceUsercase
func (*ComputeInstanceUsercase) Create ¶
func (uc *ComputeInstanceUsercase) Create(ctx context.Context, cic *ComputeInstanceCreate) (*ComputeInstance, error)
func (*ComputeInstanceUsercase) ListComputeImage ¶
func (uc *ComputeInstanceUsercase) ListComputeImage(ctx context.Context) ([]*ComputeImage, error)
func (*ComputeInstanceUsercase) ListComputeSpec ¶
func (uc *ComputeInstanceUsercase) ListComputeSpec(ctx context.Context) ([]*ComputeSpec, error)
type ComputeSpec ¶
type ComputeSpecRepo ¶
type ComputeSpecRepo interface { List(ctx context.Context) ([]*ComputeSpec, error) Get(ctx context.Context, id int32) (*ComputeSpec, error) }
type GreeterRepo ¶
type GreeterRepo interface { Save(context.Context, *Greeter) (*Greeter, error) Update(context.Context, *Greeter) (*Greeter, error) FindByID(context.Context, int64) (*Greeter, error) ListByHello(context.Context, string) ([]*Greeter, error) ListAll(context.Context) ([]*Greeter, error) }
GreeterRepo is a Greater repo.
type GreeterUsecase ¶
type GreeterUsecase struct {
// contains filtered or unexported fields
}
GreeterUsecase is a Greeter usecase.
func NewGreeterUsecase ¶
func NewGreeterUsecase(repo GreeterRepo, logger log.Logger) *GreeterUsecase
NewGreeterUsecase new a Greeter usecase.
func (*GreeterUsecase) CreateGreeter ¶
CreateGreeter creates a Greeter, and returns the new Greeter.
type Storage ¶
type Storage struct { ID uuid.UUID `json:"id,omitempty"` // Owner holds the value of the "owner" field. Owner string `json:"owner,omitempty"` // 0: DIR, 1:file Type int32 `json:"type,omitempty"` // Name holds the value of the "name" field. Name string `json:"name,omitempty"` // Cid holds the value of the "cid" field. Cid string `json:"cid,omitempty"` // size Size int32 `json:"size,omitempty"` // LastModify holds the value of the "last_modify" field. LastModify time.Time `json:"last_modify,omitempty"` // ParentID holds the value of the "parent_id" field. ParentID string `json:"parent_id,omitempty"` }
type StorageRepo ¶
type StorageRepo interface { ListStorage(ctx context.Context, owner string, parentId string) ([]*Storage, error) GetStorage(ctx context.Context, id uuid.UUID) (*Storage, error) CreateStorage(ctx context.Context, storage *Storage) error UpdateStorage(ctx context.Context, id uuid.UUID, storage *Storage) error DeleteStorage(ctx context.Context, id uuid.UUID) error }
type Storagecase ¶
type Storagecase struct {
// contains filtered or unexported fields
}
func NewStorageUsecase ¶
func NewStorageUsecase(repo StorageRepo, logger log.Logger) *Storagecase
func (*Storagecase) Create ¶
func (uc *Storagecase) Create(ctx context.Context, storage *Storage) error
type User ¶
type User struct { ID uuid.UUID `json:"id,omitempty"` // CountryCallCoding holds the value of the "country_call_coding" field. CountryCallCoding string `json:"country_call_coding,omitempty"` // TelephoneNumber holds the value of the "telephone_number" field. TelephoneNumber string `json:"telephone_number,omitempty"` // Password holds the value of the "password" field. Password string `json:"password,omitempty"` // CreateDate holds the value of the "create_date" field. CreateDate time.Time `json:"create_date,omitempty"` // LastLoginDate holds the value of the "last_login_date" field. LastLoginDate time.Time `json:"last_login_date,omitempty"` ValidateCode string `json:"validate_code"` // 用户名 Name string `json:"name,omitempty"` // 头像地址 Icon string `json:"icon,omitempty"` }
func (*User) GetFullTelephone ¶
type UserRepo ¶
type UserRepo interface { ListUser(ctx context.Context, entity User) ([]*User, error) GetUser(ctx context.Context, id uuid.UUID) (*User, error) GetUserPassword(ctx context.Context, id uuid.UUID) (*User, error) CreateUser(ctx context.Context, user *User) error UpdateUser(ctx context.Context, id uuid.UUID, user *User) error DeleteUser(ctx context.Context, id uuid.UUID) error SendValidateCode(ctx context.Context, entity User) error GetValidateCode(ctx context.Context, user User) (string, error) DeleteValidateCode(ctx context.Context, user User) FindUserByFullTelephone(ctx context.Context, countryCallCoding string, telephone string) (*User, error) }
type UserUsercase ¶
type UserUsercase struct {
// contains filtered or unexported fields
}
func NewUserUsecase ¶
func (*UserUsercase) GetValidateCode ¶
func (*UserUsercase) LoginWithValidateCode ¶
func (*UserUsercase) SendValidateCode ¶
func (uc *UserUsercase) SendValidateCode(ctx context.Context, entity User) error
Click to show internal directories.
Click to hide internal directories.