8000 Regional configs by arainko · Pull Request #109 · arainko/ducktape · GitHub
[go: up one dir, main page]

Skip to content

Regional configs - #109

Merged
arainko merged 11 commits into
series/0.2.xfrom
regional-configs-2
Jan 1, 2024
Merged

arainko merged 11 commits into
series/0.2.xfrom
regional-configs-2

Conversation

@arainko
@arainko arainko commented Jan 1, 2024
Copy link
Copy Markdown
Owner
  • add support for for 'regional' configs, eg. Field.fallbackToNone and Field.fallbackToDefault with an additional .regional combinator (eg. Field.fallbackToDefault.regional(_.level1) which means that the defaults for missing fields will be only applied for things on the same level and 'below' the thing the user specifies)
final case class SourceToplevel(level1: SourceLevel1)
final case class SourceLevel1(str: String)

final case class DestToplevel(extra: Int = 111, level1: DestLevel1)
final case class DestLevel1(extra: String = "level1", str: String)

val source = SourceToplevel(SourceLevel1("str"))
source
  .into[DestToplevel]
  .transform(
     Field.fallbackToDefault.regional(_.level1),
     Field.const(_.extra, 123)
  )
// will return DestToplevel(123, DestLevel1("level1", "str"))

source
  .into[DestToplevel]
  .transform(
     Field.fallbackToDefault
  )
// will return DestToplevel(111, DestLevel1("level1", "str"))

@arainko
arainko merged commit b076131 into series/0.2.x Jan 1, 2024
@arainko
arainko deleted the regional-configs-2 branch March 15, 2024 15:43
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

0