登录 注册
内容创作与媒体工具AI 模型与开发框架数据分析与数据处理 dottymetaprogrammingscalascala3
440
Stars
8
Forks
2
Watchers
4
Open Issues
NOASSERTION
许可证
Scala
语言
2021-10-05
创建时间
2026-11-01
最近更新

项目能做什么

ducktape 是一款专为 Scala 3 设计的无样板类型转换库(灵感来自 chimney)。它主要解决相似数据模型间手动映射繁琐的问题,能在编译期自动、可定制地实现结构相似的 case class、sealed trait 和 enum 之间的无缝转换。
来源:AI 基于仓库事实生成 · 内容以仓库实际 README 为准

使用说明 查看原始 README 原仓库文档

中文使用说明暂未生成。下面保留原仓库 README 摘录,命令与配置均以原文为准。
原始 README 摘录(英文原文,节选前 3000 字符)
# ![ducktape-logo-32](https://user-images.githubusercontent.com/46346508/236060869-3b118075-f660-44c9-9d0d-d40fba5c8db0.svg) ducktape 0.2.x

*ducktape* is a library for boilerplate-less and configurable transformations between case classes and enums/sealed traits for Scala 3. Directly inspired by [chimney](https://github.com/scalalandio/chimney).

If this project interests you, please drop a 🌟 - these things are worthless but give me a dopamine rush nonetheless.

## Installation
```scala
libraryDependencies += "io.github.arainko" %% "ducktape" % "0.2.12"

// or if you're using Scala.js or Scala Native
libraryDependencies += "io.github.arainko" %%% "ducktape" % "0.2.12"
```

NOTE: the [version scheme](https://www.scala-lang.org/blog/2021/02/16/preventing-version-conflicts-with-versionscheme.html) is set to `early-semver`

You're currently browsing the documentation for `ducktape 0.2.x`, if you're looking for the `0.1.x` docs go here: https://github.com/arainko/ducktape/tree/series/0.1.x

## Documentation

Head on over to the [docs site](https://arainko.github.io/ducktape/)!

## Motivating example

`ducktape` is all about painlessly transforming between similiarly structured case classes/enums/sealed traits:

```scala
import java.time.Instant
import io.github.arainko.ducktape.*

// imagine this is a wire model of some kind - JSON, protobuf, avro, what have you...
object wire {
  final case class Person(
    firstName: String,
    lastName: String,
    paymentMethods: List[wire.PaymentMethod],
    status: wire.Status,
    updatedAt: Option[Instant],
  )

  enum Status:
    case Registered, PendingRegistration, Removed

  enum PaymentMethod:
    case Card(name: String, digits: Long, expires: Instant)
    case PayPal(email: String)
    case Cash
}

object domain {
  final case class Person( // <-- fields reshuffled 
    lastName: String,
    firstName: String,
    status: Option[domain.Status], // <-- 'status' in the domain model is optional
    paymentMethods: Vector[domain.Payment], // <-- collection type changed from a List to a Vector
    updatedAt: Option[Instant],
  )

  enum Status:
    case Registered, PendingRegistration, Removed
    case PendingRemoval // <-- additional enum case

  enum Payment:
    case Card(name: String, digits: Long, expires: Instant)
    case PayPal(email: String)
    case Cash
}

val wirePerson: wire.Person = wire.Person(
  "John",
  "Doe",
  List(
    wire.PaymentMethod.Cash,
    wire.PaymentMethod.PayPal("john@doe.com"),
    wire.PaymentMethod.Card("J. Doe", 12345, Instant.now)
  ),
  wire.Status.PendingRegistration,
  Some(Instant.ofEpochSecond(0))
)
```

```scala
val domainPerson = wirePerson.to[domain.Person]
// domainPerson: Person = Person(
//   lastName = "Doe",
//   firstName = "John",
//   status = Some(value = PendingRegistration),
//   paymentMethods = Vector(
//     Cash,
//     PayPal(email = "john@doe.com"),
//     Card(
//       name = "J. Doe",
//       digits = 12345L,
//       expires = 2024-03-10T00
阅读完整原文

项目深度分析 AI 生成

企业级 Scala 3 DDD 架构重构与性能调优咨询

产品构想依托对元编程和数据转换底层原理的积累,为正在从 Scala 2 升级到 Scala 3 或采用大型复杂模型架构的企业提供架构重构与元编程性能咨询服务。
核心功能定制映射规则编写、编译期宏展开性能分析、超大规模 Case Class 结构映射方案优化、遗留代码平滑重构策略。
目标用户金融、电商等领域维护大规模 Scala 业务系统、正在推进 Scala 3 升级的科技企业架构团队。
难度/周期高 · 1 - 3 个月(单项目) · 成本:人力时间成本与业务拓展沟通成本
收费模式按人天或项目阶段收取企业咨询费
竞争风险Scala 3 市场整体规模较小,企业升级动力不足导致需求频次低;高度依赖顾问个人在社区的声誉。
依据 已验证事实

IDE 辅助转换插件与可视化映射调试工具

产品构想针对复杂模型开发 IntelliJ IDEA / VS Code (Metals) 商业插件,提供可视化模型字段映射预览、自动修复不匹配字段及宏生成代码诊断功能。
核心功能字段映射自动补全、编译期宏错误原因深度追踪与可视化解释、不兼容类型快速修复建议。
目标用户重度使用 Scala 3 开发复杂业务系统、频繁处理 DTO/Entity 转换的开发者及研发团队。
难度/周期中等至高 · 3 - 6 个月 · 成本:IDE 插件开发维护与多版本兼容测试成本
收费模式个人与商业订阅模式(Freemium 模式,高级映射分析与调试收费)
竞争风险目标用户群体基数过小(Scala 3 开发者),付费转化率较低,难以覆盖插件维护成本。
依据 AI推测

Protobuf/Avro 自动化模型绑定及桥接生成器

产品构想开发针对 Protobuf、Avro 或 OpenAPI 等标准协议的专用插件,自动生成适配 ducktape 的无缝模型映射与校验胶水层代码。
核心功能从 Proto/OpenAPI Schema 自动生成领域模型转换层、双向自动映射代码校验、差异告警机制。
目标用户使用微服务架构、广泛使用 gRPC/Protobuf 且后端基于 Scala 3 的技术团队。
难度/周期中等 · 2 - 4 个月 · 成本:SBT/Mill 插件生态维护及多协议解析器适配
收费模式开源核心 + 企业特异性协议/定制规则生成工具商业授权
竞争风险同类竞品(如 Chimney 本身以及各种官方代码生成器插件)已有一定市场占有率,替代动力不足。
依据 尚需验证的假设
AI 基于仓库公开数据分析生成,含推测成分,不构成收益承诺。
报告会保存到 个人中心

竞品与相似项目 GitHub Search 真实检索

项目中文简介Stars语言
scala/scala3 中文介绍暂未生成
The Scala 3 compiler, also known as Dotty.
6,337 Scala
scalacenter/scalafix 中文介绍暂未生成
Refactoring and linting tool for Scala
878 Scala
scala/scala3-example-project 中文介绍暂未生成
An example sbt project that compiles using Dotty
340 Scala
scalaprops/scalaprops 中文介绍暂未生成
property based testing library for Scala
283 Scala
scalacenter/scala-3-migration-guide 中文介绍暂未生成
The Scala 3 migration guide for everyone.
235 Scala
以上为通过 GitHub 官方 Search API 检索的相似项目,功能差异与优劣势需进一步人工确认,配置 AI 后可生成对比分析。

项目优势与风险

技术成熟度创建于 2021-10-05,近 30 天仍在推送,发布过 31 个 Release
社区活跃Star 440 / Fork 8 / Issue 4(数据支持,可自行核实)
许可证NOASSERTION
主要风险上游项目方向可能变化;同赛道竞争者较多(见竞品表);热度与需求不完全等价

安装与使用

此项目未提供 Docker 镜像,安装步骤以原仓库 README 为准(涉及依赖安装与环境配置,对新手门槛较高)。