Versions in this module Expand all Collapse all v2 v2.0.0 Sep 21, 2026 Changes in this version + const DefaultMaxBytes + var ErrNoFetcher = errors.New("parserkit: source has no fetcher") + var ErrSourceTooLarge = errors.New("parserkit: source exceeds MaxBytes") + func ReadLimited(r io.Reader, maxBytes int64) ([]byte, error) + type BytesFetcher []byte + func (b BytesFetcher) Fetch(_ context.Context, maxBytes int64) ([]byte, error) + type DataLoader interface + Load func(ctx context.Context, sources ...Source) ([]T, error) + LoadOne func(ctx context.Context, fetcher Fetcher) ([]T, error) + func NewLoaderWithNormalize[T any](opts *LoadOptions[T], normalizeFunc NormalizeFunc[T]) (DataLoader[T], error) + func NewLoader[T any](opts *LoadOptions[T]) (DataLoader[T], error) + type Fetcher interface + Fetch func(ctx context.Context, maxBytes int64) ([]byte, error) + type FileFetcher struct + func File(path string) *FileFetcher + func (f *FileFetcher) AllowMissing() *FileFetcher + func (f *FileFetcher) Fetch(_ context.Context, maxBytes int64) ([]byte, error) + func (f *FileFetcher) Path() string + type KeyFunc func(T) (string, bool) + type LoadOptions struct + AllowEmptyData bool + KeyFunc KeyFunc[T] + LoadStrategy LoadStrategy + MaxBytes int64 + func DefaultLoadOptions[T any]() *LoadOptions[T] + type LoadStrategy string + const LoadStrategyFallback + const LoadStrategyMerge + type NormalizeFunc func([]T) []T + type Source struct + Fetcher Fetcher + Priority int + func At(priority int, fetcher Fetcher) Source Other modules containing this package github.com/soulteary/parser-kit github.com/soulteary/parser-kit/v3