interactor

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2021 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultBasePath string

Functions

func NewAsset

func NewAsset(assetRepository repository.Asset, tag *client.Tag) usecase.Asset

Types

type Asset

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

func (*Asset) AddAssetFromImagePath

func (a *Asset) AddAssetFromImagePath(ws model.WSName, filePath string) (model.AssetID, error)

func (*Asset) AddAssetFromImagePathIfDoesNotExist

func (a *Asset) AddAssetFromImagePathIfDoesNotExist(ws model.WSName, filePath string) (model.AssetID, bool, error)

func (*Asset) AddAssetFromImagePathListIfDoesNotExist

func (a *Asset) AddAssetFromImagePathListIfDoesNotExist(ws model.WSName, filePathList []string) ([]model.AssetID, error)

func (*Asset) AssignBoundingBox

func (a *Asset) AssignBoundingBox(ws model.WSName, assetID model.AssetID, box *model.BoundingBox) (*model.Asset, error)

AssignBoundingBox assign bounding box to asset

func (*Asset) BatchUpdateByID added in v0.1.6

func (a *Asset) BatchUpdateByID(ws model.WSName, assets []*model.Asset, queries []*model.Query) (updatedAssets, filteredAssets, skippedAssets []*model.Asset, err error)

BatchUpdateByID update by provided assets. If DB already has same ID asset, merge it and provided asset, then save the asset. If DB does not have same ID asset, do nothing and return as skippedAssets. queries can be nil. Only assets that match queries will be merged. Unmatched assets will be returned as filteredAssets.

func (*Asset) BatchUpdateByPath added in v0.1.6

func (a *Asset) BatchUpdateByPath(ws model.WSName, assets []*model.Asset, queries []*model.Query) (updatedAssets, filteredAssets, skippedAssets []*model.Asset, err error)

BatchUpdateByPath update by provided assets. If DB already has same ID asset, merge it and provided asset, then save the asset. If DB does not have same ID asset, do nothing and return as skippedAssets. queries can be nil. Only assets that match queries will be merged. Note: filteredAssets will be returned with updated properties, not original.

func (*Asset) DeleteBoundingBox

func (a *Asset) DeleteBoundingBox(ws model.WSName, assetID model.AssetID, boxID model.BoundingBoxID) error

func (*Asset) Init

func (a *Asset) Init(ws model.WSName) error

func (*Asset) ListAsyncByQueries

func (a *Asset) ListAsyncByQueries(ctx context.Context, ws model.WSName, queries []*model.Query) (<-chan *model.Asset, error)

func (*Asset) ListAsyncWithFormat

func (a *Asset) ListAsyncWithFormat(wsName model.WSName, formatType string, capacity int) (<-chan string, <-chan error, error)

func (*Asset) ModifyBoundingBox

func (a *Asset) ModifyBoundingBox(ws model.WSName, assetID model.AssetID, box *model.BoundingBox) (*model.Asset, error)

func (*Asset) ReadImportAssetsWithProgressBar

func (a *Asset) ReadImportAssetsWithProgressBar(ws model.WSName, reader io.Reader, capacity int, f func(assets []*model.ImportAsset) error) error

func (*Asset) SaveImportAssets added in v0.1.6

func (a *Asset) SaveImportAssets(ws model.WSName, importAssets []*model.ImportAsset, queries []*model.Query) (addedAssets, updatedAssets, skippedAssets []*model.Asset, err error)

SaveImportAssets updates assets by ID or path. If ID is specified, find asset by ID and update properties. (includes path if it specified) If ID is not specified and path is specified, find asset by path and update properties. Specified properties are updated and omitted properties are reserved. queries can be nil. Only assets that match queries will be merged.

func (*Asset) SaveImportAssetsFromReader added in v0.1.6

func (a *Asset) SaveImportAssetsFromReader(ws model.WSName, reader io.Reader, capacity int, queries []*model.Query) error

SaveImportAssetsFromReader updates by Id or path that provided from reader. If ID is specified, find asset by ID and update properties. (includes path if it specified) If ID is not specified and path is specified, find asset by path and update properties. Specified properties are updated and omitted properties are reserved. The number of assets specified by capacity is buffered and processed at one time. queries can be nil. Only assets that match queries will be merged.

func (*Asset) UnAssignBoundingBox

func (a *Asset) UnAssignBoundingBox(ws model.WSName, assetID model.AssetID, boxID model.BoundingBoxID) (*model.Asset, error)

type AssetImportResult

type AssetImportResult struct {
	Asset *model.ImportAsset
	Err   error
}

type Migration

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

func NewMigration

func NewMigration(assetRepository repository.Asset, metaRepository repository.Meta) *Migration

func (*Migration) Migrate

func (m *Migration) Migrate() error

type Tag

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

func NewTag

func NewTag(c *client.Tag) *Tag

func (*Tag) List

func (a *Tag) List(ws model.WSName) (tags []*model.Tag, err error)

func (*Tag) SaveTags

func (a *Tag) SaveTags(ws model.WSName, tags []*model.Tag) (newTags []*model.Tag, err error)

SaveTags persists tags and return saved tags. For each tag, if the tag already exists, update it. Otherwise add new tag with new ID. If model.Tag has non zero value but the tag which have the ID is not persisted, fail immediately and remain tags are not proceeded.

func (*Tag) SetTagByNames

func (a *Tag) SetTagByNames(ws model.WSName, tagNames []string) (tags []*model.Tag, err error)

SetTagByNames set provided tags. All existing tags will be replaced. (Internally, this method recreate tag bucket)

func (*Tag) SetTags

func (a *Tag) SetTags(ws model.WSName, tags []*model.UnindexedTag) (newTags []*model.Tag, err error)

SetTags persists tags and return saved tags.

type UseCases

type UseCases struct {
	Asset     usecase.Asset
	Tag       *Tag
	Migration *Migration
	Client    *client.Client
}

func New

func New(asset repository.Asset, tag *client.Tag, workspace repository.WorkSpace, meta repository.Meta) *UseCases

func (*UseCases) Close

func (u *UseCases) Close() error

func (*UseCases) InitializeWorkSpace

func (u *UseCases) InitializeWorkSpace(ws model.WSName) error

Jump to

Keyboard shortcuts

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