Skip to content

DRY up common fields across Injector modules via __using__ macro#14

Merged
kenichirow merged 4 commits intomainfrom
feature/dry-injector-common-fields
Feb 17, 2026
Merged

DRY up common fields across Injector modules via __using__ macro#14
kenichirow merged 4 commits intomainfrom
feature/dry-injector-common-fields

Conversation

@kenichirow
Copy link
Owner

Summary

  • Replace Faultex.Injector protocol with a regular module providing a __using__ macro
  • The macro generates defstruct with 7 shared fields (:id, :disable, :host, :method, :path, :headers, :percentage) plus module-specific fields
  • Remove all defimpl Faultex.Injector blocks from each injector module
  • Dispatch inject/1 via injector.__struct__.inject(injector) instead of protocol

Closes #43

kenichirow and others added 4 commits February 18, 2026 00:26
Replace Faultex.Injector protocol with a regular module that provides
a __using__ macro to generate defstruct with shared fields. Each
injector now uses `use Faultex.Injector, fields: [...]` instead of
duplicating 7 common fields. Remove all defimpl blocks.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
use Faultex.Injector now only injects @__fields__ module attribute,
following Elixir convention that `use` is for behavior injection rather
than struct definition.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@kenichirow kenichirow merged commit ae7d3b8 into main Feb 17, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant