Skip to content

database/gdb: Any support for sqlx like NamedQuery and NamedExec ? #3865

Open
@RyoJerryYu

Description

@RyoJerryYu

What do you want to ask?

Using sqlx , we can exec an SQL like this:

type Task struct {
	ID     int64  `db:"id"`
	UserID string `db:"user_id"`
	Name   string       `db:"name"`
	Status proto.Status `db:"status"`
	CreateTime int64 `db:"timestamp"`
}

//...

result, err := db.NamedExec("INSERT INTO tasks (user_id,  status,timestamp) VALUES (:user_id, :status, :timestamp)", task)

Any similar alternative method to do this, just like DB.GetOne in GoFrame play well as an alternative to DB.Get in sqlx ?

In addition:

We do not intent to adapt into GoFrame's orm models, because there are too much works to do in our existing project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurehelp wantedplannedThis issue/proposal is planned into our next steps.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions