system

package
v0.0.0-...-418145e Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Config    = "app.config"
	ConfigDir = "app.config.dir"
)

Variables

This section is empty.

Functions

func ReadYamlFromFile

func ReadYamlFromFile(file string) (prop map[string]interface{}, err error)

ReadYamlFromFile read yaml from file directly

Types

type App

type App struct {
	//是否运行在命令行模式
	IsRunInCli bool
	// project name
	Title string `json:"title,omitempty"`
	// project name
	Project string `json:"project,omitempty" `
	// app name
	Name string `json:"name,omitempty" `
	// app description
	Description string `json:"description,omitempty"`
	// Version
	Version string `json:"version,omitempty" default:"${APP_VERSION:v1}"`
	// TermsOfService
	TermsOfService string `json:"termsOfService,omitempty"`
}

App is the properties of the application, it hold the base info of the application

func (*App) WithDescription

func (app *App) WithDescription(description string) *App

func (*App) WithName

func (app *App) WithName(name string) *App

func (*App) WithTitle

func (app *App) WithTitle(title string) *App

func (*App) WithVersion

func (app *App) WithVersion(version string) *App

type Builder

type Builder interface {
	Init() error
	Build(profiles ...string) (p interface{}, err error)
	BuildWithProfile(profile string) (interface{}, error)
	Load(properties interface{}, opts ...func(*mapstructure.DecoderConfig)) (err error)
	Save(p interface{}) (err error)
	Replace(source string) (retVal interface{})
	GetProperty(name string) (retVal interface{})
	SetProperty(name string, val interface{}) Builder
	SetDefaultProperty(name string, val interface{}) Builder
	SetConfiguration(in interface{})
}

Builder is the config file (yaml, json) builder

func NewPropertyBuilder

func NewPropertyBuilder(path string, customProperties map[string]interface{}) Builder

NewBuilder is the constructor of system.Builder

type ConfigFile

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

type Configuration

type Configuration struct {
	App     *App
	Logging *Logging
}

Configuration is the system configuration

func NewConfiguration

func NewConfiguration() *Configuration

type Logging

type Logging struct {
	Level string `json:"level,omitempty" default:"info"`
}

Logging is the properties of logging

Directories

Path Synopsis
Package cmap provides concurrent map
Package cmap provides concurrent map
Package factory provides InstantiateFactory and ConfigurableFactory interface
Package factory provides InstantiateFactory and ConfigurableFactory interface
autoconfigure
Package autoconfigure implement ConfigurableFactory
Package autoconfigure implement ConfigurableFactory
depends
Package depends provides dependency resolver for factory
Package depends provides dependency resolver for factory
instantiate
Package instantiate implement InstantiateFactory
Package instantiate implement InstantiateFactory
Package errwrap implements methods to formalize error wrapping in Go.
Package errwrap implements methods to formalize error wrapping in Go.
Package reflector provides utilities for reflection
Package reflector provides utilities for reflection
Package replacer provides utilities that replace the reference and environment variables with its value
Package replacer provides utilities that replace the reference and environment variables with its value

Jump to

Keyboard shortcuts

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