Documentation
¶
Overview ¶
Package families opens a client for whichever forge family answers at a connection.
It is the one package that imports all three family packages: the root package imports none, so a consumer can depend on the vocabulary alone, and a registry filled by package initializers is a global this library does not build. A consumer that knows its family calls that family's constructor and pays nothing for detection.
Open answers under the root package's three-way error contract: nil, a *forgeapi.Error, or a context sentinel returned unchanged. Detection's own failure is forgeapi.CodeFamilyUndetected, and it is not a context failure.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Open ¶
func Open(ctx context.Context, conn forgeapi.Connection, opts ...forgeapi.Option) (forgeapi.Core, forgeapi.Family, error)
Open builds a client for conn by asking GitLab's connection read, then GitHub's, then the Gitea family's, and answers the first family whose read establishes it beside that family's client, its connection capabilities held; an optional role it lacks fails a type assertion. It costs that read plus one request per family asked first, at most 2 on GitLab, 3 on GitHub and 5 on the Gitea family, the reads ahead counted by no budget the caller holds; a caller that knows its family calls that family's constructor. No family established is a *forgeapi.Error with forgeapi.CodeFamilyUndetected, forgeapi.FamilyUnknown and the last read's status; the caller's context ending answers its sentinel, and a constructor's refusal returns unchanged. Every client Open built and does not answer is closed before it returns, since the caller never holds one; the client it answers is the caller's to close.
Types ¶
This section is empty.