fs

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package fs provides generic filesystem-backed decoding/loading helpers.

It supplies shared loader infrastructure used by typed workspace loaders.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DecodeFunc

type DecodeFunc[T any] func(node *yml.Node, t *T) error

DecodeFunc is a function type that decodes a YAML node into a specific type

type Option

type Option[T any] func(s *Service[T])

func WithMetaService

func WithMetaService[T any](meta *meta.Service) Option[T]

func WithStore

func WithStore[T any](store workspace.Store, kind string) Option[T]

WithStore configures the loader to read resources from a workspace.Store instead of the filesystem. When set, Load reads bytes via store.Load(ctx, kind, name) then runs the decoder.

type Service

type Service[T any] struct {
	// contains filtered or unexported fields
}

Service provides model data access operations

func New

func New[T any](decoderFunc DecodeFunc[T], options ...Option[T]) *Service[T]

New creates a new model service instance

func (*Service[T]) List

func (s *Service[T]) List(ctx context.Context, URL string) ([]*T, error)

func (*Service[T]) Load

func (s *Service[T]) Load(ctx context.Context, URL string) (*T, error)

Load loads a model from the specified URL

type Validator

type Validator interface {
	Validate(ctx context.Context) error
}

Jump to

Keyboard shortcuts

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