baserepo

package
v0.2.21 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

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]) Add

func (r *Repository[T]) Add(ctx context.Context, name string, data []byte) error

Add uploads raw data.

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]) GetRaw

func (r *Repository[T]) GetRaw(ctx context.Context, name string) ([]byte, error)

GetRaw downloads raw bytes.

func (*Repository[T]) List

func (r *Repository[T]) List(ctx context.Context) ([]string, error)

List basenames (without extension).

func (*Repository[T]) Load

func (r *Repository[T]) Load(ctx context.Context, name string) (*T, error)

Load unmarshals YAML/JSON into *T.

func (*Repository[T]) Save

func (r *Repository[T]) Save(ctx context.Context, name string, obj *T) error

Save (Add/overwrite) marshals struct to YAML.

Jump to

Keyboard shortcuts

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