William Petit
8e574c299b
All checks were successful
arcad/edge/pipeline/pr-master This commit looks good
33 lines
828 B
Go
33 lines
828 B
Go
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
|
|
}
|
|
|
|
type Store interface {
|
|
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
|
|
}
|