Documentation
¶
Index ¶
- type Repository
- func (r *Repository[T]) Add(ctx context.Context, name string, data []byte) error
- func (r *Repository[T]) Delete(ctx context.Context, name string) error
- func (r *Repository[T]) Filename(name string) string
- func (r *Repository[T]) GetRaw(ctx context.Context, name string) ([]byte, error)
- func (r *Repository[T]) List(ctx context.Context) ([]string, error)
- func (r *Repository[T]) Load(ctx context.Context, name string) (*T, error)
- func (r *Repository[T]) Save(ctx context.Context, name string, obj *T) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Repository ¶
type Repository[T any] struct { // contains filtered or unexported fields }
Repository generic CRUD for YAML/JSON resources stored under $AGENTLY_WORKSPACE/<kind>/.
func New ¶
func New[T any](fs afs.Service, kind string) *Repository[T]
New constructs a repository for a specific workspace kind (e.g. "models").
func (*Repository[T]) Delete ¶
func (r *Repository[T]) Delete(ctx context.Context, name string) error
Delete removes file.
func (*Repository[T]) Filename ¶
func (r *Repository[T]) Filename(name string) string
Filename resolves name to absolute path with .yaml default extension.
func (*Repository[T]) List ¶
func (r *Repository[T]) List(ctx context.Context) ([]string, error)
List basenames (without extension).
Click to show internal directories.
Click to hide internal directories.