feat(api): docs basic curd implemention

This commit is contained in:
neo-f
2023-03-23 17:43:27 +08:00
parent 005a13d8a5
commit 28edda5c7a
19 changed files with 1304 additions and 222 deletions

20
cmd/gen/main.go Normal file
View File

@@ -0,0 +1,20 @@
package main
import (
"octopus/internal/dal/model"
"gorm.io/gen"
)
// generate code.
func main() {
g := gen.NewGenerator(gen.Config{
OutPath: "internal/dal/query",
Mode: gen.WithDefaultQuery | gen.WithoutContext,
})
g.ApplyBasic(
new(model.Doc),
new(model.DocFolder),
)
g.Execute()
}

View File

@@ -3,6 +3,8 @@ package main
import (
"octopus/cmd/octopus/scripts"
"octopus/cmd/octopus/server"
"octopus/internal/dal"
"octopus/internal/dal/query"
"github.com/rs/zerolog/log"
@@ -17,6 +19,7 @@ var rootCmd = &cobra.Command{
func main() {
rootCmd.AddCommand(server.CmdRun)
rootCmd.AddCommand(scripts.CmdScripts)
query.SetDefault(dal.GetPostgres())
if err := rootCmd.Execute(); err != nil {
log.Fatal().Err(err).Msg("Failed to execute root command")
}