eventmap

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package eventmap provides code generation for mapping between domain events and pupsourcing event sourcing types (es.Event and es.PersistedEvent).

This package supports versioned events where directory structure determines event version (v1, v2, etc.), similar to protobuf package versioning.

The generated code is explicit, readable, and does not use runtime reflection.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	InputDir    string // Directory containing domain events
	OutputDir   string // Directory where generated code will be written
	OutputFile  string // Name of the generated file (default: event_mapping.gen.go)
	PackageName string // Package name for generated code
	ModulePath  string // Go module path for generating import paths
}

Config configures the code generation.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns default configuration.

type EventInfo

type EventInfo struct {
	Name        string
	PackageName string
	ImportPath  string
	Fields      []FieldInfo
	Version     int
}

EventInfo represents a discovered domain event struct.

type FieldInfo

type FieldInfo struct {
	Name     string
	Type     string
	JSONTag  string
	Optional bool
}

FieldInfo represents a struct field.

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

Generator generates event mapping code.

func NewGenerator

func NewGenerator(config *Config) *Generator

NewGenerator creates a new generator with the given configuration.

func (*Generator) Discover

func (g *Generator) Discover() error

Discover walks the input directory and discovers all domain event structs.

func (*Generator) Generate

func (g *Generator) Generate() error

Generate generates the mapping code and writes it to the output file.

Jump to

Keyboard shortcuts

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