learnlytics-go/templ/runtime/runtime.go

22 lines
575 B
Go
Raw Normal View History

2025-03-20 12:35:13 +01:00
package runtime
import (
"context"
"io"
"github.com/a-h/templ"
)
// GeneratedComponentInput is used to avoid generated code needing to import the `context` and `io` packages.
type GeneratedComponentInput struct {
Context context.Context
Writer io.Writer
}
// GeneratedTemplate is used to avoid generated code needing to import the `context` and `io` packages.
func GeneratedTemplate(f func(GeneratedComponentInput) error) templ.Component {
return templ.ComponentFunc(func(ctx context.Context, w io.Writer) error {
return f(GeneratedComponentInput{ctx, w})
})
}