config

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package config contains all config structs and logic for indices.

Index

Constants

View Source
const (
	// DefaultFilePermissions are the default permissions used for files.
	DefaultFilePermissions = 0o644
	// DefaultDirPermissions are the default permissions used for directories.
	DefaultDirPermissions = 0o755
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Configs []*Entry `yaml:"configs"`
}

Config aggregates the info about ConfigEntries.

func New

func New(path string) (*Config, error)

New loads an index config from a file.

func (*Config) Add

func (c *Config) Add(entry *Entry)

Add adds a new config to Config.

func (*Config) Get

func (c *Config) Get(name string) *Entry

Get returns a pointer to an entry in a Config.

func (*Config) Remove

func (c *Config) Remove(name string)

Remove removes a config by name from an Config.

func (*Config) Upsert

func (c *Config) Upsert(entry *Entry)

Upsert replaces the entry if already exists otherwise just appends it.

func (*Config) Write

func (c *Config) Write(path string) error

Write writes a Config to disk.

type Entry

type Entry struct {
	AddedTimestamp   string `yaml:"added_timestamp"`
	Name             string `yaml:"name"`
	UpdatedTimestamp string `yaml:"updated_timestamp"`
	URL              string `yaml:"url"`
	Backend          string `yaml:"backend"`
}

Entry contains information about one of the index that were cached locally.

func EntryFromIndex

func EntryFromIndex(idx *config.Index) *Entry

EntryFromIndex creates a Entry from a config.Index.

Jump to

Keyboard shortcuts

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