curre/example/app/main.go

34 lines
584 B
Go
Raw Normal View History

2022-09-10 01:39:36 +02:00
package main
import (
"context"
"fmt"
"time"
"git.front.kjuulh.io/kjuulh/curre"
)
func main() {
curre.NewManager().
Register(&httpServer{}).
Register(&httpServer{}).
Register(&httpServer{}).
Run(context.Background())
}
type httpServer struct{}
func (hs *httpServer) Init(ctx context.Context) error { return nil }
func (hs *httpServer) Start(ctx context.Context) error {
for {
fmt.Println(fmt.Sprintf("server: %T, %s", hs, time.Now().String()))
time.Sleep(time.Second * 5)
}
return nil
}
2022-09-10 13:08:16 +02:00
func (hs *httpServer) Stop(ctx context.Context) error {
2022-09-10 01:39:36 +02:00
return nil
}