Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Implements ¶
type Implements[T any] struct { // contains filtered or unexported fields }
Implements is a type that is being embedded inside a component implementation struct to indicate that the struct implements a component of type T. For example, consider a Cache component.
type Cache interface { Get(ctx context.Context, key string) (string, error) Put(ctx context.Context, key, value string) error }
A concrete type that implements the Cache component is written as follows:
type lruCache struct { weaver.Implements[Cache] ... }
Because Implements is embedded inside the component implementation, methods of Implements are available as methods of the component implementation type and can be invoked directly. For example, given an instance c of type lruCache, we can call c.Logger().
type InstanceOf ¶
type InstanceOf[T any] interface { // contains filtered or unexported methods }
InstanceOf is the interface implemented by a struct that embeds gaffa.Implements[T].
type Main ¶
type Main interface{}
Main is the interface implemented by an application's main component.
type PointerToMain ¶
type PointerToMain[T any] interface { *T InstanceOf[Main] }
PointerToMain is a type constraint that asserts *T is an instance of Main (i.e. T is a struct that embeds weaver.Implements[weaver.Main]).
Directories
¶
Path | Synopsis |
---|---|
cmd
|
|
internal
|
|
files
Package files contains file-related utilities.
|
Package files contains file-related utilities. |
generate
Package generate contains code which is almost completely stolen from Service Weaver.
|
Package generate contains code which is almost completely stolen from Service Weaver. |