mappers

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExampleMapper

type ExampleMapper struct{}

ExampleMapper is an example mapper that demonstrates how to implement the port.RequestMapper interface.

To create a new mapper: 1. Define the payload struct (e.g., ExamplePayload) 2. Add the //docengine:mapper comment before the mapper struct 3. Implement the methods: Map(), ExtractInjectableValues(), Validate() 4. Run: make gen

func (*ExampleMapper) Map

func (m *ExampleMapper) Map(ctx context.Context, mapCtx *port.MapperContext) (any, error)

Map parses the raw body and returns the business-specific payload. If you need to support multiple document types, route internally here.

type ExamplePayload

type ExamplePayload struct {
	CustomerName string  `json:"customerName"`
	ProductID    string  `json:"productId"`
	Amount       float64 `json:"amount"`
	Quantity     int     `json:"quantity"`
}

ExamplePayload is the business-specific payload. Define the fields you expect to receive in the request body.

Jump to

Keyboard shortcuts

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