fetcher

package
v0.1.721 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2025 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const (
	SvcUsers               = "users"
	SvcPreferences         = "preferences"
	CollectionUsers        = "users"
	CollectionClients      = "clients"
	CollectionCompanies    = "companies"
	CollectionEmployees    = "employees"
	CollectionLanguages    = "languages"
	CollectionPayments     = "payments"
	CollectionVisibilities = "visibilities"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	contract.FetcherOperator
}

func NewClient

func NewClient(d Dependencies, opts ClientOptions) (Client, error)

type ClientOption

type ClientOption func(*ClientOptions)

func WithFetcherBaseURL

func WithFetcherBaseURL(x *url.URL) ClientOption

func WithLoaded

func WithLoaded(x Loaded) ClientOption

func WithTimeout

func WithTimeout(x time.Duration) ClientOption

func WithUserIDHeaderKey

func WithUserIDHeaderKey(x string) ClientOption

type ClientOptions

type ClientOptions struct {
	Loaded
	Timeout time.Duration
}

func ApplyClientOptions

func ApplyClientOptions(opts *ClientOptions, modifiers ...ClientOption) ClientOptions

type DefaultTool

type DefaultTool struct {
	T *contract.Tool[Client]
}

func NewTool

func NewTool(c Client, opts contract.ToolOptions[Client]) *DefaultTool

func (*DefaultTool) FetchMany

func (d *DefaultTool) FetchMany(ctx context.Context, opts contract.FetchManyOptions) ([]any, error)

FetchMany retrieves multiple documents from a remote collection using query parameters.

func (*DefaultTool) FetchOne

func (d *DefaultTool) FetchOne(ctx context.Context, opts contract.FetchOneOptions) (any, error)

FetchOne retrieves a single document from a remote collection by ID.

type Loaded

type Loaded struct {
	FetcherBaseURL  *url.URL
	UserIDHeaderKey string
}

type Tool

type Tool interface {
	Client
}

Jump to

Keyboard shortcuts

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