datasource

package
v0.2.0-alpha20251127 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package datasource provides a unified interface for querying package registries. This abstraction allows multiple integrations to share the same registry client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

func List() []string

List returns all registered datasource names.

func Register

func Register(ds Datasource)

Register adds a datasource to the global registry.

Types

type Datasource

type Datasource interface {
	// Name returns the datasource identifier (e.g., "npm", "pypi", "github-releases")
	Name() string

	// GetLatestVersion returns the latest stable version for a package.
	GetLatestVersion(ctx context.Context, pkg string) (string, error)

	// GetVersions returns all available versions for a package.
	GetVersions(ctx context.Context, pkg string) ([]string, error)

	// GetPackageInfo returns detailed information about a package.
	GetPackageInfo(ctx context.Context, pkg string) (*PackageInfo, error)
}

Datasource represents a package registry or version source.

func Get

func Get(name string) (Datasource, error)

Get returns a datasource by name.

type GitHubDatasource

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

GitHubDatasource implements the Datasource interface for GitHub Releases.

func NewGitHubDatasource

func NewGitHubDatasource() *GitHubDatasource

NewGitHubDatasource creates a new GitHub datasource.

func (*GitHubDatasource) GetLatestVersion

func (d *GitHubDatasource) GetLatestVersion(ctx context.Context, pkg string) (string, error)

GetLatestVersion returns the latest stable release for a GitHub repository.

func (*GitHubDatasource) GetPackageInfo

func (d *GitHubDatasource) GetPackageInfo(ctx context.Context, pkg string) (*PackageInfo, error)

GetPackageInfo returns detailed information about a GitHub repository's releases.

func (*GitHubDatasource) GetVersions

func (d *GitHubDatasource) GetVersions(ctx context.Context, pkg string) ([]string, error)

GetVersions returns all available releases for a GitHub repository.

func (*GitHubDatasource) Name

func (d *GitHubDatasource) Name() string

Name returns the datasource identifier.

type HelmDatasource

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

HelmDatasource implements the Datasource interface for Helm chart repositories.

func NewHelmDatasource

func NewHelmDatasource() *HelmDatasource

NewHelmDatasource creates a new Helm datasource.

func (*HelmDatasource) GetLatestVersion

func (d *HelmDatasource) GetLatestVersion(ctx context.Context, pkg string) (string, error)

GetLatestVersion returns the latest stable version for a Helm chart.

func (*HelmDatasource) GetPackageInfo

func (d *HelmDatasource) GetPackageInfo(ctx context.Context, pkg string) (*PackageInfo, error)

GetPackageInfo returns detailed information about a Helm chart.

func (*HelmDatasource) GetVersions

func (d *HelmDatasource) GetVersions(ctx context.Context, pkg string) ([]string, error)

GetVersions returns all available versions for a Helm chart.

func (*HelmDatasource) Name

func (d *HelmDatasource) Name() string

Name returns the datasource identifier.

type NPMDatasource

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

NPMDatasource implements the Datasource interface for the npm registry.

func NewNPMDatasource

func NewNPMDatasource() *NPMDatasource

NewNPMDatasource creates a new npm datasource.

func (*NPMDatasource) GetLatestVersion

func (d *NPMDatasource) GetLatestVersion(ctx context.Context, pkg string) (string, error)

GetLatestVersion returns the latest stable version for an npm package.

func (*NPMDatasource) GetPackageInfo

func (d *NPMDatasource) GetPackageInfo(ctx context.Context, pkg string) (*PackageInfo, error)

GetPackageInfo returns detailed information about an npm package.

func (*NPMDatasource) GetVersions

func (d *NPMDatasource) GetVersions(ctx context.Context, pkg string) ([]string, error)

GetVersions returns all available versions for an npm package.

func (*NPMDatasource) Name

func (d *NPMDatasource) Name() string

Name returns the datasource identifier.

type PackageInfo

type PackageInfo struct {
	Name        string
	Description string
	Homepage    string
	Repository  string
	Versions    []VersionInfo
}

PackageInfo contains metadata about a package.

type TerraformDatasource

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

TerraformDatasource implements the Datasource interface for the Terraform Registry.

func NewTerraformDatasource

func NewTerraformDatasource() *TerraformDatasource

NewTerraformDatasource creates a new Terraform datasource.

func (*TerraformDatasource) GetLatestVersion

func (d *TerraformDatasource) GetLatestVersion(ctx context.Context, pkg string) (string, error)

GetLatestVersion returns the latest stable version for a Terraform module or provider.

func (*TerraformDatasource) GetPackageInfo

func (d *TerraformDatasource) GetPackageInfo(ctx context.Context, pkg string) (*PackageInfo, error)

GetPackageInfo returns detailed information about a Terraform module or provider.

func (*TerraformDatasource) GetVersions

func (d *TerraformDatasource) GetVersions(ctx context.Context, pkg string) ([]string, error)

GetVersions returns all available versions for a Terraform module or provider.

func (*TerraformDatasource) Name

func (d *TerraformDatasource) Name() string

Name returns the datasource identifier.

type VersionInfo

type VersionInfo struct {
	Version      string
	PublishedAt  string
	IsPrerelease bool
	Deprecated   bool
}

VersionInfo contains metadata about a specific version.

Jump to

Keyboard shortcuts

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