Documentation ¶
Index ¶
- Variables
- func API[API custom.API](sess *Context, addonSlug string) (api API, err error)
- func AttachServiceInfo(c *Context, svcinfo *service.Info) error
- func ReadyEvent() events.Event
- type Config
- type Context
- func (c *Context) CanRecover(err error) bool
- func (c *Context) Deadline() (deadline time.Time, ok bool)
- func (c *Context) Describe(key string) string
- func (c *Context) Destroy(err error)
- func (c *Context) Dispatch(ev events.Event)
- func (c *Context) Done() <-chan struct{}
- func (c *Context) Err() error
- func (c *Context) Get(key string) vars.Variable
- func (c *Context) Has(key string) bool
- func (c *Context) Log() logging.Logger
- func (c *Context) Opts() *options.Options
- func (c *Context) Ready() <-chan struct{}
- func (c *Context) ServiceInfo(svcurl string) (*service.Info, error)
- func (c *Context) Settings() *settings.Profile
- func (*Context) String() string
- func (s *Context) Time(t time.Time) time.Time
- func (c *Context) Valid() bool
- func (c *Context) Value(key any) any
- func (c *Context) Wait() <-chan struct{}
- type Register
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func ReadyEvent ¶
Types ¶
type Config ¶
type Config struct { Logger logging.Logger Profile *settings.Profile Opts *options.Options TimeLocation *time.Location ReadyEvent events.Event EventCh chan<- events.Event APIs map[string]custom.API }
Config is a session builder used internally by the SDK to initialize a session.
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
func (*Context) CanRecover ¶
func (*Context) Deadline ¶
Deadline returns the time when work done on behalf of this context should be canceled. Deadline returns ok==false when no deadline is set. Successive calls to Deadline return the same results.
func (*Context) Done ¶
func (c *Context) Done() <-chan struct{}
Done enables you to hook into chan to know when application exits however DO NOT use that for graceful shutdown actions. Use Application.AddExitFunc or Cloesed instead.
func (*Context) Err ¶
Err returns session error if any or nil If Done is not yet closed, Err returns nil. If Done is closed, Err returns a non-nil error explaining why: Canceled if the context was canceled or DeadlineExceeded if the context's deadline passed. After Err returns a non-nil error, successive calls to Err return the same error.
func (*Context) Opts ¶
Opts returns a map of all options which are defined by application turing current session life cycle.
func (*Context) Ready ¶
func (c *Context) Ready() <-chan struct{}
Ready returns channel which blocks until session considers application to be ready. It is ensured that Ready closes before root or command Do function is called.
func (*Context) Settings ¶
Settings returns a map of all settings which are defined by application and are user configurable.
func (*Context) Wait ¶
func (c *Context) Wait() <-chan struct{}
Wait allows user to cancel application by pressing Ctrl+C or sending SIGINT or SIGTERM while application is running. By default this is not allowed. It returns a Done channel which blocks until application is closed by user or signal is reveived.