cmd

package
v0.0.0-...-ebca6f7 Latest Latest
Warning

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

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

README

cobra使用

  1. 安装cobra
go get -u github.com/spf13/cobra/cobra
  1. 初始化项目
cobra-cli init
cobra-cli init --author "791422171@qq.com"
cobra-cli init --license apache
  1. 添加命令 migrate (例)
cobra-cli add version
cobra-cli add migrate
  1. 运行命令 migrate(例)
go run main.go migrate -h
go run main.go migrate --help
go run main.go migrate --action=reset

Documentation

Overview

Copyright © 2023 NAME HERE <EMAIL ADDRESS>

Copyright © 2023 NAME HERE <EMAIL ADDRESS>

Copyright © 2023 NAME HERE <EMAIL ADDRESS>

Copyright © 2023 NAME HERE <EMAIL ADDRESS>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearTable

func ClearTable(db *gorm.DB, tableName string) (err error)

Types

type ApiCmd

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

func NewApiCmd

func NewApiCmd() *ApiCmd

func (*ApiCmd) GetDefaultNacosConfig

func (s *ApiCmd) GetDefaultNacosConfig() *nacos.NacosConfig

func (*ApiCmd) RunApi

func (s *ApiCmd) RunApi()

type MigrateCmd

type MigrateCmd struct {
	Host     string
	Port     string
	Username string
	Password string
	Dbname   string
	Config   string
	// contains filtered or unexported fields
}

migrateCmd represents the migrate command

func NewMigrateCmd

func NewMigrateCmd() *MigrateCmd

func (*MigrateCmd) MigrateDB

func (s *MigrateCmd) MigrateDB()

func (*MigrateCmd) MigrateDatabase

func (s *MigrateCmd) MigrateDatabase(db *gorm.DB)

迁移数据库

func (*MigrateCmd) ResetDatabase

func (s *MigrateCmd) ResetDatabase(db *gorm.DB)

重置数据库

type RabbitmqCmd

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

func NewRabbitmqCmd

func NewRabbitmqCmd() *RabbitmqCmd

func (*RabbitmqCmd) RunRabbitmq

func (s *RabbitmqCmd) RunRabbitmq()

type RootCmd

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

func NewRootCmd

func NewRootCmd() *RootCmd

func (*RootCmd) Execute

func (s *RootCmd) Execute()

Jump to

Keyboard shortcuts

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