Discover Packages
github.com/Js41313/server
pkg
service
package
Version:
v0.0.0-...-f0a2dc7
Opens a new window with list of versions in this module.
Published: Jul 25, 2025
License: GPL-3.0
Opens a new window with license information.
Imports: 3
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
Documentation
¶
func Once(fn func()) func()
Group A ServiceGroup is a group of services.
Attention: the starting order of the added services is not guaranteed.
func NewServiceGroup() *Group
NewServiceGroup returns a ServiceGroup.
Add adds service into sg.
Start starts the ServiceGroup.
There should not be any logic code after calling this method, because this method is a blocking one.
Also, quitting this method will close the logx output.
Stop stops the ServiceGroup.
Service is the interface that groups Start and Stop methods.
func WithStart(start func()) Service
WithStart wraps a start func as a Service.
WithStarter wraps a Starter as a Service.
type Starter interface {
Start()
}
Starter is the interface wraps the Start method.
type Stopper interface {
Stop()
}
Stopper is the interface wraps the Stop method.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.