Skip to content
This repository was archived by the owner on May 15, 2024. It is now read-only.

提供一种注解和实体类分离的配置方式, 让实体类保持干净 #9

@lookup-cat

Description

@lookup-cat

目前的注解需要直接加在实体类上

@Table
data class User(
  @PrimaryKey
  val id: Int?,
  val username:String?,
  val age:Int?
)

也许我们可以提供另一种配置实体的方式, 就像下面这样

@TableDefine(
  entityClass = User::class,
  primaryKeys = ["id"]
)
class EntityConfig

尽管相比原本配置要稍加麻烦, 但由此一来, User类不再需要添加ktorm-ksp相关的注解. 这一点在实体类型需要作为api类库对外暴露时尤其有用, 例如构建一个小型的Kotlin Multiplatform项目.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions