Documentation ¶
Index ¶
- type GitHubRateLimitResponse
- type OptionFn
- func WithContextValue(key, value string) OptionFn
- func WithExcludeGit(exclude bool) OptionFn
- func WithExtraFunctions() OptionFn
- func WithGitHub() OptionFn
- func WithGitHubClientGetter(getter func() *githubv4.Client) OptionFn
- func WithGitHubPostRequestHook(f func()) OptionFn
- func WithGitHubPreRequestHook(f func()) OptionFn
- func WithGitHubRateLimitHandler(handler func(*GitHubRateLimitResponse)) OptionFn
- func WithLogger(logger *zerolog.Logger) OptionFn
- func WithNPM() OptionFn
- func WithNPMHttpClient(client *http.Client) OptionFn
- func WithRepoLocator(loc services.RepoLocator) OptionFn
- func WithSourcegraph() OptionFn
- func WithSourcegraphClientGetter(getter func() *graphql.Client) OptionFn
- type Options
- type RepoLocatorFn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GitHubRateLimitResponse ¶
type GitHubRateLimitResponse struct { Cost int Limit int NodeCount int Remaining int ResetAt githubv4.DateTime Used int }
GitHubRateLimitResponse represents metadata about the caller's rate limit, returned by the GitHub GraphQL API
type OptionFn ¶
type OptionFn func(*Options)
OptionFn represents any function capable of customising or providing options
func WithContextValue ¶
WithContextValue sets a value on the options context. It will override any existing value set with the same key
func WithExcludeGit ¶
WithExcludeGit sets whether or not to exclude git functionality
func WithExtraFunctions ¶
func WithExtraFunctions() OptionFn
WithExtraFunctions configures the extension to also register the bundled utility sql routines.
func WithGitHub ¶
func WithGitHub() OptionFn
WithGitHub configures the extension to also register the GitHub related tables and funcs
func WithGitHubClientGetter ¶
WithGitHubClientGetter configures a way to use a custom GitHubv4 client
func WithGitHubPostRequestHook ¶
func WithGitHubPostRequestHook(f func()) OptionFn
WithGitHubPostRequestHook configures a way to use a custom GitHub API rate limit handler
func WithGitHubPreRequestHook ¶
func WithGitHubPreRequestHook(f func()) OptionFn
WithGitHubPreRequestHook configures a way to use a custom GitHub API rate limit handler
func WithGitHubRateLimitHandler ¶
func WithGitHubRateLimitHandler(handler func(*GitHubRateLimitResponse)) OptionFn
WithGitHubRateLimitHandler configures a way to use a custom GitHub API rate limit handler
func WithLogger ¶
WithLogger sets a logger for the underlying extensions to use
func WithNPM ¶
func WithNPM() OptionFn
WithNPM configures the extension to also register the NPM related tables and funcs
func WithNPMHttpClient ¶
WithNPMHttpClient sets *http.Client used by the NPM tables/funcs
func WithRepoLocator ¶
func WithRepoLocator(loc services.RepoLocator) OptionFn
WithRepoLocator uses the provided locator implementation for locating and opening git repositories.
func WithSourcegraph ¶
func WithSourcegraph() OptionFn
WithSourcegraph configures the extension to also register the Sourcegraph related tables and funcs
func WithSourcegraphClientGetter ¶
WithSourcegraphClientGetter configures a way to use a custom graphql client
type Options ¶
type Options struct { // ExcludeGit excludes the git functionality if true ExcludeGit bool // Locator is how to fetch a repository Locator services.RepoLocator // ExtraFunctions is used to determine whether or not to register the extra utility functions // bundled with this extension ExtraFunctions bool // GitHub set to true to register the GitHub tables/funcs GitHub bool // GitHubClientGetter overrides the default GitHub v4 client GitHubClientGetter func() *githubv4.Client // GitHubRateLimitHandler overrides the default GitHub API rate limit response handler GitHubRateLimitHandler func(*GitHubRateLimitResponse) // GitHubPreRequestHook runs a function before making a GitHub API request GitHubPreRequestHook func() // GitHubPostRequestHook runs a function after making a GitHub API request GitHubPostRequestHook func() // Sourcegraph set to true to register Sourcegraph tables/func Sourcegraph bool // SourcegraphClientGetter establishes graphql client SourcegraphClientGetter func() *graphql.Client // NPM set to true to register the NPM tables/funcs NPM bool // NPMHttpClient NPMHttpClient *http.Client // Context is a key-value store to pass along values to the underlying extensions Context services.Context // Logger is a logger to pass along to the underlying extensions Logger *zerolog.Logger }
Options is the container for various different options and configurations that can be passed to tables.RegisterFn to conditionally include or tweak the extension module's behaviour
type RepoLocatorFn ¶
RepoLocatorFn is an adapter type that adapts any function with compatible signature to a RepoLocator instance.