service

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: May 1, 2023 License: MIT Imports: 16 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAppModule added in v0.0.7

func GetAppModule() application.Module

GetAppModule ...

func SetAppModule added in v0.0.7

func SetAppModule(m application.Module)

SetAppModule ...

Types

type AboutService added in v0.0.7

type AboutService interface {
	GetInfo(ctx context.Context) (*vo.About, error)

	IsDebug() bool
	IsRelease() bool
}

AboutService ...

type AppDataService

type AppDataService interface {
	GetAppDataDirectory() string

	GetSQLiteDBFile() string

	GetMainRepositoryPath() string

	GetBackupDumpDirectory() string

	GetBackupExecutableFile(sum util.Hex) string

	// get root dir
	GetRoot() afs.Path

	GetPath(opt *GetPathOptions) afs.Path

	Ready() bool

	Setup() error
}

AppDataService ...

type AppRuntimeService added in v0.1.1

type AppRuntimeService interface {

	// 取当前 exe 文件的 sha-256
	GetAppHash() (util.Hex, error)

	// 从 runtime.json 中读取日志信息
	ReadStartupLogs() (*backup.StartupVO, error)
}

AppRuntimeService ... 主要用来记录运行日志

type CacheService added in v0.1.1

type CacheService interface {
	GetManager() caches.Manager
}

CacheService 提供统一的缓存服务

type CheckUpdateService added in v0.0.14

type CheckUpdateService interface {

	// 检查更新的版本
	Check(ctx context.Context, o *vo.AboutCheckUpdate) error

	// 忽略指定的版本
	Ignore(ctx context.Context, o *vo.AboutCheckUpdate) error
}

CheckUpdateService 检查更新 WPM 版本

type ContentTypeService added in v0.0.14

type ContentTypeService interface {
	Find(ctx context.Context, id dxo.ContentTypeID) (*dto.ContentType, error)

	ListAll(ctx context.Context) ([]*dto.ContentType, error)

	ListByPattern(ctx context.Context, pattern string) ([]*dto.ContentType, error)

	Insert(ctx context.Context, o *dto.ContentType) (*dto.ContentType, error)
	Update(ctx context.Context, id dxo.ContentTypeID, o *dto.ContentType) (*dto.ContentType, error)
	Remove(ctx context.Context, id dxo.ContentTypeID) error

	// 根据文件名(或路径)查询对应的mime类型
	GetContentType(ctx context.Context, name string) (string, error)

	// LocateProject: 如果没有给出有效的参数 path,那么就用 o.FullPath 代替
	LocateProject(ctx context.Context, o *dto.Project, path string) error
}

ContentTypeService ...

type DatabaseBackupService added in v0.0.15

type DatabaseBackupService interface {
	Export(c context.Context, o *dto.Backup) (*dto.Backup, error)

	Import(c context.Context, o *dto.Backup) (*dto.Backup, error)

	ListAll(c context.Context) ([]*dto.Backup, error)

	// 导入转存数据
	ImportDumpData(c context.Context, form, to util.Time) error

	// 导出转存数据
	ExportDumpData(c context.Context) error
}

DatabaseBackupService ...

type ExampleService

type ExampleService interface {
	Find(ctx context.Context, id dxo.ExampleID) (*dto.Example, error)

	ListAll(ctx context.Context) ([]*dto.Example, error)

	Insert(ctx context.Context, o *dto.Example) (*dto.Example, error)
	Update(ctx context.Context, id dxo.ExampleID, o *dto.Example) (*dto.Example, error)
	Remove(ctx context.Context, id dxo.ExampleID) error
}

ExampleService ...

type ExecutableImportService

type ExecutableImportService interface {
	Save(ctx context.Context, o *vo.ExecutableImport) (*vo.ExecutableImport, error)

	Locate(ctx context.Context, o *vo.ExecutableImport) (*vo.ExecutableImport, error)

	ImportPresets(ctx context.Context) error
}

ExecutableImportService ...

type ExecutableOptions added in v0.1.2

type ExecutableOptions struct {
	SkipFileChecking bool
	IgnoreException  bool
}

ExecutableOptions ...

type ExecutableService

type ExecutableService interface {
	Find(ctx context.Context, id dxo.ExecutableID, opt *ExecutableOptions) (*dto.Executable, error)

	FindByPath(ctx context.Context, path string, opt *ExecutableOptions) (*dto.Executable, error)

	FindByName(ctx context.Context, name string, opt *ExecutableOptions) (*dto.Executable, error)

	ListAll(ctx context.Context, opt *ExecutableOptions) ([]*dto.Executable, error)

	Insert(ctx context.Context, o *dto.Executable, opt *ExecutableOptions) (*dto.Executable, error)

	Update(ctx context.Context, id dxo.ExecutableID, o *dto.Executable, opt *ExecutableOptions) (*dto.Executable, error)

	Remove(ctx context.Context, id dxo.ExecutableID, opt *ExecutableOptions) error
}

ExecutableService ...

type FileQueryService added in v0.0.7

type FileQueryService interface {
	Query(ctx context.Context, q *vo.FileQuery) (*vo.FileQuery, error)
}

FileQueryService ...

type FileSystemService added in v0.0.12

type FileSystemService interface {
	FS() afs.FS

	Path(path string) afs.Path
}

FileSystemService ...

type GetPathOptions added in v0.1.8

type GetPathOptions struct {
	Type string
	ID   string
	Name string
}

GetPathOptions 是用于 AppDataService.GetPath 的选项

type HTTPClientExService added in v0.1.2

type HTTPClientExService interface {
	FetchOnlineDoc(ctx context.Context, url string, opt *HTTPClientOptions) (*vo.Online, error)
}

HTTPClientExService ...

type HTTPClientOptions added in v0.1.1

type HTTPClientOptions struct {
	MaxContentLength   int64
	OverrideTargetFile bool
	FileOptions        *afs.Options
}

HTTPClientOptions ...

type HTTPClientResult added in v0.1.1

type HTTPClientResult struct {
	ContentLength int64
	ContentType   string
	Status        int
	StatusText    string
}

HTTPClientResult ...

type HTTPClientService added in v0.1.1

type HTTPClientService interface {

	// 通过 HTTP 协议获取文本
	FetchText(ctx context.Context, url string, opt *HTTPClientOptions) (string, *HTTPClientResult, error)

	// 通过 HTTP 协议获取二进制数据
	FetchBinary(ctx context.Context, url string, opt *HTTPClientOptions) ([]byte, *HTTPClientResult, error)

	// 通过 HTTP 协议获取 JSON 对象
	FetchJSON(ctx context.Context, url string, obj any, opt *HTTPClientOptions) (*HTTPClientResult, error)

	// 通过 HTTP 协议获取文件
	FetchToFile(ctx context.Context, url string, dst afs.Path, opt *HTTPClientOptions) (*HTTPClientResult, error)

	// 通过 HTTP 协议获取流
	FetchToStream(ctx context.Context, url string, dst io.Writer, opt *HTTPClientOptions) (*HTTPClientResult, error)
}

HTTPClientService ...

type InitService added in v0.1.0

type InitService interface {
	InitGet(ctx context.Context) (*vo.Init, error)

	InitSet(ctx context.Context, o *vo.Init) (*vo.Init, error)
}

InitService ...

type IntentHandlerService

type IntentHandlerService interface {
	HandleIntent(i *dto.Intent) error
}

IntentHandlerService ...

type IntentService

type IntentService interface {
	Run(ctx context.Context, o *dto.Intent) (*dto.Intent, error)
}

IntentService ...

type IntentTemplateEntityCache added in v0.1.2

type IntentTemplateEntityCache interface {
	ListTemplates() ([]*entity.IntentTemplate, error)
}

IntentTemplateEntityCache ...

type IntentTemplateService

type IntentTemplateService interface {
	Find(ctx context.Context, id dxo.IntentTemplateID) (*dto.IntentTemplate, error)

	ListAll(ctx context.Context) ([]*dto.IntentTemplate, error)

	ListMacroProperties(ctx context.Context) (map[string]string, error)

	// find items by Action & Executable & Target & Type
	ListBySelector(ctx context.Context, sel *dto.IntentTemplate) ([]*dto.IntentTemplate, error)

	Insert(ctx context.Context, o *dto.IntentTemplate) (*dto.IntentTemplate, error)

	Update(ctx context.Context, id dxo.IntentTemplateID, o *dto.IntentTemplate) (*dto.IntentTemplate, error)

	Remove(ctx context.Context, id dxo.IntentTemplateID) error

	ImportPreset(ctx context.Context) error
}

IntentTemplateService ...

type JSONBufferService added in v0.1.2

type JSONBufferService interface {
	Get(ctx context.Context) (*vo.Online, error)

	Reset(ctx context.Context) error

	Put(ctx context.Context, o *vo.Online) error
}

JSONBufferService ...

type LocalRepositoryFinder

type LocalRepositoryFinder interface {
	Search(ctx context.Context, path string, depthLimit int) ([]*dto.LocalRepository, error)
	Locate(ctx context.Context, path string) (*dto.LocalRepository, error)
	LocateLayout(ctx context.Context, path string) (store.RepositoryLayout, error)
}

LocalRepositoryFinder 。。。

type LocalRepositoryOptions added in v0.0.12

type LocalRepositoryOptions struct {
	WithFileState  bool
	WithGitStatus  bool
	WithProjects   bool
	WithWorktrees  bool
	WithSubmodules bool
	All            bool
}

LocalRepositoryOptions ...

type LocalRepositoryService

LocalRepositoryService ...

type LocalRepositoryStateLoader

type LocalRepositoryStateLoader interface {
	LoadState(ctx context.Context, repo *dto.LocalRepository) error
}

LocalRepositoryStateLoader 。。。

type LocationOptions added in v0.1.1

type LocationOptions struct {
	All           bool
	WithFileState bool
	WithGitStatus bool
}

LocationOptions ...

type LocationService added in v0.1.1

type LocationService interface {
	Find(ctx context.Context, id dxo.LocationID, opt *LocationOptions) (*dto.Location, error)

	FindByPath(ctx context.Context, path string, opt *LocationOptions) (*dto.Location, error)

	ListAll(ctx context.Context, opt *LocationOptions) ([]*dto.Location, error)

	Insert(ctx context.Context, o *dto.Location) (*dto.Location, error)
	Update(ctx context.Context, id dxo.LocationID, o *dto.Location) (*dto.Location, error)
	Remove(ctx context.Context, id dxo.LocationID) error

	InsertOrFetch(ctx context.Context, o *dto.Location, options *LocationOptions) (*dto.Location, error)
}

LocationService ...

type MainRepositoryService

type MainRepositoryService interface {
	GetInfo(ctx context.Context) (*dto.MainRepository, error)

	GetRepository(ctx context.Context) (store.Repository, error)
}

MainRepositoryService ...

type MediaOptions added in v0.0.14

type MediaOptions struct {
	All             bool
	WithFileState   bool
	FetchFromSource bool // 如果本地没有对应的缓存内容,就从源 URL 拉取
}

MediaOptions ...

type MediaService

type MediaService interface {
	Find(ctx context.Context, id dxo.MediaID, opt *MediaOptions) (*dto.Media, error)

	FindByIDs(ctx context.Context, ids []dxo.MediaID, opt *MediaOptions) ([]*dto.Media, error)

	FindByPath(ctx context.Context, path string, opt *MediaOptions) (*dto.Media, error)

	PrepareForDownload(ctx context.Context, me *dto.Media) (*dto.Media, error)

	ListAll(ctx context.Context, opt *MediaOptions) ([]*dto.Media, error)

	ComputeMediaPath(ctx context.Context, me *dto.Media) (afs.Path, error)

	ImportPresets(ctx context.Context) error

	Insert(ctx context.Context, o *dto.Media, opt *MediaOptions) (*dto.Media, error)

	Update(ctx context.Context, id dxo.MediaID, o *dto.Media, opt *MediaOptions) (*dto.Media, error)

	Remove(ctx context.Context, id dxo.MediaID) error
}

MediaService ...

type NamespaceService added in v0.1.1

type NamespaceService interface {
	Find(ctx context.Context, id dxo.NamespaceID) (*dto.Namespace, error)

	ListAll(ctx context.Context) ([]*dto.Namespace, error)

	Insert(ctx context.Context, o *dto.Namespace) (*dto.Namespace, error)
	Update(ctx context.Context, id dxo.NamespaceID, o *dto.Namespace) (*dto.Namespace, error)
	Remove(ctx context.Context, id dxo.NamespaceID) error
}

NamespaceService ...

type OptionService added in v0.1.4

type OptionService interface {
	GetOptions(o *vo.Option) error
}

OptionService ...

type PlatformProvider

type PlatformProvider interface {
	Accept(p *dto.Platform) bool
	GetProfile(p *dto.Profile) error
}

PlatformProvider ...

type PlatformProviderRegistration

type PlatformProviderRegistration struct {
	Provider PlatformProvider
}

PlatformProviderRegistration ...

type PlatformProviderRegistry

type PlatformProviderRegistry interface {
	GetRegistration() *PlatformProviderRegistration
}

PlatformProviderRegistry ...

type PlatformService

type PlatformService interface {
	GetPlatform() (*dto.Platform, error)
	GetProvider() (PlatformProvider, error)
}

PlatformService ...

type PresetService added in v0.1.1

type PresetService interface {
	GetPresets() (*vo.Online, error)
}

PresetService ...

type ProfileService

type ProfileService interface {
	GetProfile() (*dto.Profile, error)
}

ProfileService ...

type ProjectImportService

type ProjectImportService interface {
	Find(ctx context.Context, o *vo.ProjectImport) (*vo.ProjectImport, error)
	FindOrLocate(ctx context.Context, o *vo.ProjectImport) (*vo.ProjectImport, error)
	Locate(ctx context.Context, o *vo.ProjectImport) (*vo.ProjectImport, error)
	Save(ctx context.Context, o *vo.ProjectImport) (*vo.ProjectImport, error)
}

ProjectImportService ...

type ProjectOptions added in v0.0.14

type ProjectOptions struct {
	All bool

	WithFileState bool
	WithGitStatus bool
}

ProjectOptions ...

type ProjectService

type ProjectService interface {

	// getter
	Find(ctx context.Context, id dxo.ProjectID, options *ProjectOptions) (*dto.Project, error)

	FindByOwnerRepository(ctx context.Context, id dxo.LocalRepositoryID, options *ProjectOptions) ([]*dto.Project, error)

	FindByPath(ctx context.Context, path string, options *ProjectOptions) (*dto.Project, error)

	ListAll(ctx context.Context, options *ProjectOptions) ([]*dto.Project, error)

	ListByIds(ctx context.Context, ids []dxo.ProjectID, options *ProjectOptions) ([]*dto.Project, error)

	Locate(ctx context.Context, o *dto.Project, options *ProjectOptions) (*dto.Project, error)

	Insert(ctx context.Context, o *dto.Project) (*dto.Project, error)
	Update(ctx context.Context, id dxo.ProjectID, o *dto.Project) (*dto.Project, error)
	Remove(ctx context.Context, id dxo.ProjectID) error

	InsertOrFetch(ctx context.Context, o *dto.Project, options *ProjectOptions) (*dto.Project, error)
}

ProjectService ...

type ProjectTypeImportService added in v0.0.14

type ProjectTypeImportService interface {
	ImportTypesFromPreset(ctx context.Context) error
}

ProjectTypeImportService ...

type RemoteRepositoryService

RemoteRepositoryService ...

type RepositoryImportService

type RepositoryImportService interface {
	Find(ctx context.Context, o *vo.RepositoryImport) (*vo.RepositoryImport, error)
	Locate(ctx context.Context, o *vo.RepositoryImport) (*vo.RepositoryImport, error)
	FindOrLocate(ctx context.Context, o *vo.RepositoryImport) (*vo.RepositoryImport, error)
	Save(ctx context.Context, o *vo.RepositoryImport) (*vo.RepositoryImport, error)
}

RepositoryImportService ...

type RepositoryWorktreeProjectService added in v0.1.1

type RepositoryWorktreeProjectService interface {
	Find(c context.Context, o *vo.RepositoryWorktreeProject) (*vo.RepositoryWorktreeProject, error)
	Save(c context.Context, o *vo.RepositoryWorktreeProject) (*vo.RepositoryWorktreeProject, error)
}

RepositoryWorktreeProjectService ...

type SettingService added in v0.0.14

type SettingService interface {
	ListAll() map[string]string

	PutString(name, value string)
	GetString(name, defaultValue string) string

	PutSettings(o *dto.Settings) error
	GetSettings() (*dto.Settings, error)
}

SettingService ...

type SetupRegistration added in v0.1.0

type SetupRegistration struct {
	ID        dxo.SetupID
	Name      string
	Prototype *dto.Setup
	Handler   func(c context.Context, item *dto.Setup) error
}

SetupRegistration ...

type SetupService added in v0.1.0

type SetupService interface {
	IsSetupReqiured(ctx context.Context) (bool, error)

	ListAll(ctx context.Context) ([]*dto.Setup, error)

	Apply(ctx context.Context, items []*dto.Setup) error

	SkipAll(ctx context.Context) error
}

SetupService ...

type SoftwarePackageService added in v0.1.1

type SoftwarePackageService interface {
	Find(ctx context.Context, id dxo.SoftwarePackageID) (*dto.SoftwarePackage, error)

	ListAll(ctx context.Context) ([]*dto.SoftwarePackage, error)

	ListByModuleName(ctx context.Context, moduleName string) ([]*dto.SoftwarePackage, error)

	Insert(ctx context.Context, o *dto.SoftwarePackage) (*dto.SoftwarePackage, error)

	UpdateItem(ctx context.Context, id dxo.SoftwarePackageID, o *dto.SoftwarePackage) (*dto.SoftwarePackage, error)

	UpdateList(ctx context.Context) error

	Remove(ctx context.Context, id dxo.SoftwarePackageID) error

	Install(ctx context.Context, id dxo.SoftwarePackageID) error

	Uninstall(ctx context.Context, id dxo.SoftwarePackageID) error

	GetPacksManger() packs.Manager
}

SoftwarePackageService ...

type SoftwareSetService added in v0.1.1

type SoftwareSetService interface {
	GetOne(ctx context.Context, id dxo.SoftwarePackageID) (*dto.SoftwareSet, error)

	ListAll(ctx context.Context) ([]*dto.SoftwareSet, error)

	Install(ctx context.Context, ss *dto.SoftwareSet) error

	ReInstall(ctx context.Context, ss *dto.SoftwareSet) error

	Uninstall(ctx context.Context, ss *dto.SoftwareSet) error

	Upgrade(ctx context.Context, ss *dto.SoftwareSet) error
}

SoftwareSetService ...

type TrashService added in v0.1.2

type TrashService interface {
	OnInsert()

	OnDelete()

	EnableAutoCleanBeforeInsert(en bool)

	Clean() error
}

TrashService ...

type UUIDGenService

type UUIDGenService interface {
	GenerateUUID(seed string) dxo.UUID
}

UUIDGenService ...

type WorktreeOptions added in v0.1.1

type WorktreeOptions struct {
	All           bool
	WithFileState bool
	WithGitStatus bool
}

WorktreeOptions ...

type WorktreeService added in v0.1.1

type WorktreeService interface {
	Find(ctx context.Context, id dxo.WorktreeID, opt *WorktreeOptions) (*dto.Worktree, error)

	FindByPath(ctx context.Context, path string, opt *WorktreeOptions) (*dto.Worktree, error)

	ListAll(ctx context.Context, opt *WorktreeOptions) ([]*dto.Worktree, error)

	Insert(ctx context.Context, o *dto.Worktree) (*dto.Worktree, error)
	Update(ctx context.Context, id dxo.WorktreeID, o *dto.Worktree) (*dto.Worktree, error)
	Remove(ctx context.Context, id dxo.WorktreeID) error

	InsertOrFetch(ctx context.Context, o *dto.Worktree, opt *WorktreeOptions) (*dto.Worktree, error)
}

WorktreeService ...

Jump to

Keyboard shortcuts

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