Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I can't resolve issue #1022 (closed) #1220

Open
remotejob opened this issue Sep 25, 2024 · 0 comments
Open

I can't resolve issue #1022 (closed) #1220

remotejob opened this issue Sep 25, 2024 · 0 comments

Comments

@remotejob
Copy link

Your Question

I can't resolve issue #1022

The target database failed to be located ??? #1022 (closed)

g := gen.NewGenerator(gen.Config{
	OutPath: "./models",
	Mode:    gen.WithoutContext | gen.WithDefaultQuery | gen.WithQueryInterface, // generate mode
})

dsn := "host=127.0.0.1 user=root password=*** dbname=kadry_db_test port=5432 sslmode=disable timezone=Asia/Shanghai"
gormdb, err := gorm.Open(postgres.Open(dsn), &gorm.Config{})
if err != nil {

	panic(err)
}

g.UseDB(gormdb) // reuse your gorm db

g.ApplyBasic(
	// Generate struct `User` based on table `users`
	g.GenerateModel("users"),
)
g.Execute()

The document you expected this should be explained

error -> generate struct from table fail: insufficient arguments

Expected answer

How to resolve error generate struct from table fail: insufficient arguments and Create code model

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant