Documentation
¶
Index ¶
- Variables
- func FetchAllPages[T any](ac *client.AlpaconClient, endpoint string, params map[string]string) ([]T, error)
- func FetchCursorPages[T any](ac *client.AlpaconClient, endpoint string, params map[string]string, limit int) ([]T, error)
- func FetchPagesUpTo[T any](ac *client.AlpaconClient, endpoint string, params map[string]string, limit int) ([]T, error)
- func RequireName(name, blankMsg string) (string, error)
- func ResolveByName[T any](ac *client.AlpaconClient, opts ResolveByNameOptions) (*T, error)
- type CursorListResponse
- type ListResponse
- type ResolveByNameOptions
Constants ¶
This section is empty.
Variables ¶
var ErrBlankName = errors.New("blank name")
ErrBlankName marks a resolver's refusal of a name that trims to empty, so a caller can tell it apart from an ordinary not-found with errors.Is instead of matching message text.
Functions ¶
func FetchAllPages ¶ added in v1.0.0
func FetchAllPages[T any](ac *client.AlpaconClient, endpoint string, params map[string]string) ([]T, error)
FetchAllPages walks every page. It is FetchPagesUpTo with no bound.
func FetchCursorPages ¶ added in v1.9.2
func FetchCursorPages[T any](ac *client.AlpaconClient, endpoint string, params map[string]string, limit int) ([]T, error)
FetchCursorPages follows the Elasticsearch cursor contract, accumulating up to limit items.
func FetchPagesUpTo ¶ added in v1.11.0
func FetchPagesUpTo[T any](ac *client.AlpaconClient, endpoint string, params map[string]string, limit int) ([]T, error)
FetchPagesUpTo walks PageNumber pages until it has limit items, so a caller asking for more than one page's worth is not silently cut off at the server's page cap.
func RequireName ¶ added in v1.13.2
RequireName trims name and refuses it if empty, returning an error satisfying errors.Is(err, ErrBlankName) with blankMsg as its message.
func ResolveByName ¶ added in v1.13.2
func ResolveByName[T any](ac *client.AlpaconClient, opts ResolveByNameOptions) (*T, error)
ResolveByName looks up a single resource through a server-side, exact-match name filter. A blank name is refused up front—an empty filter comes back as the whole list, not "found".
Types ¶
type CursorListResponse ¶ added in v1.9.2
CursorListResponse decodes the Elasticsearch cursor-pagination contract (base64 next token, not ListResponse's int page).
type ListResponse ¶
type ResolveByNameOptions ¶ added in v1.13.2
type ResolveByNameOptions struct {
Endpoint string
FilterKey string
Name string
BlankMsg string
NotFoundMsg string
}
ResolveByNameOptions names ResolveByName's parameters so a call site cannot swap two same-typed fields (e.g. blankMsg/notFoundMsg) without the compiler seeing a field name change.