Init commit repo setup

This commit is contained in:
Lokesh Dugar
2024-07-23 14:16:26 +05:30
parent 72157608cd
commit 2012cd8940
29 changed files with 1012 additions and 1 deletions

32
cmd/cybertron/main.go Normal file
View File

@@ -0,0 +1,32 @@
package main
import (
"cybertron/internal/transport"
"github.com/spf13/cobra"
"go.uber.org/zap"
"cybertron/configs"
"cybertron/internal/dependencies"
)
func main() {
configs.LoadConfig()
rootCmd := &cobra.Command{
Use: "cybertron",
Short: "cybertron",
Long: "cybertron",
Run: func(cmd *cobra.Command, args []string) {
dep := dependencies.InitDependencies()
server := transport.NewServer(dep)
go server.Start()
server.Close()
},
}
if err := rootCmd.Execute(); err != nil {
zap.L().Fatal("Error", zap.Error(err))
}
}

30
cmd/migrations/main.go Normal file
View File

@@ -0,0 +1,30 @@
package main
import (
"cybertron/configs"
mig "cybertron/db"
"cybertron/pkg/log"
"github.com/spf13/cobra"
"go.uber.org/zap"
)
func main() {
configs.LoadMigConfig()
command := &cobra.Command{
Use: "migrations",
Short: "migrations",
Long: "running DB migrations",
RunE: func(cmd *cobra.Command, args []string) error {
err := mig.RunDatabaseMigrations()
if err != nil {
log.Fatal("cybertron migrations failed", zap.Error(err))
}
return nil
},
}
if err := command.Execute(); err != nil {
log.Fatal("cybertron migrations command execution failed", zap.Error(err))
}
}