metadata

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2023 License: GPL-3.0 Imports: 12 Imported by: 2

README

AUR metadata processor

This is a simple library for processing AUR metadata.

It retrieves the metadata from the AUR, parses it and allows you to query it.

Usage

package main

func main() {
	aurCache, err := metadata.NewAURCache()
	if err != nil {
        fmt.Println(err)
		return 
	}
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(opts ...ClientOption) (*Client, error)

func (*Client) Get

func (a *Client) Get(ctx context.Context, query *aur.Query) ([]aur.Pkg, error)

Get returns a list of packages that provide the given search term.

type ClientOption

type ClientOption func(*Client) error

ClientOption allows setting custom parameters during construction.

func WithBaseURL

func WithBaseURL(baseURL string) ClientOption

WithBaseURL allows overriding the default base URL of the client.

func WithCacheFilePath

func WithCacheFilePath(cacheFilePath string) ClientOption

func WithCustomCacheValidity

func WithCustomCacheValidity(duration time.Duration) ClientOption

func WithDebugLogger

func WithDebugLogger(logFn LogFn) ClientOption

func WithHTTPClient

func WithHTTPClient(doer HTTPRequestDoer) ClientOption

WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.

func WithRequestEditorFn

func WithRequestEditorFn(fn aur.RequestEditorFn) ClientOption

WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.

type HTTPRequestDoer

type HTTPRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

type LogFn

type LogFn func(a ...any)

Jump to

Keyboard shortcuts

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