resource

package
v1.0.41 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GetResourceRequest added in v1.0.35

type GetResourceRequest struct {
	Id      *uint32 `json:"id"`
	Keyword *string `json:"keyword"`
}

type ListResourceRequest added in v1.0.35

type ListResourceRequest struct {
	Page     uint32  `json:"page"`
	PageSize uint32  `json:"pageSize"`
	Order    *string `json:"order"`
	OrderBy  *string `json:"orderBy"`
	Keyword  *string `json:"keyword"`
	Tag      *string `json:"tag"`
	Private  *bool   `json:"private"`
	ServerId *uint32 `json:"serverId"`
}

type Repo

type Repo interface {
	// GetResource 获取指定的资源配置信息
	GetResource(ctx kratosx.Context, id uint32) (*Resource, error)

	// ListResource 获取资源配置信息列表
	ListResource(ctx kratosx.Context, req *ListResourceRequest) ([]*Resource, uint32, error)

	// CreateResource 创建资源配置信息
	CreateResource(ctx kratosx.Context, req *Resource) (uint32, error)

	// UpdateResource 更新资源配置信息
	UpdateResource(ctx kratosx.Context, req *Resource) error

	// DeleteResource 删除资源配置信息
	DeleteResource(ctx kratosx.Context, ids []uint32) (uint32, error)

	// GetResourceByKeyword 获取指定的资源配置信息
	GetResourceByKeyword(ctx kratosx.Context, keyword string) (*Resource, error)

	// ListResourceValue 获取业务配置值信息列表
	ListResourceValue(ctx kratosx.Context, bid uint32) ([]*ResourceValue, uint32, error)

	// UpdateResourceValues 更新业务配置值信息
	UpdateResourceValues(ctx kratosx.Context, bs []*ResourceValue) error

	// AllResourceValue 获取全部可用的值
	AllResourceValue(ctx kratosx.Context, eid, sid uint32) ([]*ResourceValue, error)

	// AllResourceField 获取全部可用的字段
	AllResourceField(ctx kratosx.Context, sid uint32) ([]string, error)
}

type Resource

type Resource struct {
	Id              uint32            `json:"id"`
	Keyword         string            `json:"keyword"`
	Fields          string            `json:"fields"`
	Tag             string            `json:"tag"`
	Private         *bool             `json:"private"`
	Description     *string           `json:"description"`
	CreatedAt       int64             `json:"createdAt"`
	UpdatedAt       int64             `json:"updatedAt"`
	Servers         []*Server         `json:"servers"`
	ResourceServers []*ResourceServer `json:"resourceServers"`
}

type ResourceServer

type ResourceServer struct {
	ServerId   uint32 `json:"serverId"`
	ResourceId uint32 `json:"resourceId"`
}

type ResourceValue

type ResourceValue struct {
	Id         uint32    `json:"id"`
	EnvId      uint32    `json:"envId"`
	ResourceId uint32    `json:"resourceId"`
	Value      string    `json:"value"`
	CreatedAt  int64     `json:"createdAt"`
	UpdatedAt  int64     `json:"updatedAt"`
	Resource   *Resource `json:"resource"`
}

type Server added in v1.0.35

type Server struct {
	Id   uint32 `json:"id"`
	Name string `json:"name"`
}

type UseCase

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

func NewUseCase

func NewUseCase(config *conf.Config, repo Repo) *UseCase

func (*UseCase) CreateResource added in v1.0.35

func (u *UseCase) CreateResource(ctx kratosx.Context, req *Resource) (uint32, error)

CreateResource 创建资源配置信息

func (*UseCase) DeleteResource

func (u *UseCase) DeleteResource(ctx kratosx.Context, ids []uint32) (uint32, error)

DeleteResource 删除资源配置信息

func (*UseCase) GetResource

func (u *UseCase) GetResource(ctx kratosx.Context, req *GetResourceRequest) (*Resource, error)

GetResource 获取指定的资源配置信息

func (*UseCase) ListResource added in v1.0.35

func (u *UseCase) ListResource(ctx kratosx.Context, req *ListResourceRequest) ([]*Resource, uint32, error)

ListResource 获取资源配置信息列表

func (*UseCase) ListResourceValue added in v1.0.35

func (u *UseCase) ListResourceValue(ctx kratosx.Context, bid uint32) ([]*ResourceValue, uint32, error)

ListResourceValue 获取业务配置值信息列表

func (*UseCase) UpdateResource

func (u *UseCase) UpdateResource(ctx kratosx.Context, req *Resource) error

UpdateResource 更新资源配置信息

func (*UseCase) UpdateResourceValue

func (u *UseCase) UpdateResourceValue(ctx kratosx.Context, list []*ResourceValue) error

UpdateResourceValue 更新业务配置值信息

Jump to

Keyboard shortcuts

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