options

package
v0.4.8 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OptionFn

type OptionFn func(*Options)

OptionFn represents any function capable of customising or providing options

func WithContextValue

func WithContextValue(key, value string) OptionFn

WithContextValue sets a value on the options context. It will override any existing value set with the same key

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

func WithGitHubClientGetter(getter func() *githubv4.Client) OptionFn

WithGitHubClientGetter configures a way to use a custom GitHubv4 client

func WithLogger added in v0.4.7

func WithLogger(logger *zerolog.Logger) OptionFn

WithLogger sets a logger for the underlying extensions to use

func WithNPM added in v0.4.7

func WithNPM() OptionFn

WithNPM configures the extension to also register the NPM related tables and funcs

func WithNPMHttpClient added in v0.4.7

func WithNPMHttpClient(client *http.Client) OptionFn

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 added in v0.4.6

func WithSourcegraph() OptionFn

WithSourcegraph configures the extension to also register the Sourcegraph related tables and funcs

func WithSourcegraphClientGetter added in v0.4.6

func WithSourcegraphClientGetter(getter func() *graphql.Client) OptionFn

WithSourcegraphClientGetter configures a way to use a custom graphql client

type Options

type Options struct {
	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

	// 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

type RepoLocatorFn func(ctx context.Context, path string) (*git.Repository, error)

RepoLocatorFn is an adapter type that adapts any function with compatible signature to a RepoLocator instance.

func (RepoLocatorFn) Open

func (fn RepoLocatorFn) Open(ctx context.Context, path string) (*git.Repository, error)

Jump to

Keyboard shortcuts

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