config

package
v0.0.0-...-d1c2ce7 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultPath = "~/.quiz.yaml"

Variables

This section is empty.

Functions

func ExpandPath

func ExpandPath(path string) string

Types

type Answer

type Answer struct {
	Answer    string
	IsCorrect bool `yaml:"correct"`
}

type Categories

type Categories struct {
	Categories map[string][]Variation
}

type Config

type Config interface {
	ReadConfig() (*Categories, error)
}

func CreateConfigFromPath

func CreateConfigFromPath(path string) Config

type FileConfig

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

func NewFileConfig

func NewFileConfig(fs afero.Fs, path string) *FileConfig

func (*FileConfig) ReadConfig

func (c *FileConfig) ReadConfig() (*Categories, error)

type Question

type Question struct {
	Question string
	Links    []string
	Answers  []Answer
}

type RemoteConfig

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

func NewRemoteConfig

func NewRemoteConfig(httpClient *http.Client, url string) *RemoteConfig

func (*RemoteConfig) ReadConfig

func (c *RemoteConfig) ReadConfig() (*Categories, error)

type Variation

type Variation struct {
	Variation string
	Links     []string
	Questions []Question
}

Jump to

Keyboard shortcuts

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