repo

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFailedToLock  = errors.New("failed to lock")
	ErrAlreadyLocked = errors.New("already locked")
	ErrNotLocked     = errors.New("not locked")
)
View Source
var (
	ErrOperationDenied = errors.New("operation denied")
)

Functions

func DatasetGraphLoaderFrom

func DatasetGraphLoaderFrom(r Dataset) dataset.GraphLoader

func DatasetLoaderFrom

func DatasetLoaderFrom(r Dataset) dataset.Loader

func IterateProjectsByTeam

func IterateProjectsByTeam(repo Project, ctx context.Context, tid id.TeamID, batch int, callback func([]*project.Project) error) error

func LayerLoaderBySceneFrom

func LayerLoaderBySceneFrom(r Layer) layer.LoaderByScene

func LayerLoaderFrom

func LayerLoaderFrom(r Layer) layer.Loader

func PluginLoaderFrom

func PluginLoaderFrom(r Plugin) plugin.Loader

func PropertyLoaderFrom

func PropertyLoaderFrom(r Property) property.Loader

func PropertySchemaLoaderFrom

func PropertySchemaLoaderFrom(r PropertySchema) property.SchemaLoader

func TagLoaderFrom added in v0.5.0

func TagLoaderFrom(r Tag) tag.Loader

func TagSceneLoaderFrom added in v0.5.0

func TagSceneLoaderFrom(r Tag, scenes []id.SceneID) tag.SceneLoader

Types

type Asset

type Asset interface {
	Filtered(TeamFilter) Asset
	FindByTeam(context.Context, id.TeamID, AssetFilter) ([]*asset.Asset, *usecase.PageInfo, error)
	FindByID(context.Context, id.AssetID) (*asset.Asset, error)
	FindByIDs(context.Context, id.AssetIDList) ([]*asset.Asset, error)
	Save(context.Context, *asset.Asset) error
	Remove(context.Context, id.AssetID) error
}

type AssetFilter added in v0.6.0

type AssetFilter struct {
	Sort       *asset.SortType
	Keyword    *string
	Pagination *usecase.Pagination
}

type AuthRequest added in v0.6.0

type AuthRequest interface {
	FindByID(context.Context, id.AuthRequestID) (*auth.Request, error)
	FindByCode(context.Context, string) (*auth.Request, error)
	FindBySubject(context.Context, string) (*auth.Request, error)
	Save(context.Context, *auth.Request) error
	Remove(context.Context, id.AuthRequestID) error
}

type Config

type Config interface {
	LockAndLoad(context.Context) (*config.Config, error)
	Save(context.Context, *config.Config) error
	SaveAndUnlock(context.Context, *config.Config) error
	Unlock(context.Context) error
}

type Container

type Container struct {
	Asset          Asset
	AuthRequest    AuthRequest
	Config         Config
	DatasetSchema  DatasetSchema
	Dataset        Dataset
	Layer          Layer
	Lock           Lock
	Plugin         Plugin
	Project        Project
	PropertySchema PropertySchema
	Property       Property
	Scene          Scene
	SceneLock      SceneLock
	Tag            Tag
	Team           Team
	Transaction    Transaction
	User           User
}

func (*Container) Filtered added in v0.6.0

func (c *Container) Filtered(team TeamFilter, scene SceneFilter) *Container

type Layer

type Layer interface {
	Filtered(SceneFilter) Layer
	FindByID(context.Context, id.LayerID) (layer.Layer, error)
	FindByIDs(context.Context, id.LayerIDList) (layer.List, error)
	FindItemByID(context.Context, id.LayerID) (*layer.Item, error)
	FindItemByIDs(context.Context, id.LayerIDList) (layer.ItemList, error)
	FindAllByDatasetSchema(context.Context, id.DatasetSchemaID) (layer.List, error)
	FindGroupByID(context.Context, id.LayerID) (*layer.Group, error)
	FindGroupByIDs(context.Context, id.LayerIDList) (layer.GroupList, error)
	FindGroupBySceneAndLinkedDatasetSchema(context.Context, id.SceneID, id.DatasetSchemaID) (layer.GroupList, error)
	FindParentByID(context.Context, id.LayerID) (*layer.Group, error)
	FindParentsByIDs(context.Context, id.LayerIDList) (layer.GroupList, error)
	FindByPluginAndExtension(context.Context, id.PluginID, *id.PluginExtensionID) (layer.List, error)
	FindByPluginAndExtensionOfBlocks(context.Context, id.PluginID, *id.PluginExtensionID) (layer.List, error)
	FindByProperty(context.Context, id.PropertyID) (layer.Layer, error)
	FindByScene(context.Context, id.SceneID) (layer.List, error)
	FindByTag(context.Context, id.TagID) (layer.List, error)
	Save(context.Context, layer.Layer) error
	SaveAll(context.Context, layer.List) error
	UpdatePlugin(context.Context, id.PluginID, id.PluginID) error
	Remove(context.Context, id.LayerID) error
	RemoveAll(context.Context, id.LayerIDList) error
	RemoveByScene(context.Context, id.SceneID) error
}

type Lock added in v0.3.0

type Lock interface {
	Lock(context.Context, string) error
	Unlock(context.Context, string) error
}

type Plugin

type Plugin interface {
	Filtered(SceneFilter) Plugin
	FindByID(context.Context, id.PluginID) (*plugin.Plugin, error)
	FindByIDs(context.Context, []id.PluginID) ([]*plugin.Plugin, error)
	Save(context.Context, *plugin.Plugin) error
	Remove(context.Context, id.PluginID) error
}

type Scene

type Scene interface {
	Filtered(TeamFilter) Scene
	FindByID(context.Context, id.SceneID) (*scene.Scene, error)
	FindByIDs(context.Context, id.SceneIDList) (scene.List, error)
	FindByTeam(context.Context, ...id.TeamID) (scene.List, error)
	FindByProject(context.Context, id.ProjectID) (*scene.Scene, error)
	Save(context.Context, *scene.Scene) error
	Remove(context.Context, id.SceneID) error
}

type SceneFilter added in v0.6.0

type SceneFilter struct {
	Readable scene.IDList
	Writable scene.IDList
}

func SceneFilterFromOperator added in v0.6.0

func SceneFilterFromOperator(o *usecase.Operator) SceneFilter

func (SceneFilter) CanRead added in v0.6.0

func (f SceneFilter) CanRead(id scene.ID) bool

func (SceneFilter) CanWrite added in v0.6.0

func (f SceneFilter) CanWrite(id scene.ID) bool

func (SceneFilter) Clone added in v0.6.0

func (f SceneFilter) Clone() SceneFilter

func (SceneFilter) Merge added in v0.6.0

func (f SceneFilter) Merge(g SceneFilter) SceneFilter

type SceneLock

type SceneLock interface {
	GetLock(context.Context, id.SceneID) (scene.LockMode, error)
	GetAllLock(context.Context, id.SceneIDList) ([]scene.LockMode, error)
	SaveLock(context.Context, id.SceneID, scene.LockMode) error
	ReleaseAllLock(context.Context) error
}

type Tag

type Tag interface {
	Filtered(SceneFilter) Tag
	FindByID(context.Context, id.TagID) (tag.Tag, error)
	FindByIDs(context.Context, id.TagIDList) ([]*tag.Tag, error)
	FindByScene(context.Context, id.SceneID) ([]*tag.Tag, error)
	FindItemByID(context.Context, id.TagID) (*tag.Item, error)
	FindItemByIDs(context.Context, id.TagIDList) ([]*tag.Item, error)
	FindGroupByID(context.Context, id.TagID) (*tag.Group, error)
	FindGroupByIDs(context.Context, id.TagIDList) ([]*tag.Group, error)
	FindRootsByScene(context.Context, id.SceneID) ([]*tag.Tag, error)
	FindGroupByItem(context.Context, id.TagID) (*tag.Group, error)
	Save(context.Context, tag.Tag) error
	SaveAll(context.Context, []*tag.Tag) error
	Remove(context.Context, id.TagID) error
	RemoveAll(context.Context, id.TagIDList) error
	RemoveByScene(context.Context, id.SceneID) error
}

type Team

type Team interface {
	FindByUser(context.Context, id.UserID) (user.TeamList, error)
	FindByIDs(context.Context, id.TeamIDList) (user.TeamList, error)
	FindByID(context.Context, id.TeamID) (*user.Team, error)
	Save(context.Context, *user.Team) error
	SaveAll(context.Context, []*user.Team) error
	Remove(context.Context, id.TeamID) error
	RemoveAll(context.Context, id.TeamIDList) error
}

type TeamFilter added in v0.6.0

type TeamFilter struct {
	Readable user.TeamIDList
	Writable user.TeamIDList
}

func TeamFilterFromOperator added in v0.6.0

func TeamFilterFromOperator(o *usecase.Operator) TeamFilter

func (TeamFilter) CanRead added in v0.6.0

func (f TeamFilter) CanRead(id user.TeamID) bool

func (TeamFilter) CanWrite added in v0.6.0

func (f TeamFilter) CanWrite(id user.TeamID) bool

func (TeamFilter) Clone added in v0.6.0

func (f TeamFilter) Clone() TeamFilter

func (TeamFilter) Merge added in v0.6.0

func (f TeamFilter) Merge(g TeamFilter) TeamFilter

type Transaction

type Transaction interface {
	Begin() (Tx, error)
}

type Tx

type Tx interface {
	// Commit informs Tx to commit when End() is called.
	// If this was not called once, rollback is done when End() is called.
	Commit()
	// End finishes the transaction and do commit if Commit() was called once, or else do rollback.
	// This method is supposed to be called in the uscase layer using defer.
	End(context.Context) error
	IsCommitted() bool
}

type User

type User interface {
	FindByIDs(context.Context, id.UserIDList) ([]*user.User, error)
	FindByID(context.Context, id.UserID) (*user.User, error)
	FindByAuth0Sub(context.Context, string) (*user.User, error)
	FindByEmail(context.Context, string) (*user.User, error)
	FindByName(context.Context, string) (*user.User, error)
	FindByNameOrEmail(context.Context, string) (*user.User, error)
	FindByVerification(context.Context, string) (*user.User, error)
	FindByPasswordResetRequest(context.Context, string) (*user.User, error)
	Save(context.Context, *user.User) error
	Remove(context.Context, id.UserID) error
}

Jump to

Keyboard shortcuts

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