registry

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2025 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultRegistryBasePath = "https://registry.anyquery.dev/"

Functions

func AddDefaultRegistry

func AddDefaultRegistry(queries *model.Queries) error

func AddNewRegistry

func AddNewRegistry(queries *model.Queries, name string, url string) error

Add a new registry to the list of registries in the database.

It ensures the registry is valid, does not already exist, and then adds it to the list of registries.

func FindPluginVersionCandidate

func FindPluginVersionCandidate(plugin Plugin) (PluginFile, PluginVersion, error)

Find the highest version of a plugin that is compatible with the current version of Anyquery and with the user's system

func GetCurrentPlatform

func GetCurrentPlatform() string

func InstallPlugin

func InstallPlugin(queries *model.Queries, registry string, plugin string) (string, error)

func UninstallPlugin

func UninstallPlugin(queries *model.Queries, registry string, plugin string) error

func UpdatePlugin

func UpdatePlugin(queries *model.Queries, registry string, plugin string) error

func UpdateRegistry

func UpdateRegistry(queries *model.Queries, name string) error

Update the JSON content in the database of the given registry.

If the registry does not exist, it returns an error. If the registry has not changed, it does nothing.

func ValidateSchema

func ValidateSchema(registry []byte) error

Validates the given JSON string against the schema_registry.json schema.

Types

type Plugin

type Plugin struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	PageContent string `json:"page_content"`
	Author      string `json:"author"`
	Homepage    string `json:"homepage"`
	License     string `json:"license"`
	Registry    string // This is not a field in the registry, but can be filled for easier access
	// If type is different than anyquery or SharedObject, it will be ignored
	Type     string          `json:"type"`
	Versions []PluginVersion `json:"versions"`
}

func ListInstallablePlugins

func ListInstallablePlugins(queries *model.Queries) ([]Plugin, error)

Return a list of all the plugins installable from the registries It does not check if the plugin is already installed, neither if the plugin is compatible with the current version of Anyquery nor if the plugin has a file for the current platform

func ListInstallablePluginsForPlatform

func ListInstallablePluginsForPlatform(queries *model.Queries, platform string) ([]Plugin, error)

Return a list of all the plugins installable from the registries for the current platform. List also the plugins that are already installed

type PluginFile

type PluginFile struct {
	Hash string `json:"hash"`
	URL  string `json:"url"`
	Path string `json:"path"`
}

type PluginVersion

type PluginVersion struct {
	Version                string                `json:"version"`
	MinimumRequiredVersion string                `json:"minimum_required_version"`
	Files                  map[string]PluginFile `json:"files"` // Platform -> File
	UserConfig             []UserConfig          `json:"user_config"`
	Tables                 []string              `json:"tables"`
}

type Registry

type Registry struct {
	Title   string   `json:"title"`
	Plugins []Plugin `json:"plugins"`
}

func LoadRegistry

func LoadRegistry(queries *model.Queries, name string) (model.Registry, Registry, error)

type UserConfig

type UserConfig struct {
	Name     string `json:"name"`
	Required bool   `json:"required"`
	// The type of the variable prompted to the user
	// Can be: string, int, float, bool, []string, []int, []float, []bool
	Type        string `json:"type"`
	Description string `json:"description"`
	Validation  string `json:"validation"`
}

Jump to

Keyboard shortcuts

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