ecodeclub / eorm

简单 ORM 框架
Apache License 2.0
194 stars 64 forks source link

Ignore Columns #47

Closed flycash closed 2 years ago

flycash commented 2 years ago

English Only

Please check existing issues first to avoid duplication and answer the questions below before submitting your issue.

Use case(s)

(Please state use cases, what problem will this feature solve?)

Sometimes users define a complicate structure but some of its fields should not be inserted into databases. It indicates one thing: some fields can not be mapped to columns.

In some small applications, users do not use entity or PO. They only have one layer named model, and they use models in their business code as well as DAO.

So we need to allow users to declare that they want EQL to ignore some field.

Proposed Solution

(Please describe your proposed design/solution, if any)

We already have a MetaRegistry named tagMetaRegistry, so we can use the syntax: eql:"-" to ignore the columns. Besides, we need to provide an option to ignore some fields when users register models.

Alternatives Considered

(Other possible options for solving the problem?)

Additional Context

(Paste any relevant logs - please use code blocks (```) to format console output, logs, and code as it's very hard to read otherwise.)

(If you can, link to the line of code that might be helpful to explain the context)

Codexiaoyi commented 2 years ago

In the option that ignore some fields, we can compare field name of user input and field name of 'TableMeta' to ignore some fields. I think i can do it.

Codexiaoyi commented 2 years ago

Add ignore column examples.