Documentation
¶
Index ¶
- func From[A any](in awsevents.IEventBus, cat ...string) duct.Morphism[A, A]
- func Join[A, B, C any](f F[B, C], m duct.Morphism[A, B]) duct.Morphism[A, C]
- func Lift[A, B, C any](f F[B, C], m duct.Morphism[A, []B]) duct.Morphism[A, C]
- func LiftP[A, B, C any](n int, f F[B, C], m duct.Morphism[A, []B]) duct.Morphism[A, C]
- func StateMachine[A, B any](ts TypeStep, m duct.Morphism[A, B])
- func ToEventBus[A, B any](source string, bus awsevents.IEventBus, m duct.Morphism[A, B], cat ...string) duct.Morphism[A, duct.Void]
- func ToQueue[A, B any](q awssqs.IQueue, m duct.Morphism[A, B]) duct.Morphism[A, duct.Void]
- func Unit[A, B any](m duct.Morphism[A, B]) duct.Morphism[A, []B]
- func Wrap[A, B any](m duct.Morphism[A, []B]) duct.Morphism[A, B]
- type F
- type Function
- type FunctionTypedProps
- type IFunction
- type Lambda
- type TypeStep
- type TypeStepProps
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Join ¶
Compose lambda function transformer 𝑓: B ⟼ C with morphism 𝑚: A ⟼ B producing a new morphism 𝑚: A ⟼ C.
func Lift ¶
Compose lambda function transformer 𝑓: B ⟼ C with morphism 𝑚: A ⟼ []B. It produces a new computation 𝑚: A ⟼ []C that enables transformation within `[]C` context without immediate collapsing (see duct.LiftF for details). In other words, it nests the computation within the slice context. It is a responsibility of lifter to do something with those nested contexts either yielding individual elements or uniting (e.g. use Unit(Join(g, Lift(f))) to leave nested context into the morphism 𝑚: A ⟼ []C).
func LiftP ¶
See Lift for details. The function LiftP is equivalent to Lift but allows to specify the maximum number of concurrent invocations of the lambda function.
func StateMachine ¶
StateMachine injects the morphism into the AWS Step Function, it constructs the state machine from the defined computation.
func ToEventBus ¶
func ToEventBus[A, B any](source string, bus awsevents.IEventBus, m duct.Morphism[A, B], cat ...string) duct.Morphism[A, duct.Void]
Yield results of 𝑚: A ⟼ B binding it with AWS EventBridge.
func Unit ¶
Unit finalizes a transformation context by collapsing the nested morphism. It acts as the terminal operation, ensuring that all staged compositions, such as those built with Lift and Wrap, are fully resolved into a single, consumable form.
Types ¶
type F ¶ added in v0.0.6
type F[A, B any] interface { // HKT1 is a phantom method that represents the type-level // information of a function A → B. It is not meant to be called. HKT1(func(A) B) // F returns the underlying AWS Lambda IFunction instance. F() awslambda.IFunction }
F is a generic interface that represents a function from A to B and its associated AWS Lambda implementation.
It's phantom method HKT1, which encodes the type-level information of a rank-1 function type func(A) B. This serves as a placeholder and ensures that implementations respect the intended type signature.
An actual AWS Lambda implementation through the F() method.
type Function ¶ added in v0.0.4
Deploys a function as an AWS Lambda while preserving type-safe annotations. This construct is designed for Infrastructure as Code (IaC) scenarios where type safety is critical, such as when integrating with AWS Step Functions.
Unlike a typical AWS Lambda deployment where `func main()` serves as the entry point, this construct requires a function that returns a valid AWS Lambda handler of the form:
func M() func(context.Context, A) (B, error) {
/* AWS Lambda bootstrap code goes here */
return func(context.Context, A) (B, error) {
/* AWS Lambda handler goes here */
}
}
The primary reason is that this construct automatically generates a `main.go` file from the provided handler, ensuring consistent wiring and preserving type information throughout the deployment process.
func NewFunctionTyped ¶ added in v0.0.4
func NewFunctionTyped[A, B any](scope constructs.Construct, id *string, spec *FunctionTypedProps[A, B]) *Function[A, B]
Instantiates deployment for "type-safe" AWS Lambda.
type FunctionTypedProps ¶ added in v0.0.4
type FunctionTypedProps[A, B any] struct { *scud.FunctionGoProps Handler Lambda[A, B] AutoGen bool }
Specify the deployment properties for "type-safe" AWS Lambda.
Unlike a typical AWS Lambda deployment where `func main()` serves as the entry point, this construct requires a function that returns a valid AWS Lambda handler of the form:
func M() func(context.Context, A) (B, error) {
/* AWS Lambda bootstrap code goes here */
return func(context.Context, A) (B, error) {
/* AWS Lambda handler goes here */
}
}
The primary reason is that this construct automatically generates a `main` function file from the provided handler, ensuring consistent wiring and preserving type information throughout the deployment process.
Use FunctionTyped as a constructor for FunctionTypedProps to eliminate the boilerplate
func NewFunctionTypedProps ¶ added in v0.0.4
func NewFunctionTypedProps[A, B any](f Lambda[A, B], props *scud.FunctionGoProps) *FunctionTypedProps[A, B]
Constructor for NewFunctionTypedProps to support automatic inference of types from function
func (*FunctionTypedProps[A, B]) ForceAutoGen ¶ added in v0.0.6
func (f *FunctionTypedProps[A, B]) ForceAutoGen() *FunctionTypedProps[A, B]
type IFunction ¶ added in v0.0.6
Imports an existing AWS Lambda function with type-safe annotations.
func Function_FromFunctionArn ¶ added in v0.0.4
func Function_FromFunctionArn[A, B any](scope constructs.Construct, id *string, arn *string) *IFunction[A, B]
Import existing function
type TypeStep ¶
type TypeStep interface {
constructs.IConstruct
}
TypeStep is AWS CDK L3, a builder for AWS Step Function state machine.
func NewTypeStep ¶
func NewTypeStep(scope constructs.Construct, id *string, props *TypeStepProps) TypeStep
Create a new instance of TypeStep construct
type TypeStepProps ¶
type TypeStepProps struct {
// DeadLetterQueue is the queue to receive messages to if an error occurs
// while running the computation. The message is input JSON and "error".
DeadLetterQueue awssqs.IQueue
// SeqConcurrency is the maximum number of lambda's invocations allowed for
// itterators while processing the sequence of computations (morphism 𝑚: A ⟼ []B).
SeqConcurrency *float64
}
TypeStep L3 construct properties