Skip to content

E0131: A function an around decorator can't wrap ​

A decorator of the form func(ctx context.Context, fn func(context.Context) error, opts ...O) error, such as @orm.Transaction, runs the function's body inside it: the body becomes fn, the function's context goes in as ctx, and the declaration's decorators of type O (@orm.TxOn("crm")) are its options. The function needs a named context.Context parameter, a body, and an error result — error, (T, error) or Result[T] — and takes one such decorator.

Wrong ​

vuka
@orm.Transaction
func publish(slug string) {
	…
}
vuka
@orm.Transaction
func publish(ctx context.Context, slug string) error {
	…
}

Released under the MIT License. Vuka builds on Go and its tools, which are made by the Go Authors. Vuka is not affiliated with Google or the Go project. Go is a trademark of Google LLC.