memory

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package memory 提供控制面 repository 接口的内存实现。

它主要服务单元测试、本地示例和无需数据库的轻量运行场景。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminStore

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

AdminStore 是平台管理相关仓储接口的聚合内存实现。

func NewAdminStore

func NewAdminStore() *AdminStore

NewAdminStore 创建空的平台管理内存仓储。

func (*AdminStore) Create

func (s *AdminStore) Create(ctx context.Context, workspace *admin.Workspace) error

func (*AdminStore) CreateWorkspace

func (s *AdminStore) CreateWorkspace(_ context.Context, workspace *admin.Workspace) error

func (*AdminStore) Delete

func (s *AdminStore) Delete(ctx context.Context, workspace string) error

func (*AdminStore) DeleteWorkspace

func (s *AdminStore) DeleteWorkspace(_ context.Context, workspace string) error

func (*AdminStore) Get

func (s *AdminStore) Get(ctx context.Context, workspace string) (*admin.Workspace, error)

func (*AdminStore) GetWorkspace

func (s *AdminStore) GetWorkspace(_ context.Context, workspace string) (*admin.Workspace, error)

func (*AdminStore) List

func (*AdminStore) ListWorkspaces

func (s *AdminStore) ListWorkspaces(_ context.Context, query *repository.WorkspaceQuery) ([]*admin.Workspace, int64, error)

func (*AdminStore) Update

func (s *AdminStore) Update(ctx context.Context, workspace *admin.Workspace) error

func (*AdminStore) UpdateWorkspace

func (s *AdminStore) UpdateWorkspace(_ context.Context, workspace *admin.Workspace) error

type ApprovalStore

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

ApprovalStore 是审批仓储的内存实现。

func NewApprovalStore

func NewApprovalStore() *ApprovalStore

NewApprovalStore 创建空的审批内存仓储。

func (*ApprovalStore) Create

func (s *ApprovalStore) Create(_ context.Context, request *admin.ApprovalRequest) error

func (*ApprovalStore) Decide

func (s *ApprovalStore) Decide(_ context.Context, request *admin.ApprovalRequest) error

func (*ApprovalStore) Get

func (s *ApprovalStore) Get(_ context.Context, workspace string, requestID string) (*admin.ApprovalRequest, error)

func (*ApprovalStore) List

type AuditLogStore

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

AuditLogStore 是审计日志仓储的内存实现。

func NewAuditLogStore

func NewAuditLogStore() *AuditLogStore

NewAuditLogStore 创建空的审计日志内存仓储。

func (*AuditLogStore) Append

func (*AuditLogStore) List

func (s *AuditLogStore) List(_ context.Context, workspace string, resource string, resourceID string, offset int, limit int) ([]*repository.AuditLog, int64, error)

type PermissionStore

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

PermissionStore 是权限仓储的内存实现。

func NewPermissionStore

func NewPermissionStore() *PermissionStore

NewPermissionStore 创建空的权限内存仓储。

func (*PermissionStore) Create

func (s *PermissionStore) Create(_ context.Context, permission *admin.Permission) error

func (*PermissionStore) Delete

func (s *PermissionStore) Delete(_ context.Context, workspace string, permissionID string) error

func (*PermissionStore) Get

func (s *PermissionStore) Get(_ context.Context, workspace string, permissionID string) (*admin.Permission, error)

func (*PermissionStore) List

func (*PermissionStore) Update

func (s *PermissionStore) Update(_ context.Context, permission *admin.Permission) error

type RoleStore

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

RoleStore 是角色仓储的内存实现。

func NewRoleStore

func NewRoleStore() *RoleStore

NewRoleStore 创建空的角色内存仓储。

func (*RoleStore) Create

func (s *RoleStore) Create(_ context.Context, role *admin.Role) error

func (*RoleStore) Delete

func (s *RoleStore) Delete(_ context.Context, workspace string, roleID string) error

func (*RoleStore) Get

func (s *RoleStore) Get(_ context.Context, workspace string, roleID string) (*admin.Role, error)

func (*RoleStore) List

func (s *RoleStore) List(_ context.Context, query *repository.RoleQuery) ([]*admin.Role, int64, error)

func (*RoleStore) Update

func (s *RoleStore) Update(_ context.Context, role *admin.Role) error

type TraceStore

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

TraceStore 是 trace repository 和 event.Sink 的内存实现。

func NewTraceStore

func NewTraceStore() *TraceStore

NewTraceStore 创建空的 trace 内存仓储。

func (*TraceStore) Emit

func (s *TraceStore) Emit(e *event.Event)

func (*TraceStore) GetEvents

func (s *TraceStore) GetEvents(_ context.Context, query *repository.TraceEventQuery) ([]*event.Event, int64, error)

func (*TraceStore) Search

type UserStore

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

UserStore 是用户仓储的内存实现。

func NewUserStore

func NewUserStore() *UserStore

NewUserStore 创建空的用户内存仓储。

func (*UserStore) Create

func (s *UserStore) Create(_ context.Context, user *admin.User) error

func (*UserStore) Get

func (s *UserStore) Get(_ context.Context, userID string) (*admin.User, error)

func (*UserStore) GetByUsername

func (s *UserStore) GetByUsername(_ context.Context, username string) (*admin.User, error)

func (*UserStore) List

func (s *UserStore) List(_ context.Context, query *repository.UserQuery) ([]*admin.User, int64, error)

func (*UserStore) Update

func (s *UserStore) Update(_ context.Context, user *admin.User) error

type WorkflowProgressStore

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

WorkflowProgressStore 是 workflow 环境推进状态仓储的内存实现。

func NewWorkflowProgressStore

func NewWorkflowProgressStore() *WorkflowProgressStore

NewWorkflowProgressStore 创建空的 workflow 推进状态内存仓储。

func (*WorkflowProgressStore) ClearPending

func (s *WorkflowProgressStore) ClearPending(_ context.Context, workspace string, workflowID string, version string, operator string) error

func (*WorkflowProgressStore) Get

func (s *WorkflowProgressStore) Get(_ context.Context, workspace string, workflowID string, version string) (*admin.WorkflowProgress, error)

func (*WorkflowProgressStore) MarkApproved

func (s *WorkflowProgressStore) MarkApproved(_ context.Context, workspace string, workflowID string, version string, pendingEnv string, operator string) error

func (*WorkflowProgressStore) MarkPending

func (s *WorkflowProgressStore) MarkPending(_ context.Context, workspace string, workflowID string, version string, pendingEnv string, operator string) error

func (*WorkflowProgressStore) MarkPublished

func (s *WorkflowProgressStore) MarkPublished(_ context.Context, workspace string, workflowID string, version string, currentEnv string, operator string) error

func (*WorkflowProgressStore) Reset

func (s *WorkflowProgressStore) Reset(_ context.Context, workspace string, workflowID string, version string, operator string) error

type WorkflowStore

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

WorkflowStore 是 workflow 仓储的内存实现。

func NewWorkflowStore

func NewWorkflowStore() *WorkflowStore

NewWorkflowStore 创建空的 workflow 内存仓储。

func (*WorkflowStore) Delete

func (s *WorkflowStore) Delete(_ context.Context, env string, workspace string, workflowID string, version string) error

func (*WorkflowStore) Disable

func (s *WorkflowStore) Disable(_ context.Context, env string, workspace string, workflowID string, version string) error

func (*WorkflowStore) GetPublished

func (s *WorkflowStore) GetPublished(_ context.Context, env string, workspace string, workflowID string, version string) (*core.Workflow, error)

func (*WorkflowStore) GetVersion

func (s *WorkflowStore) GetVersion(_ context.Context, env string, workspace string, workflowID string, version string) (*core.WorkflowVersion, error)

func (*WorkflowStore) List

func (s *WorkflowStore) List(_ context.Context, query *repository.WorkflowQuery) ([]*core.WorkflowVersion, int64, error)

func (*WorkflowStore) Promote

func (s *WorkflowStore) Promote(_ context.Context, sourceEnv string, targetEnv string, workspace string, workflowID string, version string, remark string, publishedBy string) (*core.WorkflowVersion, error)

func (*WorkflowStore) Publish

func (s *WorkflowStore) Publish(_ context.Context, env string, workspace string, workflowID string, version string, remark string, publishedBy string) (*core.WorkflowVersion, error)

func (*WorkflowStore) Save

func (s *WorkflowStore) Save(_ context.Context, workflow *core.Workflow) error

type WorkspaceEnvironmentReferenceStore

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

WorkspaceEnvironmentReferenceStore 为内存仓储组合提供环境引用查询。

func NewWorkspaceEnvironmentReferenceStore

func NewWorkspaceEnvironmentReferenceStore(
	workflows *WorkflowStore,
	progress *WorkflowProgressStore,
	approvals *ApprovalStore,
) *WorkspaceEnvironmentReferenceStore

func (*WorkspaceEnvironmentReferenceStore) Count

type WorkspaceEnvironmentStore

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

WorkspaceEnvironmentStore 是工作空间环境仓储的内存实现。

func NewWorkspaceEnvironmentStore

func NewWorkspaceEnvironmentStore() *WorkspaceEnvironmentStore

NewWorkspaceEnvironmentStore 创建空的工作空间环境内存仓储。

func (*WorkspaceEnvironmentStore) Delete

func (s *WorkspaceEnvironmentStore) Delete(_ context.Context, workspace string, env string) error

func (*WorkspaceEnvironmentStore) Get

func (*WorkspaceEnvironmentStore) List

func (*WorkspaceEnvironmentStore) Save

type WorkspaceMemberStore

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

WorkspaceMemberStore 是工作空间成员仓储的内存实现。

func NewWorkspaceMemberStore

func NewWorkspaceMemberStore() *WorkspaceMemberStore

NewWorkspaceMemberStore 创建空的工作空间成员内存仓储。

func (*WorkspaceMemberStore) Add

func (*WorkspaceMemberStore) Get

func (s *WorkspaceMemberStore) Get(_ context.Context, workspace string, userID string) (*admin.WorkspaceMember, error)

func (*WorkspaceMemberStore) List

func (s *WorkspaceMemberStore) List(_ context.Context, workspace string, offset int, limit int) ([]*admin.WorkspaceMember, int64, error)

func (*WorkspaceMemberStore) Remove

func (s *WorkspaceMemberStore) Remove(_ context.Context, workspace string, userID string) error

func (*WorkspaceMemberStore) UpdateRoles

func (s *WorkspaceMemberStore) UpdateRoles(_ context.Context, workspace string, userID string, roleIDs []string) error

Jump to

Keyboard shortcuts

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