Skip to content

Commit

Permalink
add: ginx
Browse files Browse the repository at this point in the history
  • Loading branch information
moocss committed Oct 26, 2024
1 parent 212e9d0 commit 4062b79
Show file tree
Hide file tree
Showing 223 changed files with 36,843 additions and 993 deletions.
3 changes: 2 additions & 1 deletion cmd/van/internal/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ import (
// Cmd represents the new command.
var Cmd = &cobra.Command{
Use: "new",
Short: "Create new ",
Short: "create new",
Long: "Generate the new files.",
Run: func(cmd *cobra.Command, args []string) {
err := cmd.Help()
if err != nil {
return
}
},
Args: cobra.NoArgs,
}

func init() {
Expand Down
1 change: 1 addition & 0 deletions cmd/van/internal/create/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ var Cmd = &cobra.Command{
Short: "Create a model",
Long: "Create a model using the repository template. Example: van new helloworld",
Run: run,
Args: cobra.NoArgs,
}

func run(cmd *cobra.Command, args []string) {
Expand Down
1 change: 1 addition & 0 deletions cmd/van/internal/create/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ var Cmd = &cobra.Command{
Short: "Create a service template",
Long: "Create a service project using the repository template. Example: van new helloworld",
Run: run,
Args: cobra.NoArgs,
}

func run(cmd *cobra.Command, args []string) {
Expand Down
6 changes: 4 additions & 2 deletions cmd/van/internal/new/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ var Cmd = &cobra.Command{
Short: "Create a new project.",
Long: "create a new project with van layout.",
Run: run,
Args: cobra.NoArgs,
}

var (
Expand All @@ -28,8 +29,9 @@ var (

func init() {
timeout = "60s"
Cmd.Flags().StringVarP(&repoURL, "repo-url", "r", repoURL, "layout repo")
Cmd.Flags().StringVarP(&timeout, "timeout", "t", timeout, "time out")
f := Cmd.Flags()
f.StringVarP(&repoURL, "repo-url", "r", repoURL, "layout repo")
f.StringVarP(&timeout, "timeout", "t", timeout, "time out")
}

func run(_ *cobra.Command, args []string) {
Expand Down
1 change: 1 addition & 0 deletions cmd/van/internal/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var Cmd = &cobra.Command{
Short: "Run project",
Long: "Run project. Example: van run",
Run: Run,
Args: cobra.NoArgs,
}

func Run(cmd *cobra.Command, args []string) {
Expand Down
1 change: 1 addition & 0 deletions cmd/van/internal/upgrade/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var Cmd = &cobra.Command{
Short: "Upgrade the van tools",
Long: "Upgrade the van tools. Example: van upgrade",
Run: Run,
Args: cobra.NoArgs,
}

// Run upgrade the van tools.
Expand Down
2 changes: 2 additions & 0 deletions db/redis/wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ type (
Options = redis.Options
// Client is an alias of redis.Client.
Client = redis.Client
// UniversalClient is an alias of redis.UniversalClient.
UniversalClient = redis.UniversalClient
// Tx is an alias of redis.Tx.
Tx = redis.Tx
// Cmdable is an alias of redis.Cmdable.
Expand Down
10 changes: 10 additions & 0 deletions ginx/errs.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package ginx

import "errors"

var ErrUnauthorized = errors.New("未授权")

// ErrNoResponse 是一个 sentinel 错误。
// 也就是说,你可以通过返回这个 ErrNoResponse 来告诉 ginx 不需要继续写响应。
// 大多数情况下,这意味着你已经写回了响应。
var ErrNoResponse = errors.New("不需要返回 response")
Loading

0 comments on commit 4062b79

Please sign in to comment.