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

field 包的 context.WithValue(ctx, 'func_name', ...) 有什么作用? #1244

Open
x-xy-y opened this issue Dec 18, 2024 · 0 comments
Open

Comments

@x-xy-y
Copy link

x-xy-y commented Dec 18, 2024

serializer.go

func (v ValuerType) GormValue(ctx context.Context, db *gorm.DB) (expr clause.Expr) {
	stmt := db.Statement.Schema
	field := stmt.LookUpField(v.Column)
	newValue, err := v.Value.Value(context.WithValue(ctx, "func_name", v.FucName), field, reflect.ValueOf(v.Value), v.Value)
	db.AddError(err)
	return clause.Expr{SQL: "?", Vars: []interface{}{newValue}}
}

这里,所设置的 func_name,最终会在什么场景下用到?搜索了 gorm 的代码,好像也没有使用 func_name 的地方

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