From a2c53271e4c817a2eb05e8b55e17f3887dba6f71 Mon Sep 17 00:00:00 2001 From: kjuulh Date: Sat, 10 Sep 2022 19:55:19 +0200 Subject: [PATCH] with public func --- builder.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/builder.go b/builder.go index 0cfc7fa..1ed42b4 100644 --- a/builder.go +++ b/builder.go @@ -3,9 +3,9 @@ package curre import "context" type FunctionalComponent struct { - init func(ctx context.Context) error - start func(ctx context.Context) error - stop func(ctx context.Context) error + InitFunc func(ctx context.Context) error + StartFunc func(ctx context.Context) error + StopFunc func(ctx context.Context) error } func NewFunctionalComponent( @@ -15,20 +15,20 @@ func NewFunctionalComponent( } func (fc *FunctionalComponent) Init(ctx context.Context) error { - if fc.init != nil { - return fc.init(ctx) + if fc.InitFunc != nil { + return fc.InitFunc(ctx) } return nil } func (fc *FunctionalComponent) Start(ctx context.Context) error { - if fc.start != nil { - return fc.start(ctx) + if fc.StartFunc != nil { + return fc.StartFunc(ctx) } return nil } func (fc *FunctionalComponent) Stop(ctx context.Context) error { - if fc.stop != nil { - return fc.stop(ctx) + if fc.StopFunc != nil { + return fc.StopFunc(ctx) } return nil }