Documentation
¶
Overview ¶
Package decl is shared by the hook, activity and event packages: it resolves the service a Scope belongs to, derives payload schemas and encodes payloads.
Index ¶
- func Activity[Req, Res any](scope deps.Scope, name string, kind backplanev1.ActivityKind, ...) *env.Env
- func CheckName(kind, name string)
- func Decode(data []byte, v any) error
- func Encode(v any) ([]byte, error)
- func Env(scope any, what string) (*env.Env, *node.Node)
- func Schema[T any](scope deps.Scope, service, name string) *sp.Schema
- type ActivityOption
- type ActivityOptionFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Activity ¶
func Activity[Req, Res any]( scope deps.Scope, name string, kind backplanev1.ActivityKind, opts []ActivityOption, ) *env.Env
declare records the activity in the manifest.
func CheckName ¶
func CheckName(kind, name string)
CheckName panics unless name is CamelCase — [A-Z][A-Za-z0-9]* — the form of hook, activity and workflow names: they are Temporal type and Nexus operation names and read as <service>.<Name> everywhere.
func Decode ¶
Decode is the inverse of Encode. Fields the payload has and v does not are ignored on both paths: a producer may add fields before its consumers know them (payloads evolve additively; a renamed field is a new field). v may point to a nil proto message pointer (a Ref[*pb.X]): the message is allocated.
func Schema ¶
Schema reflects T under <service>/<name>@1.0.0, or nil when T cannot be described: the declaration stays, the payload is plain JSON. Schema reflects T as the manifest's schema of name. A type schemapb cannot reflect (an unsupported field, a malformed schemapb tag) leaves the payload plain JSON: the console shows no form for it, so the author is told on scope's log.
Types ¶
type ActivityOption ¶
type ActivityOption interface {
// contains filtered or unexported methods
}
ActivityOption records transport-neutral operation metadata.
type ActivityOptionFunc ¶
type ActivityOptionFunc func(*backplanev1.Activity)
ActivityOptionFunc is the internal option constructor.