project

package
v0.0.0-...-1225d9a Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const PROJECT_SETTING_FILE_PATH = ".mcube.yaml"

Variables

View Source
var Cmd = &cobra.Command{
	Use:   "init",
	Short: "初始化",
	Long:  `初始化一个mcube项目`,
	Run: func(cmd *cobra.Command, args []string) {
		p, err := LoadConfigFromCLI()
		if err != nil {
			if err == terminal.InterruptErr {
				fmt.Println("项目初始化取消")
				return
			}

			cobra.CheckErr(err)
		}

		err = p.Init()
		cobra.CheckErr(err)
	},
}

InitCmd 初始化系统

Functions

This section is empty.

Types

type Mcenter

type Mcenter struct {
	Host         string
	Port         string
	ClientID     string
	ClientSecret string
}

Mcenter 鉴权服务配置

type MongoDB

type MongoDB struct {
	Endpoints []string
	UserName  string
	Password  string
	Database  string
	AuthDB    string
}

type MySQL

type MySQL struct {
	Host     string
	Port     string
	Database string
	UserName string
	Password string
}

type Project

type Project struct {
	PKG           string   `yaml:"pkg"`
	Name          string   `yaml:"name"`
	Description   string   `yaml:"description"`
	EnableMcenter bool     `yaml:"enable_mcenter"`
	Mcenter       *Mcenter `yaml:"-"`
	EnableMySQL   bool     `yaml:"enable_mysql"`
	MySQL         *MySQL   `yaml:"-"`
	EnableMongoDB bool     `yaml:"enable_mongodb"`
	MongoDB       *MongoDB `yaml:"-"`
	GenExample    bool     `yaml:"gen_example"`
	HttpFramework string   `yaml:"http_framework"`
	EnableCache   bool     `yaml:"enable_cache"`
	// contains filtered or unexported fields
}

Project todo

func LoadConfigFromCLI

func LoadConfigFromCLI() (*Project, error)

LoadConfigFromCLI 配置

func LoadProjectFromYAML

func LoadProjectFromYAML(path string) (*Project, error)

func (*Project) FuncMap

func (p *Project) FuncMap() template.FuncMap

func (*Project) Init

func (p *Project) Init() error

Init 初始化项目

func (*Project) LoadMcenterConfig

func (p *Project) LoadMcenterConfig() error

func (*Project) LoadMongoDBConfig

func (p *Project) LoadMongoDBConfig() error

func (*Project) LoadMySQLConfig

func (p *Project) LoadMySQLConfig() error

func (*Project) SaveFile

func (p *Project) SaveFile(filePath string) error

func (*Project) ToYAML

func (p *Project) ToYAML() (string, error)

Jump to

Keyboard shortcuts

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