Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( MigrationStatus bool MigrationCmd = &cobra.Command{ Use: "migrate", Short: "Run database migrations", Example: "herman migrate --direction=up --number=1", SilenceUsage: true, RunE: func(cmd *cobra.Command, args []string) error { if err := Migrate(direction); err != nil { return err } return nil }, } )
MigrationCmd 数据库迁移
View Source
var ( IsMigrate bool StartServerCmd = &cobra.Command{ Use: "server", Short: "This is a herman service", SilenceUsage: true, Example: "herman server --host=0.0.0.0 --port=8000", Run: func(cmd *cobra.Command, args []string) { servers.NewServer(host, port) }, } )
StartServerCmd 服务启动
View Source
var ( GenerateJwtCmd = &cobra.Command{ Use: "jwt:secret", Short: "Generate a secret for JWT", Example: "jwt:secret", SilenceUsage: true, RunE: func(cmd *cobra.Command, args []string) error { key := make([]byte, 32) if _, err := rand.Read(key); err != nil { return err } encodedKey := base64.StdEncoding.EncodeToString(key) fmt.Println("Jwt secret:", color.GreenString(encodedKey)) return nil }, } )
GenerateJwtCmd 随机生成JWT令牌
View Source
var ( HermanVersionCmd = &cobra.Command{ Use: "version", Short: "Get herman version", Example: "herman version", SilenceUsage: true, RunE: func(cmd *cobra.Command, args []string) error { fmt.Printf(`Herman version: %v`, color.GreenString(app.Version)) return nil }, } )
HermanVersionCmd 获取herman版本号
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.