summaryrefslogtreecommitdiff
path: root/vendor/github.com/a-h/templ/join.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/a-h/templ/join.go')
-rw-r--r--vendor/github.com/a-h/templ/join.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/vendor/github.com/a-h/templ/join.go b/vendor/github.com/a-h/templ/join.go
new file mode 100644
index 0000000..a809359
--- /dev/null
+++ b/vendor/github.com/a-h/templ/join.go
@@ -0,0 +1,19 @@
+package templ
+
+import (
+ "context"
+ "io"
+)
+
+// Join returns a single `templ.Component` that will render provided components in order.
+// If any of the components return an error the Join component will immediately return with the error.
+func Join(components ...Component) Component {
+ return ComponentFunc(func(ctx context.Context, w io.Writer) (err error) {
+ for _, c := range components {
+ if err = c.Render(ctx, w); err != nil {
+ return err
+ }
+ }
+ return nil
+ })
+}