config

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2022 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package config はアプリの設定("config.json")を管理するオブジェクトのパッケージです。

このオブジェクトには、ソートなどに使われる質問、質問の表示時間などの情報が含まれます。

Index

Constants

View Source
const NameConf = "config.json"

NameConf はアプリ設定のファイル名です。

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	*viper.Viper
	// contains filtered or unexported fields
}

Config は viper.Viper 型(github.com/spf13/viper)を埋め込んだ、アプリの設定 情報を保持する拡張型です。

func New

func New(pathDirCurr, pathDirHome string) (*Config, error)

New はデフォルトの設定済み新規 Config インスタンスを返します。

引数はファイルの検索先のパスとして指定する必要があります。

func (*Config) FileUsed

func (c *Config) FileUsed() string

FileUsed は読み込まれている設定ファイルのパスを返します。

func (*Config) GetQuery

func (c *Config) GetQuery() *query.Query

GetQuery returns the query instance which is used to query the user.

func (*Config) GetQueryDescription

func (c *Config) GetQueryDescription() string

GetQueryDescription は質問一覧の説明文を返します。

func (*Config) GetQueryObjective

func (c *Config) GetQueryObjective() []string

GetQueryObjective は質問一覧のうち、客観的な質問を返します。

func (*Config) GetQuerySubjective

func (c *Config) GetQuerySubjective() []string

GetQuerySubjective は質問一覧のうち、主観的な質問を返します。

func (*Config) IsDefaultConf

func (c *Config) IsDefaultConf() bool

IsDefaultConf は設定ファイルが存在せずデフォルトの設定を使っている場合に true を返します。

func (*Config) Load

func (c *Config) Load() error

Load はアプリの設定ファイルを読み込みます。

ファイルが存在するも、読み込みに失敗した場合に error を返します。ファイルが 存在しない場合はデフォルトの設定を読み込みます。

func (*Config) OverWrite

func (c *Config) OverWrite() error

OverWrite は設定ファイルを上書きします。

func (*Config) SaveAs

func (c *Config) SaveAs(pathFile string) error

SaveAs は設定ファイルを保存します。

Jump to

Keyboard shortcuts

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