volatiletech / sqlboiler

Generate a Go ORM tailored to your database schema.
BSD 3-Clause "New" or "Revised" License
6.56k stars 533 forks source link

Add custom tags for specific colum(s) in table(s) #1383

Closed hasahmad closed 1 month ago

hasahmad commented 1 month ago

[Feature request]

Is there a way to add custom tags for specific columns in tables for code generation? I could not find anything related to it in the documentation.

Similar to defining aliases in the sqlboiler.toml config, maybe we could provide it like below?

[tags.tables.users.columns]
first_name = 'encrypt:"first_name"'
last_name = 'encrypt:"last_name"'
email = 'encrypt:"email"'
stephenafamo commented 1 month ago

You can add custom tags with the --tag flag (or corresponding config option).

You can also customize the struct tag case. https://github.com/volatiletech/sqlboiler?tab=readme-ov-file#custom-struct-tag-case

Would using these enable you achieve your use case?