Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var UserCmd = &cobra.Command{ Use: "user:create", Short: "Create user", Run: func(cmd *cobra.Command, args []string) { config.Init() ctx, stop := context.WithCancel(context.Background()) db := database.GetInstance(ctx) defer func() { err := db.Close() if err != nil { slog.Error("failed to close db", slog.Any("error", err)) } stop() }() appSignal := make(chan os.Signal, 3) signal.Notify(appSignal, os.Interrupt, syscall.SIGTERM) go func() { <-appSignal stop() }() repositories := global.InitRepositories(db) var user model.User user.Username = username user.Role = role user.SetPassword(password) _, err := repositories.UserRepo.Save(ctx, user) if err != nil { log.Fatalf("failed to save user: %v", err) } }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.