flow-order

command
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2026 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Overview

samples/flow-order/main.go

Demonstra o ciclo completo de um nano serviço usando os pacotes flow, transform e output do go-code-blocks:

Entrada      → server.HTTPBlock          POST /orders
Validação    → flow.Validate             CEL: customer_type == "PJ"
Enrich       → flow.EnrichStep           busca cliente no DynamoDB
Enrich       → flow.EnrichStep           busca crédito (output.CallJSON)
Decisão      → flow.DecideStep           CEL: amount <= credit_available
Gate         → flow.AbortIf              aborta com 402 se reprovado
Transformação→ flow.NewStep+transform    monta payload do pedido
Saída        → flow.NewStep+output.Created  responde HTTP 201

Variáveis de ambiente:

PORT             porta HTTP              (default: 8080)
AWS_REGION       região AWS              (default: us-east-1)
CUSTOMERS_TABLE  tabela DynamoDB         (default: customers-dev)
DYNAMO_ENDPOINT  endpoint local          (default: http://localhost:8000)
CREDIT_API_URL   URL da API de crédito   (default: https://api.example.com)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL