glctx

package
v1.31.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package glctx provides utilities for storing and retrieving GitLab API clients from Go contexts. This allows GitLab clients to be passed through request processing pipelines without explicit parameter passing.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoClient = errors.New("gitlab client not found in context")

ErrNoClient is the error returned when no GitLab client is found in the context.

Functions

func Client

func Client(ctx context.Context) (*gitlab.Client, error)

Client retrieves the GitLab client from the provided context. It returns the client and an error indicating whether a valid client was found. If an error is set on the context with WithError, it returns that error instead of the client. If no client exists in the context or the client is nil, it returns ErrNoClient.

func WithClient

func WithClient(ctx context.Context, client *gitlab.Client) context.Context

WithClient returns a new context that carries the provided GitLab client or error. The client can later be retrieved using the Client function.

func WithClientError added in v1.23.0

func WithClientError(ctx context.Context, err error) context.Context

WithError returns a new context that carries the provided error. The error can later be retrieved using the Client function.

Types

This section is empty.

Jump to

Keyboard shortcuts

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