2023-04-13 10:16:48 +02:00
|
|
|
package share
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"forge.cadoles.com/arcad/edge/pkg/app"
|
|
|
|
)
|
|
|
|
|
|
|
|
type ResourceID string
|
|
|
|
|
|
|
|
type Resource interface {
|
|
|
|
ID() ResourceID
|
|
|
|
Origin() app.ID
|
|
|
|
Attributes() []Attribute
|
|
|
|
}
|
|
|
|
|
|
|
|
type Attribute interface {
|
|
|
|
Name() string
|
|
|
|
Value() any
|
|
|
|
Type() ValueType
|
|
|
|
UpdatedAt() time.Time
|
|
|
|
CreatedAt() time.Time
|
|
|
|
}
|
|
|
|
|
2023-09-13 06:03:25 +02:00
|
|
|
type Store interface {
|
2023-04-13 10:16:48 +02:00
|
|
|
DeleteResource(ctx context.Context, origin app.ID, resourceID ResourceID) error
|
|
|
|
FindResources(ctx context.Context, funcs ...FindResourcesOptionFunc) ([]Resource, error)
|
|
|
|
GetResource(ctx context.Context, origin app.ID, resourceID ResourceID) (Resource, error)
|
|
|
|
UpdateAttributes(ctx context.Context, origin app.ID, resourceID ResourceID, attributes ...Attribute) (Resource, error)
|
|
|
|
DeleteAttributes(ctx context.Context, origin app.ID, resourceID ResourceID, names ...string) error
|
|
|
|
}
|