sourceimpl

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: May 27, 2025 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrGHCommandNotFound represents an error when the gh command is not found
	ErrGHCommandNotFound ErrorCode = "GHCommandNotFound"
	// ErrGHCommandFailed represents an error when the gh command fails
	ErrGHCommandFailed ErrorCode = "GHCommandFailed"
	// EnvGHCommand is the environment variable name for specifying gh command path
	EnvGHCommand = "MIRU_GH_BIN"
	// DefaultGHCommand is the default command name for GitHub CLI
	DefaultGHCommand = "gh"
)
View Source
const (
	// ErrGLabCommandNotFound represents an error when the glab command is not found
	ErrGLabCommandNotFound ErrorCode = "GLabCommandNotFound"
	// ErrGLabCommandFailed represents an error when the glab command fails
	ErrGLabCommandFailed ErrorCode = "GLabCommandFailed"

	// EnvGLabCommand is the environment variable name for specifying glab command path
	EnvGLabCommand = "MIRU_GLAB_BIN"
	// DefaultGLabCommand is the default command name for GitLab CLI
	DefaultGLabCommand = "glab"
)

Variables

This section is empty.

Functions

func FetchHTML added in v0.0.19

func FetchHTML(url *url.URL, forceUpdate bool) (string, error)

FetchHTML fetches HTML content from a URL with cache support It uses the cache.GetOrSet function to retrieve HTML from cache or fetch it if not available The cache key is generated from the URL The forceUpdate parameter can be used to ignore the cache and fetch fresh HTML

func FetchWithCache

func FetchWithCache(investigator investigator.SourceInvestigator, packagePath string, forceUpdate bool) (source.Data, error)

FetchWithCache fetches data from the source with cache support It uses the cache.GetOrSet function to retrieve data from cache or fetch it if not available The cache key is generated from the investigator type and package path The forceUpdate parameter can be used to ignore the cache and fetch fresh data

Types

type CratesIOInvestigator

type CratesIOInvestigator struct{}

Implementation of CratesIO Investigator

func (*CratesIOInvestigator) Fetch

func (i *CratesIOInvestigator) Fetch(packagePath string) (source.Data, error)

func (*CratesIOInvestigator) GetSourceType

func (i *CratesIOInvestigator) GetSourceType() source.Type

func (*CratesIOInvestigator) GetURL

func (i *CratesIOInvestigator) GetURL(packagePath string) string

func (*CratesIOInvestigator) PackageFromURL

func (i *CratesIOInvestigator) PackageFromURL(url string) (string, error)

type ErrorCode added in v0.0.12

type ErrorCode string
const (
	// ErrCratesREADMENotFound represents an error when README is not found
	ErrCratesREADMENotFound ErrorCode = "CratesREADMENotFound"
	// ErrCratesPackageNotFound represents an error when package is not found
	ErrCratesPackageNotFound ErrorCode = "CratesPackageNotFound"
)
const (
	ErrInvalidPackagePath ErrorCode = "InvalidPackagePath"

	// ErrRepositoryNotFound represents errors when repository information cannot be found
	ErrRepositoryNotFound ErrorCode = "RepositoryNotFound"
)
const (
	// ErrPackagistREADMENotFound represents an error when README is not found
	ErrPackagistREADMENotFound ErrorCode = "PackagistREADMENotFound"
)
const (
	ErrPkgGoDevREADMENotFound ErrorCode = "ErrPkgGoDevREADMENotFound"
)
const (
	// ErrPyPIREADMENotFound represents an error when README is not found
	ErrPyPIREADMENotFound ErrorCode = "PyPIREADMENotFound"
)
const (
	// ErrRubyGemsREADMENotFound represents an error when README is not found
	ErrRubyGemsREADMENotFound ErrorCode = "RubyGemsREADMENotFound"
)
var (
	// ErrInvalidMetaTag represents errors when meta tag is invalid or missing
	ErrInvalidMetaTag ErrorCode = "InvalidMetaTag"
)

type GitHubInvestigator

type GitHubInvestigator struct{}

Implementation of GitHub Investigator

func (*GitHubInvestigator) Fetch

func (i *GitHubInvestigator) Fetch(packagePath string) (source.Data, error)

func (*GitHubInvestigator) GetSourceType

func (i *GitHubInvestigator) GetSourceType() source.Type

func (*GitHubInvestigator) GetURL

func (i *GitHubInvestigator) GetURL(packagePath string) string

func (*GitHubInvestigator) PackageFromURL

func (i *GitHubInvestigator) PackageFromURL(url string) (string, error)

type GitLabInvestigator

type GitLabInvestigator struct{}

Implementation of GitLab Investigator

func (*GitLabInvestigator) Fetch

func (i *GitLabInvestigator) Fetch(packagePath string) (source.Data, error)

func (*GitLabInvestigator) GetSourceType

func (i *GitLabInvestigator) GetSourceType() source.Type

func (*GitLabInvestigator) GetURL

func (i *GitLabInvestigator) GetURL(packagePath string) string

func (*GitLabInvestigator) PackageFromURL

func (i *GitLabInvestigator) PackageFromURL(url string) (string, error)

type GoMetadata

type GoMetadata struct {
	Repository *url.URL // Repository URL from go-import meta tag
	Homepage   *url.URL // Homepage URL from go-source meta tag
}

GoMetadata contains metadata extracted from go-import and go-source meta tags

type GoPkgDevInvestigator

type GoPkgDevInvestigator struct{}

Implementation of GoPkgDev Investigator

func (*GoPkgDevInvestigator) Fetch

func (i *GoPkgDevInvestigator) Fetch(packagePath string) (source.Data, error)

func (*GoPkgDevInvestigator) GetSourceType

func (i *GoPkgDevInvestigator) GetSourceType() source.Type

func (*GoPkgDevInvestigator) GetURL

func (i *GoPkgDevInvestigator) GetURL(packagePath string) string

func (*GoPkgDevInvestigator) PackageFromURL

func (i *GoPkgDevInvestigator) PackageFromURL(url string) (string, error)

type JSRInvestigator

type JSRInvestigator struct{}

Implementation of JSR Investigator

func (*JSRInvestigator) Fetch

func (i *JSRInvestigator) Fetch(packagePath string) (source.Data, error)

func (*JSRInvestigator) GetSourceType

func (i *JSRInvestigator) GetSourceType() source.Type

func (*JSRInvestigator) GetURL

func (i *JSRInvestigator) GetURL(packagePath string) string

func (*JSRInvestigator) PackageFromURL

func (i *JSRInvestigator) PackageFromURL(url string) (string, error)

type NPMInvestigator

type NPMInvestigator struct{}

Implementation of NPM Investigator

func (*NPMInvestigator) Fetch

func (i *NPMInvestigator) Fetch(packagePath string) (source.Data, error)

func (*NPMInvestigator) GetSourceType

func (i *NPMInvestigator) GetSourceType() source.Type

func (*NPMInvestigator) GetURL

func (i *NPMInvestigator) GetURL(packagePath string) string

func (*NPMInvestigator) PackageFromURL

func (i *NPMInvestigator) PackageFromURL(url string) (string, error)

type PackagistInvestigator

type PackagistInvestigator struct{}

Implementation of Packagist Investigator

func (*PackagistInvestigator) Fetch

func (i *PackagistInvestigator) Fetch(packagePath string) (source.Data, error)

func (*PackagistInvestigator) GetSourceType

func (i *PackagistInvestigator) GetSourceType() source.Type

func (*PackagistInvestigator) GetURL

func (i *PackagistInvestigator) GetURL(packagePath string) string

func (*PackagistInvestigator) PackageFromURL

func (i *PackagistInvestigator) PackageFromURL(url string) (string, error)

type PyPIInvestigator

type PyPIInvestigator struct{}

Implementation of PyPI Investigator

func (*PyPIInvestigator) Fetch

func (i *PyPIInvestigator) Fetch(packagePath string) (source.Data, error)

func (*PyPIInvestigator) GetSourceType

func (i *PyPIInvestigator) GetSourceType() source.Type

func (*PyPIInvestigator) GetURL

func (i *PyPIInvestigator) GetURL(packagePath string) string

func (*PyPIInvestigator) PackageFromURL

func (i *PyPIInvestigator) PackageFromURL(url string) (string, error)

type RubyGemsInvestigator

type RubyGemsInvestigator struct{}

Implementation of RubyGems Investigator

func (*RubyGemsInvestigator) Fetch

func (i *RubyGemsInvestigator) Fetch(packagePath string) (source.Data, error)

func (*RubyGemsInvestigator) GetSourceType

func (i *RubyGemsInvestigator) GetSourceType() source.Type

func (*RubyGemsInvestigator) GetURL

func (i *RubyGemsInvestigator) GetURL(packagePath string) string

func (*RubyGemsInvestigator) PackageFromURL

func (i *RubyGemsInvestigator) PackageFromURL(url string) (string, error)

type WebsiteInvestigator

type WebsiteInvestigator struct {
	Type source.Type
}

Implementation of Website Investigator

func (*WebsiteInvestigator) Fetch

func (i *WebsiteInvestigator) Fetch(packagePath string) (source.Data, error)

func (*WebsiteInvestigator) GetSourceType

func (i *WebsiteInvestigator) GetSourceType() source.Type

func (*WebsiteInvestigator) GetURL

func (i *WebsiteInvestigator) GetURL(packagePath string) string

func (*WebsiteInvestigator) PackageFromURL

func (i *WebsiteInvestigator) PackageFromURL(url string) (string, error)

Jump to

Keyboard shortcuts

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