config

package
v0.0.0-...-55e8476 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EnvConfigDir 配置路径环境变量
	EnvConfigDir = "DEDAO_GO_CONFIG_DIR"
	// Name 配置文件名
	Name = "config.json"
)

Variables

This section is empty.

Functions

func GetConfigDir

func GetConfigDir() string

GetConfigDir config file dir

Types

type ConfigsData

type ConfigsData struct {
	AcitveUID    string
	DownloadPath string
	Users        DedaoUsers
	// contains filtered or unexported fields
}

ConfigsData Configs data

var (

	// Instance 配置信息 全局调用
	Instance *ConfigsData
)

func New

func New(configFilePath string) *ConfigsData

New config

func (*ConfigsData) ActiveUser

func (c *ConfigsData) ActiveUser() *Dedao

ActiveUser active user

func (*ConfigsData) ActiveUserService

func (c *ConfigsData) ActiveUserService() *services.Service

ActiveUserService user

func (*ConfigsData) DeleteConfigFile

func (c *ConfigsData) DeleteConfigFile() (err error)

func (*ConfigsData) DeleteUser

func (c *ConfigsData) DeleteUser(u *User)

DeleteUser delete

func (*ConfigsData) LoginUserCount

func (c *ConfigsData) LoginUserCount() int

LoginUserCount 登录用户数量

func (*ConfigsData) Save

func (c *ConfigsData) Save() error

Save 保存配置

func (*ConfigsData) SetUser

func (c *ConfigsData) SetUser(u *Dedao) (*Dedao, *services.User, error)

SetUser set user

func (*ConfigsData) SwitchUser

func (c *ConfigsData) SwitchUser(u *User) error

SwitchUser switch user

type Dedao

type Dedao struct {
	User
	services.CookieOptions
}

Dedao geek time info

func (*Dedao) New

func (d *Dedao) New() *services.Service

New dedao service

type DedaoUsers

type DedaoUsers []*Dedao

DedaoUsers user

type User

type User struct {
	UIDHazy string `json:"uid_hazy"`
	Name    string `json:"name"`
	Avatar  string `json:"avatar"`
}

User dedao user info

Jump to

Keyboard shortcuts

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