Documentation ¶
Index ¶
- Constants
- Variables
- func ComputePage(first *int, last *int, after *string, before *string, total int) (offset int, limit int, err error)
- func ConfigureLog(level slog.Leveler)
- func DecodeCursor(base64Cursor string, total int) (int, error)
- func EncodeCursor(offset int) string
- func ExtractTarGz(archive []byte, destDir string) error
- func ExtractZip(archive []byte, destDir string) error
- type AnvilConfig
- type AnvilRelease
- func (a *AnvilRelease) DownloadAsset(ctx context.Context, release *ReleaseAsset) (string, error)
- func (a *AnvilRelease) ExtractAsset(archive []byte, filename string, destDir string) error
- func (a AnvilRelease) FormatNameRelease(_, goos, goarch, _ string) string
- func (a *AnvilRelease) GetLatestReleaseCompatible(ctx context.Context) (*ReleaseAsset, error)
- func (a *AnvilRelease) ListRelease(ctx context.Context) ([]ReleaseAsset, error)
- func (a AnvilRelease) PlatformCompatible() (string, error)
- func (a *AnvilRelease) Prerequisites(ctx context.Context) error
- func (a AnvilRelease) SaveConfigOnDefaultLocation(config *AnvilConfig) error
- func (a AnvilRelease) TryLoadConfig() (*AnvilConfig, error)
- type HandleRelease
- type PageResult
- type ReleaseAsset
Constants ¶
const DefaultPaginationLimit = 1000
const LATEST_TAG = "nightly"
const WINDOWS = "windows"
Variables ¶
var ErrInvalidCursor = errors.New("invalid pagination cursor")
var ErrInvalidLimit = errors.New("limit cannot be negative")
var ErrMixedPagination = errors.New(
"cannot mix forward pagination (first, after) with backward pagination (last, before)")
Functions ¶
func ComputePage ¶
func ComputePage( first *int, last *int, after *string, before *string, total int, ) (offset int, limit int, err error)
Compute the pagination parameters given the GraphQL connection parameters.
func ConfigureLog ¶
func DecodeCursor ¶
Decode the integer offset from a base64 string.
func EncodeCursor ¶
Encode the integer offset into a base64 string.
func ExtractTarGz ¶ added in v1.1.2
Extract a tar.gz archive to a destination directory
func ExtractZip ¶ added in v1.1.2
Extract a zip archive to a destination directory
Types ¶
type AnvilConfig ¶ added in v1.1.2
type AnvilConfig struct { AssetAnvil ReleaseAsset `json:"asset_anvil"` LatestCheck string `json:"latest_check"` }
func LoadAnvilConfig ¶ added in v1.1.2
func LoadAnvilConfig(path string) (*AnvilConfig, error)
func NewAnvilConfig ¶ added in v1.1.2
func NewAnvilConfig(ra ReleaseAsset) *AnvilConfig
func (*AnvilConfig) SaveAnvilConfig ¶ added in v1.1.2
func (a *AnvilConfig) SaveAnvilConfig(path string) error
type AnvilRelease ¶ added in v1.1.2
type AnvilRelease struct { Namespace string Repository string ConfigFilename string Client *github.Client }
Anvil implementation from HandleRelease
func (*AnvilRelease) DownloadAsset ¶ added in v1.1.2
func (a *AnvilRelease) DownloadAsset(ctx context.Context, release *ReleaseAsset) (string, error)
DownloadAsset implements HandleRelease.
func (*AnvilRelease) ExtractAsset ¶ added in v1.1.2
func (a *AnvilRelease) ExtractAsset(archive []byte, filename string, destDir string) error
func (AnvilRelease) FormatNameRelease ¶ added in v1.1.2
func (a AnvilRelease) FormatNameRelease(_, goos, goarch, _ string) string
FormatNameRelease implements HandleRelease.
func (*AnvilRelease) GetLatestReleaseCompatible ¶ added in v1.1.2
func (a *AnvilRelease) GetLatestReleaseCompatible(ctx context.Context) (*ReleaseAsset, error)
GetLatestReleaseCompatible implements HandleRelease.
func (*AnvilRelease) ListRelease ¶ added in v1.1.2
func (a *AnvilRelease) ListRelease(ctx context.Context) ([]ReleaseAsset, error)
ListRelease implements HandleRelease.
func (AnvilRelease) PlatformCompatible ¶ added in v1.1.2
func (a AnvilRelease) PlatformCompatible() (string, error)
PlatformCompatible implements HandleRelease.
func (*AnvilRelease) Prerequisites ¶ added in v1.1.2
func (a *AnvilRelease) Prerequisites(ctx context.Context) error
Prerequisites implements HandleRelease.
func (AnvilRelease) SaveConfigOnDefaultLocation ¶ added in v1.1.2
func (a AnvilRelease) SaveConfigOnDefaultLocation(config *AnvilConfig) error
func (AnvilRelease) TryLoadConfig ¶ added in v1.1.2
func (a AnvilRelease) TryLoadConfig() (*AnvilConfig, error)
type HandleRelease ¶ added in v1.1.2
type HandleRelease interface { // Name basead on version, arch, os with prefix FormatNameRelease(prefix, goos, goarch, version string) string // Check if the platform is compatible with the library and return the name of the release PlatformCompatible() (string, error) // List all releases from the repository ListRelease(ctx context.Context) ([]ReleaseAsset, error) // Get the latest release compatible with the platform GetLatestReleaseCompatible(ctx context.Context) (*ReleaseAsset, error) // Check prerequisites for the library Prerequisites(ctx context.Context) error // Download the asset from the release DownloadAsset(ctx context.Context, release *ReleaseAsset) (string, error) // Extract the asset from the archive ExtractAsset(archive []byte, filename string, destDir string) error }
Interface for handle libraries on GitHub
func NewAnvilRelease ¶ added in v1.1.2
func NewAnvilRelease() HandleRelease
type PageResult ¶
type ReleaseAsset ¶ added in v1.1.2
type ReleaseAsset struct { Tag string `json:"tag"` AssetId int64 `json:"asset_id"` Filename string `json:"filename"` Url string `json:"url"` Path string `json:"path"` }
ReleaseAsset represents a release asset from GitHub
func GetAssetsFromLastReleaseGitHub ¶ added in v1.1.2
func GetAssetsFromLastReleaseGitHub(ctx context.Context, client *github.Client, namespace, repository string, tag string) ([]ReleaseAsset, error)
Get assets of latest release or prerelease from GitHub